]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - Documentation/Makefile.sphinx
Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block
[karo-tx-linux.git] / Documentation / Makefile.sphinx
1 # -*- makefile -*-
2 # Makefile for Sphinx documentation
3 #
4
5 # You can set these variables from the command line.
6 SPHINXBUILD   = sphinx-build
7 SPHINXOPTS    =
8 PAPER         =
9 BUILDDIR      = $(obj)/output
10
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)
13
14 ifeq ($(HAVE_SPHINX),0)
15
16 .DEFAULT:
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."
19
20 else ifneq ($(DOCBOOKS),)
21
22 # Skip Sphinx build if the user explicitly requested DOCBOOKS.
23 .DEFAULT:
24         @echo "  SKIP    Sphinx $@ target (DOCBOOKS specified)."
25
26 else # HAVE_SPHINX
27
28 # User-friendly check for rst2pdf
29 HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi)
30
31 # Internal variables.
32 PAPEROPT_a4     = -D latex_paper_size=a4
33 PAPEROPT_letter = -D latex_paper_size=letter
34 KERNELDOC       = $(srctree)/scripts/kernel-doc
35 KERNELDOC_CONF  = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC)
36 ALLSPHINXOPTS   = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src)
37 # the i18n builder cannot share the environment and doctrees with the others
38 I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
39
40 quiet_cmd_sphinx = SPHINX  $@
41       cmd_sphinx = $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2
42
43 htmldocs:
44         $(call cmd,sphinx,html)
45
46 pdfdocs:
47 ifeq ($(HAVE_RST2PDF),0)
48         $(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.)
49         @echo "  SKIP    Sphinx $@ target."
50 else # HAVE_RST2PDF
51         $(call cmd,sphinx,pdf)
52 endif # HAVE_RST2PDF
53
54 epubdocs:
55         $(call cmd,sphinx,epub)
56
57 xmldocs:
58         $(call cmd,sphinx,xml)
59
60 # no-ops for the Sphinx toolchain
61 sgmldocs:
62 psdocs:
63 mandocs:
64 installmandocs:
65 cleanmediadocs:
66
67 cleandocs:
68         $(Q)rm -rf $(BUILDDIR)
69
70 dochelp:
71         @echo  ' Linux kernel internal documentation in different formats (Sphinx):'
72         @echo  '  htmldocs        - HTML'
73         @echo  '  pdfdocs         - PDF'
74         @echo  '  epubdocs        - EPUB'
75         @echo  '  xmldocs         - XML'
76         @echo  '  cleandocs       - clean all generated files'
77
78 endif # HAVE_SPHINX