Skip to content

Commit

Permalink
Merge pull request #265 from sifive/open-docs
Browse files Browse the repository at this point in the history
Add make target to open local documentation
  • Loading branch information
nategraff-sifive authored Jun 5, 2019
2 parents e11e2a0 + 7a27caa commit 1870b34
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,15 @@ help:
@echo " Exports a program for a single target into a standalone"
@echo " project directory at STANDALONE_DEST."
@echo ""
@echo " For more information, view the Freedom E SDK Documentation at"
@echo " https://sifive.github.io/freedom-e-sdk-docs/index.html"
@echo " open-docs"
@echo " Opens the Freedom E SDK documentation in your HTML"
@echo " viewer of choice. The documentation can also be found"
@echo " online at"
@echo " https://sifive.github.io/freedom-e-sdk-docs/index.html"

.PHONY: open-docs
open-docs: scripts/open-docs
$^

.PHONY: clean
clean:
Expand Down
20 changes: 20 additions & 0 deletions scripts/open-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh

SDK_PATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
DOCS_PATH=$SDK_PATH/doc/html/index.html

XDG_OPEN=`which xdg-open`
OPEN=`which open`

if [ "$XDG_OPEN" != "" ]; then
echo "Opening $DOCS_PATH"
$XDG_OPEN $DOCS_PATH

elif [ "$OPEN" != "" ]; then
echo "Opening $DOCS_PATH"
$OPEN $DOCS_PATH

else
echo "Please open $DOCS_PATH in your preferred HTML viewer"
fi

0 comments on commit 1870b34

Please sign in to comment.