1# Minimal makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line, and also
5# from the environment for the first two.
6SOURCEDIR     = .
7SOURCES       =
8BUILDDIR      = _build
9PYTHON       = python3
10VENVDIR      = ./venv
11SPHINXBUILD  = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
12
13ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
14
15.PHONY: help clean build html text venv Makefile
16
17# Put it first so that "make" without argument is like "make help".
18help:
19	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20
21clean:
22	-rm -rf build/* $(VENVDIR)/*
23
24build:
25	-mkdir -p build
26	$(SPHINXBUILD) $(ALLSPHINXOPTS)
27	@echo
28
29html: BUILDER = html
30html: build
31	@echo "Build finished. The HTML pages are in build/html."
32
33text: BUILDER = text
34text: build
35	@echo "Build finished; the text files are in build/text."
36
37venv:
38	$(PYTHON) -m venv $(VENVDIR)
39	$(VENVDIR)/bin/python3 -m pip install -U pip setuptools
40	$(VENVDIR)/bin/python3 -m pip install -r requirements.txt
41	@echo "The venv has been created in the $(VENVDIR) directory"
42
43# Catch-all target: route all unknown targets to Sphinx using the new
44# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
45%: Makefile
46	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
47