2017-05-14 11:50:01 -03:00
# -*- makefile -*-
# Makefile for Sphinx documentation
#
2020-02-27 02:53:25 +09:00
# for cleaning
subdir- := devicetree/bindings
2017-05-14 11:50:01 -03:00
2025-06-22 08:02:31 +02:00
ifneq ( $( MAKECMDGOALS ) ,cleandocs)
2019-06-04 09:26:27 -03:00
# Check for broken documentation file references
ifeq ( $( CONFIG_WARN_MISSING_DOCUMENTS ) ,y)
2025-08-13 11:16:28 -06:00
$( shell $( srctree ) /tools /docs /documentation -file -ref -check --warn )
2019-06-04 09:26:27 -03:00
endif
2020-10-30 08:40:45 +01:00
# Check for broken ABI files
ifeq ( $( CONFIG_WARN_ABI_ERRORS ) ,y)
2025-08-13 11:33:09 -06:00
$( shell $( srctree ) /tools /docs /get_abi .py --dir $( srctree ) /Documentation /ABI validate )
2020-10-30 08:40:45 +01:00
endif
2025-06-22 08:02:31 +02:00
endif
2020-10-30 08:40:45 +01:00
2017-05-14 11:50:01 -03:00
# You can set these variables from the command line.
SPHINXBUILD = sphinx-build
SPHINXOPTS =
SPHINXDIRS = .
2021-12-07 10:52:59 +01:00
DOCS_THEME =
2021-12-07 10:53:00 +01:00
DOCS_CSS =
2025-09-18 13:54:56 +02:00
RUSTDOC =
2017-05-14 11:50:01 -03:00
PAPER =
BUILDDIR = $( obj) /output
PDFLATEX = xelatex
2022-02-10 10:26:53 +09:00
LATEXOPTS = -interaction= batchmode -no-shell-escape
2017-05-14 11:50:01 -03:00
2025-09-18 13:54:45 +02:00
PYTHONPYCACHEPREFIX ?= $( abspath $( BUILDDIR) /__pycache__)
# Wrapper for sphinx-build
BUILD_WRAPPER = $( srctree) /tools/docs/sphinx-build-wrapper
2024-04-06 11:04:16 +09:00
# For denylisting "variable font" files
# Can be overridden by setting as an env variable
FONTS_CONF_DENY_VF ?= $( HOME) /deny-vf
2017-05-14 11:50:01 -03:00
# 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.)
2017-07-16 19:08:06 -03:00
@echo
2025-09-18 13:54:41 +02:00
@$( srctree) /tools/docs/sphinx-pre-install
2017-05-14 11:50:01 -03:00
@echo " SKIP Sphinx $@ target."
else # HAVE_SPHINX
2025-09-18 13:54:45 +02:00
# Common documentation targets
2025-09-18 13:54:56 +02:00
htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkcheckdocs :
2025-10-01 16:15:26 +02:00
$( Q) PYTHONPYCACHEPREFIX = " $( PYTHONPYCACHEPREFIX) " \
$( srctree) /tools/docs/sphinx-pre-install --version-check
+$( Q) PYTHONPYCACHEPREFIX = " $( PYTHONPYCACHEPREFIX) " \
$( PYTHON3) $( BUILD_WRAPPER) $@ \
2025-09-20 11:40:26 +02:00
--sphinxdirs= " $( SPHINXDIRS) " $( RUSTDOC) \
2025-09-18 13:54:45 +02:00
--builddir= " $( BUILDDIR) " --deny-vf= $( FONTS_CONF_DENY_VF) \
--theme= $( DOCS_THEME) --css= $( DOCS_CSS) --paper= $( PAPER)
2019-03-30 10:45:58 -03:00
2017-05-14 11:50:01 -03:00
2025-10-01 16:15:24 +02:00
endif
2017-05-14 11:50:01 -03:00
# The following targets are independent of HAVE_SPHINX, and the rules should
# work or silently pass without Sphinx.
2025-10-01 16:15:24 +02:00
htmldocs-redirects : $( srctree ) /Documentation /.renames .txt
@tools/docs/gen-redirects.py --output $( BUILDDIR) < $<
2017-10-09 18:26:15 +03:00
refcheckdocs :
2025-08-13 11:16:28 -06:00
$( Q) cd $( srctree) ; tools/docs/documentation-file-ref-check
2017-10-09 18:26:15 +03:00
2017-05-14 11:50:01 -03:00
cleandocs :
$( Q) rm -rf $( BUILDDIR)
2025-09-18 13:54:45 +02:00
# Used only on help
2025-11-04 11:47:23 +05:30
_SPHINXDIRS = $( shell printf "%s\n" $( patsubst $( srctree) /Documentation/%/index.rst,%,$( wildcard $( srctree) /Documentation/*/index.rst)) | sort -f)
2025-09-18 13:54:45 +02:00
2017-05-14 11:50:01 -03:00
dochelp :
@echo ' Linux kernel internal documentation in different formats from ReST:'
@echo ' htmldocs - HTML'
2025-09-05 16:46:08 +02:00
@echo ' htmldocs-redirects - generate HTML redirects for moved pages'
2022-11-16 14:02:09 -05:00
@echo ' texinfodocs - Texinfo'
@echo ' infodocs - Info'
2025-09-18 13:54:53 +02:00
@echo ' mandocs - Man pages'
2017-05-14 11:50:01 -03:00
@echo ' latexdocs - LaTeX'
@echo ' pdfdocs - PDF'
@echo ' epubdocs - EPUB'
@echo ' xmldocs - XML'
2019-10-25 13:52:32 +02:00
@echo ' linkcheckdocs - check for broken external links'
@echo ' (will connect to external hosts)'
@echo ' refcheckdocs - check for references to non-existing files under'
@echo ' Documentation'
2017-05-14 11:50:01 -03:00
@echo ' cleandocs - clean all generated files'
@echo
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
2025-12-27 15:52:44 +03:00
@echo ' top level values for SPHINXDIRS are:'
@echo '$(_SPHINXDIRS)' | fmt -s -w 75 -g 75 | sed 's/^/ /'
2025-11-13 12:00:32 +01:00
@echo ' you may also use a subdirectory like SPHINXDIRS=userspace-api/media,'
@echo ' provided that there is an index.rst file at the subdirectory.'
2017-05-14 11:50:01 -03:00
@echo
2021-12-11 09:57:00 +01:00
@echo ' make DOCS_THEME={sphinx-theme} selects a different Sphinx theme.'
2021-12-07 10:52:59 +01:00
@echo
2021-12-11 09:57:00 +01:00
@echo ' make DOCS_CSS={a .css file} adds a DOCS_CSS override file for html/epub output.'
2021-12-07 10:53:00 +01:00
@echo
2025-09-18 13:54:47 +02:00
@echo ' make PAPER={a4|letter} Specifies the paper size used for LaTeX/PDF output.'
@echo
2025-09-18 13:54:48 +02:00
@echo ' make FONTS_CONF_DENY_VF={path} sets a deny list to block variable Noto CJK fonts'
2025-11-10 15:04:29 -07:00
@echo ' for PDF build. See tools/lib/python/kdoc/latex_fonts.py for more details'
2025-09-18 13:54:48 +02:00
@echo
2017-10-02 17:44:18 -06:00
@echo ' Default location for the generated documents is Documentation/output'