From 362d33813c79595a74fbf53079dc42919a3c402b Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 10 Aug 2016 12:56:36 +0200 Subject: [PATCH] Add code to run hhc.exe to make.bat and Makefile * Thanks to @mivance for the make.bat code! --- docs/Makefile | 32 ++++++++++++++++++++++++-------- docs/make.bat | 13 +++++++++++++ docs/make.sh | 2 +- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 312b86630..5964a0364 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,14 +2,22 @@ # # You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = ../Documentation +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +PAPER ?= +BUILDDIR ?= ../Documentation +HHCBUILD ?= "/C/Program Files (x86)/HTML Help Workshop/hhc.exe" # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) - $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# check for hhc as well +ifeq ($(shell which $(HHCBUILD) >/dev/null 2>&1; echo $$?), 0) +HAS_HHCBUILD = 1 +else +HAS_HHCBUILD = 0 endif # Internal variables. @@ -93,9 +101,17 @@ htmlhelp: # Filter out the auto-generated TOC to remove anchor links and root index.html @cat $(BUILDDIR)/htmlhelp/renderdoc.hhc | python remove_lines.py ".html#" | python remove_lines.py "\"index.html\"" > $(BUILDDIR)/htmlhelp/tmp @mv $(BUILDDIR)/htmlhelp/tmp $(BUILDDIR)/htmlhelp/renderdoc.hhc - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." +ifeq ("$(HAS_HHCBUILD)","1") + -$(HHCBUILD) $(BUILDDIR)/htmlhelp/renderdoc.hhp + @echo "Build finished." +else + @echo $(HHCBUILD) + @echo "Build finished; now you can run HTML Help Workshop with the " \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + @echo "For future, you can either install HTML Help Workshop to the " \ + "default path [C:\Program Files (x86)\HTML Help Workshop] or " \ + "set the variable HHCBUILD to the path to hhc.exe." +endif .PHONY: qthelp qthelp: diff --git a/docs/make.bat b/docs/make.bat index 7ae212894..a108f7c51 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -2,9 +2,14 @@ REM Command file for Sphinx documentation +setlocal + if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) +if "%HHCBUILD%" == "" ( + set "HHCBUILD=C:\Program Files (x86)\HTML Help Workshop\hhc.exe" +) set BUILDDIR=..\Documentation set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . @@ -124,9 +129,17 @@ if "%1" == "htmlhelp" ( REM Filter out the auto-generated TOC to remove anchor links and root index.html type %BUILDDIR%\htmlhelp\renderdoc.hhc | python remove_lines.py ".html#" | python remove_lines.py "\"index.html\"" > %BUILDDIR%\htmlhelp\tmp move %BUILDDIR%\htmlhelp\tmp %BUILDDIR%\htmlhelp\renderdoc.hhc + if NOT "%HHCBUILD%" == "" ( + "%HHCBUILD%" %BUILDDIR%\htmlhelp\renderdoc.hhp + echo.Build finished. + goto end + ) echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. + echo.For future, you can either install HTML Help Workshop to the ^ +default path [C:\Program Files (x86)\HTML Help Workshop] or ^ +set the variable HHCBUILD to the path to hhc.exe. goto end ) diff --git a/docs/make.sh b/docs/make.sh index 839fdaa7b..b1834419c 100644 --- a/docs/make.sh +++ b/docs/make.sh @@ -112,7 +112,7 @@ if [ $1 == "htmlhelp" ]; then cat $BUILDDIR/htmlhelp/renderdoc.hhc | python remove_lines.py ".html#" | python remove_lines.py "\"index.html\"" > $BUILDDIR/htmlhelp/tmp mv $BUILDDIR/htmlhelp/tmp $BUILDDIR/htmlhelp/renderdoc.hhc if [ -f "${HHCBUILD}" ]; then - "C:\Program Files (x86)\HTML Help Workshop\hhc.exe" $BUILDDIR/htmlhelp/renderdoc.hhp + "${HHCBUILD}" $BUILDDIR/htmlhelp/renderdoc.hhp echo "Build finished." exit fi