Zack Williams | 553a363 | 2019-08-09 17:14:43 -0700 | [diff] [blame] | 1 | # Makefile for Trellis documentation created with Sphinx |
| 2 | |
| 3 | # use bash for pushd/popd, and to fail quickly. virtualenv's activate |
| 4 | # has undefined variables, so no -u |
| 5 | SHELL = bash -e -o pipefail |
| 6 | |
| 7 | # You can set these variables from the command line. |
| 8 | SPHINXOPTS ?= |
| 9 | SPHINXBUILD ?= sphinx-build |
| 10 | SOURCEDIR ?= . |
| 11 | BUILDDIR ?= _build |
| 12 | |
| 13 | # Put it first so that "make" without argument is like "make help". |
| 14 | help: doc_venv |
| 15 | source ./doc_venv/bin/activate ;\ |
| 16 | $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 17 | |
| 18 | .PHONY: help lint reload Makefile test |
| 19 | |
| 20 | # Create the virtualenv with all the tools installed |
| 21 | doc_venv: |
| 22 | virtualenv doc_venv ;\ |
| 23 | source ./doc_venv/bin/activate ;\ |
| 24 | pip install livereload ;\ |
| 25 | pip install -r requirements.txt |
| 26 | |
| 27 | # automatically reload changes in browser as they're made |
| 28 | reload: doc_venv |
| 29 | source ./doc_venv/bin/activate ;\ |
| 30 | set -u ;\ |
| 31 | sphinx-reload $(SOURCEDIR) |
| 32 | |
| 33 | # lint and link verification. linkcheck is built into sphinx |
| 34 | test: lint linkcheck |
| 35 | |
| 36 | lint: rst-lint |
| 37 | |
| 38 | rst-lint: doc_venv |
| 39 | source ./doc_venv/bin/activate ;\ |
| 40 | set -u ;\ |
Charles Chan | 61dcfb6 | 2019-09-05 10:35:35 -0700 | [diff] [blame] | 41 | rstcheck -r $$(find . -name \*.rst ! -path "*doc_venv*") |
Zack Williams | 553a363 | 2019-08-09 17:14:43 -0700 | [diff] [blame] | 42 | |
| 43 | # clean up |
| 44 | clean: |
| 45 | rm -rf $(BUILDDIR) |
| 46 | |
| 47 | clean-all: clean |
| 48 | rm -rf doc_venv |
| 49 | |
| 50 | # Catch-all target: route all unknown targets to Sphinx using the new |
| 51 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). |
| 52 | %: Makefile doc_venv | $(OTHER_REPO_DOCS) |
| 53 | source ./doc_venv/bin/activate ;\ |
| 54 | set -u ;\ |
| 55 | $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |