1a8e1175bSopenharmony_ci# Minimal makefile for Sphinx documentation
2a8e1175bSopenharmony_ci#
3a8e1175bSopenharmony_ci
4a8e1175bSopenharmony_ci# You can set these variables from the command line, and also
5a8e1175bSopenharmony_ci# from the environment for the first two.
6a8e1175bSopenharmony_ciSPHINXOPTS    ?=
7a8e1175bSopenharmony_ciSPHINXBUILD   ?= sphinx-build
8a8e1175bSopenharmony_ciSOURCEDIR     = .
9a8e1175bSopenharmony_ciBUILDDIR      = _build
10a8e1175bSopenharmony_ci
11a8e1175bSopenharmony_ci# Put it first so that "make" without argument is like "make help".
12a8e1175bSopenharmony_cihelp:
13a8e1175bSopenharmony_ci	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14a8e1175bSopenharmony_ci
15a8e1175bSopenharmony_ci.PHONY: help clean apidoc breathe_apidoc Makefile
16a8e1175bSopenharmony_ci
17a8e1175bSopenharmony_ci# Intercept the 'clean' target so we can do the right thing for apidoc as well
18a8e1175bSopenharmony_ciclean:
19a8e1175bSopenharmony_ci	@# Clean the apidoc
20a8e1175bSopenharmony_ci	$(MAKE) -C .. apidoc_clean
21a8e1175bSopenharmony_ci	@# Clean the breathe-apidoc generated files
22a8e1175bSopenharmony_ci	rm -rf ./api
23a8e1175bSopenharmony_ci	@# Clean the sphinx docs
24a8e1175bSopenharmony_ci	@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
25a8e1175bSopenharmony_ci
26a8e1175bSopenharmony_ciapidoc:
27a8e1175bSopenharmony_ci	@# Generate doxygen from source using the main Makefile
28a8e1175bSopenharmony_ci	$(MAKE) -C .. apidoc
29a8e1175bSopenharmony_ci
30a8e1175bSopenharmony_cibreathe_apidoc: apidoc
31a8e1175bSopenharmony_ci	@# Remove existing files - breathe-apidoc skips them if they're present
32a8e1175bSopenharmony_ci	rm -rf ./api
33a8e1175bSopenharmony_ci	@# Generate RST file structure with breathe-apidoc
34a8e1175bSopenharmony_ci	breathe-apidoc -o ./api ../apidoc/xml
35a8e1175bSopenharmony_ci
36a8e1175bSopenharmony_ci# Catch-all target: route all unknown targets to Sphinx using the new
37a8e1175bSopenharmony_ci# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
38a8e1175bSopenharmony_ci%: Makefile breathe_apidoc
39a8e1175bSopenharmony_ci	@# Build the relevant target with sphinx
40a8e1175bSopenharmony_ci	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
41