2 # Makefile for Sphinx documentation
5 # You can set these variables from the command line.
6 SPHINXBUILD = sphinx-build
9 BUILDDIR = $(obj)/output
11 # User-friendly check for sphinx-build
12 HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)
14 ifeq ($(HAVE_SPHINX),0)
17 $(warning The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed and in PATH, or set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable.)
18 @echo " SKIP Sphinx $@ target."
22 # User-friendly check for rst2pdf
23 HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi)
26 PAPEROPT_a4 = -D latex_paper_size=a4
27 PAPEROPT_letter = -D latex_paper_size=letter
28 ALLSPHINXOPTS = -d $(BUILDDIR)/.doctrees $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src)
29 # the i18n builder cannot share the environment and doctrees with the others
30 I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
32 quiet_cmd_sphinx = SPHINX $@
33 cmd_sphinx = $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2
36 $(call cmd,sphinx,html)
39 ifeq ($(HAVE_RST2PDF),0)
40 $(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.)
41 @echo " SKIP Sphinx $@ target."
43 $(call cmd,sphinx,pdf)
47 $(call cmd,sphinx,epub)
50 $(call cmd,sphinx,xml)
52 # no-ops for the Sphinx toolchain
59 $(Q)rm -rf $(BUILDDIR)