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 | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 20 | virtualenv $@ ;\ |
| 21 | source $@/bin/activate ;\ |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 22 | pip install livereload ;\ |
| 23 | pip install -r requirements.txt |
| 24 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 25 | lint: doc8 |
| 26 | |
| 27 | doc8: doc_venv |
| 28 | source $</bin/activate ; set -u ;\ |
| 29 | doc8 --max-line-length 119 \ |
| 30 | $$(find . -name \*.rst ! -path "*doc_venv*") |
| 31 | |
| 32 | clean: |
| 33 | rm -rf doc_venv build |
| 34 | |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 35 | # 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 Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 37 | %: doc_venv Makefile |
| 38 | source $</bin/activate ; set -u ;\ |
| 39 | $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 40 | |