Added help command to sphinx Makefile (#6024)

Co-authored-by: Bruno Alla <alla.brunoo@gmail.com>
This commit is contained in:
Matthew Foster Walsh 2025-09-23 10:46:11 -06:00 committed by GitHub
parent 2e4f4dd4de
commit 69e1d9603e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 13 deletions

View File

@ -3,24 +3,21 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = uv run sphinx-build
SPHINXBUILD = uv run --group docs sphinx-build
SOURCEDIR = .
BUILDDIR = _build
.PHONY: help clean html livehtml linkcheck
.PHONY: help clean livehtml linkcheck
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo "html Build the docs as HTML"
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t
# Clean the build output
clean:
-rm -rf $(BUILDDIR)/*
# Build the HTML docs
html:
$(SPHINXBUILD) -b html $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
# Build and serve docs with live reload
livehtml:
sphinx-autobuild -b html --port 9000 --watch . -c . $(SOURCEDIR) $(BUILDDIR)/html
@ -31,3 +28,8 @@ linkcheck:
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .

View File

@ -13,11 +13,11 @@ APP = /app
APP = ../{{cookiecutter.project_slug}}
{% endif %}
.PHONY: html livehtml apidocs Makefile
.PHONY: help livehtml apidocs Makefile
# Put it first so that "make" without argument is like "make html".
html:
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .
# Build, watch and serve docs with live reload
livehtml:

View File

@ -12,7 +12,7 @@ set SOURCEDIR=_source
set BUILDDIR=_build
set APP=..\{{cookiecutter.project_slug}}
if "%1" == "" goto html
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
@ -39,8 +39,8 @@ GOTO :EOF
sphinx-apidoc -o %SOURCEDIR%/api %APP%
GOTO :EOF
:html
%SPHINXBUILD% -b html %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd