blob: a2df41367db355519ffe2e96020002709d85e590 [file] [log] [blame]
Matteo Scandolo9f619492019-10-25 13:11:58 -07001# Minimal makefile for Sphinx documentation
Zack Williams4b0ef4d2019-12-18 14:25:20 -07002
3# use bash safe mode, fail quickly
4SHELL = bash -e -o pipefail
Matteo Scandolo9f619492019-10-25 13:11:58 -07005
6# You can set these variables from the command line.
7SPHINXOPTS =
8SPHINXBUILD = sphinx-build
9SOURCEDIR = source
10BUILDDIR = build
11
Zack Williams4b0ef4d2019-12-18 14:25:20 -070012.PHONY: help Makefile lint
Matteo Scandolo9f619492019-10-25 13:11:58 -070013
Zack Williams4b0ef4d2019-12-18 14:25:20 -070014# Put it first so that "make" without argument is like "make help".
15help: doc_venv
16 source $</bin/activate ; set -u ;\
17 $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Matteo Scandolo9f619492019-10-25 13:11:58 -070018
19doc_venv:
Zack Williamsd2907e62020-04-03 10:23:02 -070020 virtualenv -p python3 $@ ;\
Zack Williams4b0ef4d2019-12-18 14:25:20 -070021 source $@/bin/activate ;\
Matteo Scandolo9f619492019-10-25 13:11:58 -070022 pip install -r requirements.txt
23
Zack Williams4b0ef4d2019-12-18 14:25:20 -070024lint: doc8
25
26doc8: doc_venv
27 source $</bin/activate ; set -u ;\
28 doc8 --max-line-length 119 \
29 $$(find . -name \*.rst ! -path "*doc_venv*")
30
31clean:
32 rm -rf doc_venv build
33
Matteo Scandolo9f619492019-10-25 13:11:58 -070034# Catch-all target: route all unknown targets to Sphinx using the new
35# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Zack Williams4b0ef4d2019-12-18 14:25:20 -070036%: doc_venv Makefile
37 source $</bin/activate ; set -u ;\
38 $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
39