freeipa/doc/Makefile
Christian Heimes 1717b5b08f Improve Sphinx building and linting
Run sphinx-builder with -W (fail on error), --keep-going, and -j auto.
Auto-job scaling speeds up sphinx-builder a LOT.

Add make lint target to doc/Makefile. The -E and -a option ensure that
all files are always re-read and rewritten.

Add option to run sphinx-builder from a virtual env that mimics RTD
builds closer than Fedora packages.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: François Cami <fcami@redhat.com>
2020-04-22 09:47:14 +02:00

45 lines
1.3 KiB
Makefile

# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
PYTHON ?= python3
VENVDIR = ./.venv
SPHINXOPTS ?= -W --keep-going -j auto
SPHINXBUILD ?= PATH=$(VENVDIR)/bin:$$PATH sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo " lint to check and lint documentation"
@echo " venv to create an isolated venv"
.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)
.PHONY: workshop-remote workshop-pull
workshop-remote:
git remote add -f freeipa-workshop https://github.com/freeipa/freeipa-workshop.git
workshop-pull:
git pull -s subtree freeipa-workshop master
.PHONY: lint
lint:
$(MAKE) html SPHINXOPTS="$(SPHINXOPTS) -E -a"
.PHONY: distclean
distclean: clean
rm -rf $(VENVDIR)
.PHONY: venv
venv:
$(PYTHON) -m venv $(VENVDIR)
$(VENVDIR)/bin/python3 -m pip install -U pip setuptools
$(VENVDIR)/bin/python3 -m pip install -U -r ./requirements.txt