mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
6387872c86
If the user requested specific DocBooks to be built using 'make
DOCBOOKS=foo.xml htmldocs', assume no Sphinx build is desired. This
check is transitional, and can be removed once we drop the DocBook
build.
Cc: Markus Heiser <markus.heiser@darmarit.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Fixes: 22cba31bae
("Documentation/sphinx: add basic working Sphinx configuration and build")
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
79 lines
2.3 KiB
Makefile
79 lines
2.3 KiB
Makefile
# -*- 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 rst2pdf
|
|
HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/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 = $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2
|
|
|
|
htmldocs:
|
|
$(call cmd,sphinx,html)
|
|
|
|
pdfdocs:
|
|
ifeq ($(HAVE_RST2PDF),0)
|
|
$(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.)
|
|
@echo " SKIP Sphinx $@ target."
|
|
else # HAVE_RST2PDF
|
|
$(call cmd,sphinx,pdf)
|
|
endif # HAVE_RST2PDF
|
|
|
|
epubdocs:
|
|
$(call cmd,sphinx,epub)
|
|
|
|
xmldocs:
|
|
$(call cmd,sphinx,xml)
|
|
|
|
# no-ops for the Sphinx toolchain
|
|
sgmldocs:
|
|
psdocs:
|
|
mandocs:
|
|
installmandocs:
|
|
cleanmediadocs:
|
|
|
|
cleandocs:
|
|
$(Q)rm -rf $(BUILDDIR)
|
|
|
|
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'
|
|
|
|
endif # HAVE_SPHINX
|