Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v4.11-rc4 130 lines 4.5 kB view raw
1# -*- makefile -*- 2# Makefile for Sphinx documentation 3# 4 5# You can set these variables from the command line. 6SPHINXBUILD = sphinx-build 7SPHINXOPTS = 8SPHINXDIRS = . 9_SPHINXDIRS = $(patsubst $(srctree)/Documentation/%/conf.py,%,$(wildcard $(srctree)/Documentation/*/conf.py)) 10SPHINX_CONF = conf.py 11PAPER = 12BUILDDIR = $(obj)/output 13PDFLATEX = xelatex 14LATEXOPTS = -interaction=batchmode 15 16# User-friendly check for sphinx-build 17HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi) 18 19ifeq ($(HAVE_SPHINX),0) 20 21.DEFAULT: 22 $(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.) 23 @echo " SKIP Sphinx $@ target." 24 25else ifneq ($(DOCBOOKS),) 26 27# Skip Sphinx build if the user explicitly requested DOCBOOKS. 28.DEFAULT: 29 @echo " SKIP Sphinx $@ target (DOCBOOKS specified)." 30 31else # HAVE_SPHINX 32 33# User-friendly check for pdflatex 34HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi) 35 36# Internal variables. 37PAPEROPT_a4 = -D latex_paper_size=a4 38PAPEROPT_letter = -D latex_paper_size=letter 39KERNELDOC = $(srctree)/scripts/kernel-doc 40KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC) 41ALLSPHINXOPTS = $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) 42# the i18n builder cannot share the environment and doctrees with the others 43I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 44 45# commands; the 'cmd' from scripts/Kbuild.include is not *loopable* 46loop_cmd = $(echo-cmd) $(cmd_$(1)) || exit; 47 48# $2 sphinx builder e.g. "html" 49# $3 name of the build subfolder / e.g. "media", used as: 50# * dest folder relative to $(BUILDDIR) and 51# * cache folder relative to $(BUILDDIR)/.doctrees 52# $4 dest subfolder e.g. "man" for man pages at media/man 53# $5 reST source folder relative to $(srctree)/$(src), 54# e.g. "media" for the linux-tv book-set at ./Documentation/media 55 56quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) 57 cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media $2 && \ 58 PYTHONDONTWRITEBYTECODE=1 \ 59 BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \ 60 $(SPHINXBUILD) \ 61 -b $2 \ 62 -c $(abspath $(srctree)/$(src)) \ 63 -d $(abspath $(BUILDDIR)/.doctrees/$3) \ 64 -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \ 65 $(ALLSPHINXOPTS) \ 66 $(abspath $(srctree)/$(src)/$5) \ 67 $(abspath $(BUILDDIR)/$3/$4) 68 69htmldocs: 70 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) 71 72linkcheckdocs: 73 @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var))) 74 75latexdocs: 76 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var))) 77 78ifeq ($(HAVE_PDFLATEX),0) 79 80pdfdocs: 81 $(warning The '$(PDFLATEX)' command was not found. Make sure you have it installed and in PATH to produce PDF output.) 82 @echo " SKIP Sphinx $@ target." 83 84else # HAVE_PDFLATEX 85 86pdfdocs: latexdocs 87 $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=$(PDFLATEX) LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;) 88 89endif # HAVE_PDFLATEX 90 91epubdocs: 92 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var))) 93 94xmldocs: 95 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var))) 96 97endif # HAVE_SPHINX 98 99# The following targets are independent of HAVE_SPHINX, and the rules should 100# work or silently pass without Sphinx. 101 102# no-ops for the Sphinx toolchain 103sgmldocs: 104 @: 105psdocs: 106 @: 107mandocs: 108 @: 109installmandocs: 110 @: 111 112cleandocs: 113 $(Q)rm -rf $(BUILDDIR) 114 $(Q)$(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media clean 115 116dochelp: 117 @echo ' Linux kernel internal documentation in different formats (Sphinx):' 118 @echo ' htmldocs - HTML' 119 @echo ' latexdocs - LaTeX' 120 @echo ' pdfdocs - PDF' 121 @echo ' epubdocs - EPUB' 122 @echo ' xmldocs - XML' 123 @echo ' linkcheckdocs - check for broken external links (will connect to external hosts)' 124 @echo ' cleandocs - clean all generated files' 125 @echo 126 @echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2' 127 @echo ' valid values for SPHINXDIRS are: $(_SPHINXDIRS)' 128 @echo 129 @echo ' make SPHINX_CONF={conf-file} [target] use *additional* sphinx-build' 130 @echo ' configuration. This is e.g. useful to build with nit-picking config.'