Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 1 | # Minimal makefile for Sphinx documentation |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 2 | |
| 3 | # use bash safe mode, fail quickly |
| 4 | SHELL = bash -e -o pipefail |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 5 | |
| 6 | # You can set these variables from the command line. |
| 7 | SPHINXOPTS = |
| 8 | SPHINXBUILD = sphinx-build |
| 9 | SOURCEDIR = source |
| 10 | BUILDDIR = build |
| 11 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 12 | .PHONY: help Makefile lint |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 13 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 14 | # Put it first so that "make" without argument is like "make help". |
| 15 | help: doc_venv |
| 16 | source $</bin/activate ; set -u ;\ |
| 17 | $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 18 | |
| 19 | doc_venv: |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 20 | virtualenv -p python3 $@ ;\ |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 21 | source $@/bin/activate ;\ |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 22 | pip install -r requirements.txt |
| 23 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 24 | lint: doc8 |
| 25 | |
| 26 | doc8: doc_venv |
| 27 | source $</bin/activate ; set -u ;\ |
| 28 | doc8 --max-line-length 119 \ |
| 29 | $$(find . -name \*.rst ! -path "*doc_venv*") |
| 30 | |
| 31 | clean: |
| 32 | rm -rf doc_venv build |
| 33 | |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 34 | # 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 Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 36 | %: doc_venv Makefile |
| 37 | source $</bin/activate ; set -u ;\ |
| 38 | $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 39 | |