1# Minimal makefile for Sphinx documentation 2# 3 4# You can set these variables from the command line, and also 5# from the environment for the first two. 6SPHINXOPTS ?= 7SPHINXBUILD ?= sphinx-build 8SOURCEDIR = . 9BUILDDIR = _build 10 11# Internal variables. 12PAPEROPT_a4 = -D latex_paper_size=a4 13PAPEROPT_letter = -D latex_paper_size=letter 14ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 15 16# Put it first so that "make" without argument is like "make help". 17help: 18 @echo "Please use \`make <target>' where <target> is one of" 19 @echo " clean to remove any build files preset" 20 @echo " html to make standalone HTML files" 21 @echo " pdf to make pdf using xelatex" 22 @echo " linkcheck to check all external links for integrity" 23 @echo " doctest to run all doctests embedded in the documentation (if enabled)" 24 25.PHONY: help clean check_sphinx-build html changes spelling linkcheck doctest Makefile 26 27clean: 28 rm -rf $(BUILDDIR)/* 29 30# User-friendly check for sphinx-build 31check_sphinx-build: 32 @which $(SPHINXBUILD) >/dev/null 2>&1 || (echo "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://www.sphinx-doc.org/en/master/)" >&2; false) 33 34html: check_sphinx-build 35 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 36 @echo 37 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 38 39pdf: check_sphinx-build 40 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 41 @echo "Running LaTeX files through xelatex..." 42 $(MAKE) -C $(BUILDDIR)/latex -i "PDFLATEX=latexmk" "LATEXMKOPTS=-xelatex -interaction=nonstopmode -f -quiet" 43 @echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex." 44 45spelling: check_sphinx-build 46 $(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling 47 @echo 48 @echo "Spell check complete; look for any errors in the above output " \ 49 "or in $(BUILDDIR)/spelling/output.txt." 50 51linkcheck: check_sphinx-build 52 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 53 @echo 54 @echo "Link check complete; look for any errors in the above output " \ 55 "or in $(BUILDDIR)/linkcheck/output.txt." 56 57doctest: check_sphinx-build 58 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 59 @echo "Testing of doctests in the sources finished, look at the " \ 60 "results in $(BUILDDIR)/doctest/output.txt." 61 62# Catch-all target: route all unknown targets to Sphinx using the new 63# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 64%: Makefile 65 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 66