Files
BlackAngelTV 49cbc34ff2 build(docs): use the checkout tool environment when it exists
The documentation needs extensions that are not installed system-wide, so
make html failed on a fresh shell even though the project already keeps them in
the root tool environment. Falling back to sphinx-build keeps the target
working when no environment is present.
2026-11-11 19:38:09 +01:00

43 lines
1.5 KiB
Makefile

# Minimal makefile for Sphinx documentation
#
ifdef FAIL_WARN
override FAIL_WARN=-W
endif
# Ignore these variables if they come from the environment, users can have
# unrelated environment variables with these short names, for example, colors
# set by shell themes. They can still be set on the make command line.
ifeq ($(origin O),environment)
override O=
endif
ifeq ($(origin OPTS),environment)
override OPTS=
endif
# You can set these variables from the command line.
# Prefer the tool environment kept at the root of the checkout, so that the
# documentation builds without installing its extensions system-wide.
VENV ?= ../.venv
SPHINXOPTS = -n -q -j auto -T $(FAIL_WARN) $(OPTS)
SPHINXBUILD ?= $(if $(wildcard $(VENV)/bin/sphinx-build),$(VENV)/bin/sphinx-build,sphinx-build)
SPHINXAUTOBUILD ?= $(if $(wildcard $(VENV)/bin/sphinx-autobuild),$(VENV)/bin/sphinx-autobuild,sphinx-autobuild)
SPHINXPROJ = kitty
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
develop-docs:
$(SPHINXAUTOBUILD) --ignore "$(abspath $(SOURCEDIR))/generated/*" --watch ../kitty --watch ../kittens -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)