Jani Nikula | 22cba31 | 2016-05-19 15:14:05 +0300 | [diff] [blame] | 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 # HAVE_SPHINX |
| 21 | |
| 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) |
| 24 | |
| 25 | # Internal variables. |
| 26 | PAPEROPT_a4 = -D latex_paper_size=a4 |
| 27 | PAPEROPT_letter = -D latex_paper_size=letter |
Jani Nikula | 24dcdeb | 2016-05-20 11:51:47 +0300 | [diff] [blame] | 28 | KERNELDOC = $(srctree)/scripts/kernel-doc |
| 29 | KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC) |
Jani Nikula | c13ce44 | 2016-05-28 15:25:41 +0300 | [diff] [blame] | 30 | ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src) |
Jani Nikula | 22cba31 | 2016-05-19 15:14:05 +0300 | [diff] [blame] | 31 | # the i18n builder cannot share the environment and doctrees with the others |
| 32 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
| 33 | |
| 34 | quiet_cmd_sphinx = SPHINX $@ |
| 35 | cmd_sphinx = $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 |
| 36 | |
| 37 | htmldocs: |
| 38 | $(call cmd,sphinx,html) |
| 39 | |
| 40 | pdfdocs: |
| 41 | ifeq ($(HAVE_RST2PDF),0) |
| 42 | $(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.) |
| 43 | @echo " SKIP Sphinx $@ target." |
| 44 | else # HAVE_RST2PDF |
| 45 | $(call cmd,sphinx,pdf) |
| 46 | endif # HAVE_RST2PDF |
| 47 | |
| 48 | epubdocs: |
| 49 | $(call cmd,sphinx,epub) |
| 50 | |
| 51 | xmldocs: |
| 52 | $(call cmd,sphinx,xml) |
| 53 | |
| 54 | # no-ops for the Sphinx toolchain |
| 55 | sgmldocs: |
| 56 | psdocs: |
| 57 | mandocs: |
| 58 | installmandocs: |
| 59 | |
| 60 | cleandocs: |
| 61 | $(Q)rm -rf $(BUILDDIR) |
| 62 | |
Jani Nikula | ebc88ef | 2016-06-22 15:41:48 +0300 | [diff] [blame^] | 63 | dochelp: |
| 64 | @echo ' Linux kernel internal documentation in different formats (Sphinx):' |
| 65 | @echo ' htmldocs - HTML' |
| 66 | @echo ' pdfdocs - PDF' |
| 67 | @echo ' epubdocs - EPUB' |
| 68 | @echo ' xmldocs - XML' |
| 69 | @echo ' cleandocs - clean all generated files' |
| 70 | |
Jani Nikula | 22cba31 | 2016-05-19 15:14:05 +0300 | [diff] [blame] | 71 | endif # HAVE_SPHINX |