# Makefile for Sphinx documentation generated by sphinx-quickstart
# ----------------------------------------------------------------------------

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS    ?= --color -W --keep-going
SPHINXBUILD   ?= sphinx-build
SOURCEDIR     = source
BUILDDIR      = _build

# Put it first so that "make" without argument is like "make help".
help:
	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.
#
# Several sphinx-build commands can be used through this, for example:
#
# - make clean
# - make linkcheck
# - make spelling
#
%: Makefile
	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)


# Manually added targets - related to code generation
# ----------------------------------------------------------------------------

# For local development:
# - builds the html
# - NOTE: If the pre-requisites for the html target is updated, also update the
#         Read The Docs section in docs/source/conf.py.
#
html:
	$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
	@echo
	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."


# Manually added targets - related to development
# ----------------------------------------------------------------------------

# For local development:
# - requires sphinx-autobuild, see
#   https://sphinxcontrib-spelling.readthedocs.io/en/latest/
# - builds and rebuilds html on changes to source, but does not re-generate
#   metrics/scopes files
# - starts a livereload enabled webserver and opens up a browser
devenv: html
	sphinx-autobuild -b html --open-browser "$(SOURCEDIR)" "$(BUILDDIR)/html"
