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.
6SPHINXOPTS    ?=
7SPHINXBUILD   ?= sphinx-build
8SOURCEDIR     = .
9BUILDDIR      = _build
10
11# Put it first so that "make" without argument is like "make help".
12help:
13	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
15.PHONY: help clean apidoc breathe_apidoc Makefile
16
17# Intercept the 'clean' target so we can do the right thing for apidoc as well
18clean:
19	@# Clean the apidoc
20	$(MAKE) -C .. apidoc_clean
21	@# Clean the breathe-apidoc generated files
22	rm -rf ./api
23	@# Clean the sphinx docs
24	@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
25
26apidoc:
27	@# Generate doxygen from source using the main Makefile
28	$(MAKE) -C .. apidoc
29
30breathe_apidoc: apidoc
31	@# Remove existing files - breathe-apidoc skips them if they're present
32	rm -rf ./api
33	@# Generate RST file structure with breathe-apidoc
34	breathe-apidoc -o ./api ../apidoc/xml
35
36# Catch-all target: route all unknown targets to Sphinx using the new
37# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
38%: Makefile breathe_apidoc
39	@# Build the relevant target with sphinx
40	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
41