To make it easier to invoke from CI, let's add a dedicated Documentation
Makefile.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 Documentation/Makefile | 35 +++++++++++++++++++++++++++++++++++
 Makefile               | 20 +++++++++++---------
 2 files changed, 46 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/Makefile

diff --git a/Documentation/Makefile b/Documentation/Makefile
new file mode 100644
index 000000000000..825cd3ba0e7f
--- /dev/null
+++ b/Documentation/Makefile
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for Sphinx documentation
+# This was not generated by sphinx-quickstart, but nonetheless copies some
+# of its variable name conventions for easier integration with existing tooling
+
+SPHINXBUILD   = sphinx-build
+SPHINXOPTS    =
+
+# Internal variables.
+ALLSPHINXOPTS   =  $(SPHINXOPTS)
+
+srctree ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..)
+objtree ?= $(srctree)
+
+docs: htmldocs FORCE
+
+htmldocs: FORCE
+       @mkdir -p $(srctree)/Documentation/commands
+       @$(srctree)/Documentation/gen_commands.py $(srctree) 
$(srctree)/Documentation/commands
+       @$(SPHINXBUILD) -b html -d $(objtree)/doctrees $(srctree)/Documentation 
\
+               $(objtree)/Documentation/html $(ALLSPHINXOPTS)
+
+dochelp: FORCE
+       @echo  ' barebox internal documentation from ReST:'
+       @echo  '  htmldocs        - HTML'
+       @echo  '  docs            - alias for htmldocs'
+       @echo
+       @echo  '  Default location for the generated documents is 
Documentation/html'
+
+
+PHONY += FORCE
+FORCE:
+
+.PHONY: $(PHONY)
diff --git a/Makefile b/Makefile
index b138ae674878..22e306e69d9e 100644
--- a/Makefile
+++ b/Makefile
@@ -1491,6 +1491,8 @@ endif
        @echo  '  tags/TAGS       - Generate tags file for editors'
        @echo  '  cscope          - Generate cscope index'
        @echo  '                    (default: $(INSTALL_HDR_PATH))'
+       @echo  'Documentation targets:'
+       @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
        @echo  ''
        @echo  'Architecture specific targets ($(SRCARCH)):'
        @$(if $(archhelp),$(archhelp),\
@@ -1515,6 +1517,15 @@ endif
        @echo  'Execute "make" or "make all" to build all targets marked with 
[*] '
        @echo  'For further info see the documentation'
 
+
+# Documentation targets
+# ---------------------------------------------------------------------------
+DOC_TARGETS := docs htmldocs dochelp
+
+PHONY += $(DOC_TARGETS)
+$(DOC_TARGETS):
+       $(Q)$(MAKE) -f $(srctree)/Documentation/Makefile $@
+
 # Code Coverage
 # ---------------------------------------------------------------------------
 
@@ -1541,15 +1552,6 @@ quiet_cmd_tags = GEN     $@
 tags TAGS cscope gtags: FORCE
        $(call cmd,tags)
 
-SPHINXBUILD   = sphinx-build
-ALLSPHINXOPTS   =  source
-
-docs: FORCE
-       @mkdir -p $(srctree)/Documentation/commands
-       @$(srctree)/Documentation/gen_commands.py $(srctree) 
$(srctree)/Documentation/commands
-       @$(SPHINXBUILD) -b html -d $(objtree)/doctrees $(srctree)/Documentation 
\
-               $(objtree)/Documentation/html
-
 bareboxversion:
        @echo $(KERNELVERSION)
 
-- 
2.47.3


Reply via email to