Skip to content
Snippets Groups Projects
Makefile 1.24 KiB
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS     ?=
SPHINXBUILD    ?= sphinx-build
SOURCEDIR      = .
BUILDDIR       = _build
LANGUAGE       ?= en
BUILDDIRSUFFIX =

.PHONY: help Makefile gettext update_locale clean

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

clean:
	rm -rf $(BUILDDIR)/*
	rm -f autotodo

# depends on autotodo.py but that does not work well with the catch-all below
autotodo:
	@./autotodo.py ../ .py TODO,FIXME,XXX

gettext: Makefile
	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)$(BUILDDIRSUFFIX)" $(SPHINXOPTS) $(O)

# Use to update *.po files
update_locale: Makefile gettext
	@sphinx-intl update -p "$(BUILDDIR)$(BUILDDIRSUFFIX)/gettext" -l $(LANGUAGE)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile autotodo
	@$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/$@/$(LANGUAGE)$(BUILDDIRSUFFIX)" -d "$(BUILDDIR)/doctrees/$(LANGUAGE)$(BUILDDIRSUFFIX)" $(SPHINXOPTS) -D language=$(LANGUAGE) $(O)