blob: 13176dc194f5e47dcb667fe1bda024fa0ea4d85f [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 Williams4b0ef4d2019-12-18 14:25:20 -070020 virtualenv $@ ;\
21 source $@/bin/activate ;\
Matteo Scandolo9f619492019-10-25 13:11:58 -070022 pip install livereload ;\
23 pip install -r requirements.txt
24
Zack Williams4b0ef4d2019-12-18 14:25:20 -070025lint: doc8
26
27doc8: doc_venv
28 source $</bin/activate ; set -u ;\
29 doc8 --max-line-length 119 \
30 $$(find . -name \*.rst ! -path "*doc_venv*")
31
32clean:
33 rm -rf doc_venv build
34
Matteo Scandolo9f619492019-10-25 13:11:58 -070035# Catch-all target: route all unknown targets to Sphinx using the new
36# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Zack Williams4b0ef4d2019-12-18 14:25:20 -070037%: doc_venv Makefile
38 source $</bin/activate ; set -u ;\
39 $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
40