summaryrefslogtreecommitdiffstats
path: root/Documentation/Makefile.sphinx
blob: fc29e08085aadbd789ed13470d3df1d8583951c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -*- makefile -*-
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXBUILD   = sphinx-build
SPHINXOPTS    =
PAPER         =
BUILDDIR      = $(obj)/output

# User-friendly check for sphinx-build
HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)

ifeq ($(HAVE_SPHINX),0)

.DEFAULT:
	$(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.)
	@echo "  SKIP    Sphinx $@ target."

else ifneq ($(DOCBOOKS),)

# Skip Sphinx build if the user explicitly requested DOCBOOKS.
.DEFAULT:
	@echo "  SKIP    Sphinx $@ target (DOCBOOKS specified)."

else # HAVE_SPHINX

# User-friendly check for pdflatex
HAVE_PDFLATEX := $(shell if which pdflatex >/dev/null 2>&1; then echo 1; else echo 0; fi)

# Internal variables.
PAPEROPT_a4     = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
KERNELDOC       = $(srctree)/scripts/kernel-doc
KERNELDOC_CONF  = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC)
ALLSPHINXOPTS   = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src)
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

quiet_cmd_sphinx = SPHINX  $@
      cmd_sphinx = $(MAKE) BUILDDIR=$(BUILDDIR) $(build)=Documentation/media all; BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2

htmldocs:
	$(call cmd,sphinx,html)

pdfdocs:
ifeq ($(HAVE_PDFLATEX),0)
	$(warning The 'pdflatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.)
	@echo "  SKIP    Sphinx $@ target."
else # HAVE_PDFLATEX
	$(call cmd,sphinx,latex)
	$(Q)$(MAKE) -C $(BUILDDIR)/latex
endif # HAVE_PDFLATEX

epubdocs:
	$(call cmd,sphinx,epub)

xmldocs:
	$(call cmd,sphinx,xml)

# no-ops for the Sphinx toolchain
sgmldocs:
psdocs:
mandocs:
installmandocs:

cleandocs:
	$(Q)rm -rf $(BUILDDIR)

endif # HAVE_SPHINX

dochelp:
	@echo  ' Linux kernel internal documentation in different formats (Sphinx):'
	@echo  '  htmldocs        - HTML'
	@echo  '  pdfdocs         - PDF'
	@echo  '  epubdocs        - EPUB'
	@echo  '  xmldocs         - XML'
	@echo  '  cleandocs       - clean all generated files'