blob: bcb07f8dc664947229cc1ddd76b0444c6137c5d3 [file] [log] [blame]
Jani Nikula22cba312016-05-19 15:14:05 +03001# -*- makefile -*-
2# Makefile for Sphinx documentation
3#
4
5# You can set these variables from the command line.
6SPHINXBUILD = sphinx-build
7SPHINXOPTS =
8PAPER =
9BUILDDIR = $(obj)/output
10
11# User-friendly check for sphinx-build
12HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)
13
14ifeq ($(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
Jani Nikula63878722016-07-01 15:24:44 +030020else ifneq ($(DOCBOOKS),)
21
22# Skip Sphinx build if the user explicitly requested DOCBOOKS.
23.DEFAULT:
24 @echo " SKIP Sphinx $@ target (DOCBOOKS specified)."
25
Jani Nikula22cba312016-05-19 15:14:05 +030026else # HAVE_SPHINX
27
28# User-friendly check for rst2pdf
29HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi)
30
31# Internal variables.
32PAPEROPT_a4 = -D latex_paper_size=a4
33PAPEROPT_letter = -D latex_paper_size=letter
Jani Nikula24dcdeb2016-05-20 11:51:47 +030034KERNELDOC = $(srctree)/scripts/kernel-doc
35KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC)
Jani Nikulac13ce442016-05-28 15:25:41 +030036ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src)
Jani Nikula22cba312016-05-19 15:14:05 +030037# the i18n builder cannot share the environment and doctrees with the others
38I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
39
40quiet_cmd_sphinx = SPHINX $@
41 cmd_sphinx = $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2
42
43htmldocs:
44 $(call cmd,sphinx,html)
45
46pdfdocs:
47ifeq ($(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."
50else # HAVE_RST2PDF
51 $(call cmd,sphinx,pdf)
52endif # HAVE_RST2PDF
53
54epubdocs:
55 $(call cmd,sphinx,epub)
56
57xmldocs:
58 $(call cmd,sphinx,xml)
59
60# no-ops for the Sphinx toolchain
61sgmldocs:
62psdocs:
63mandocs:
64installmandocs:
Jani Nikulaa569bf62016-07-01 15:03:34 +030065cleanmediadocs:
Jani Nikula22cba312016-05-19 15:14:05 +030066
67cleandocs:
68 $(Q)rm -rf $(BUILDDIR)
69
Jani Nikulad9a77fe2016-08-01 12:37:05 +030070endif # HAVE_SPHINX
71
Jani Nikulaebc88ef2016-06-22 15:41:48 +030072dochelp:
73 @echo ' Linux kernel internal documentation in different formats (Sphinx):'
74 @echo ' htmldocs - HTML'
75 @echo ' pdfdocs - PDF'
76 @echo ' epubdocs - EPUB'
77 @echo ' xmldocs - XML'
78 @echo ' cleandocs - clean all generated files'