2008-03-27 23:03:52 +08:00
|
|
|
# Makefile for Sphinx documentation
|
|
|
|
#
|
|
|
|
|
|
|
|
# You can set these variables from the command line.
|
2014-12-08 07:34:03 +08:00
|
|
|
PYTHON ?= python
|
2013-07-28 18:58:19 +08:00
|
|
|
SPHINXOPTS ?=
|
|
|
|
SPHINXBUILD ?= sphinx-build
|
|
|
|
PAPER ?=
|
|
|
|
BUILDDIR ?= _build
|
|
|
|
LANGUAGE ?=
|
2008-03-27 23:03:52 +08:00
|
|
|
|
2022-06-01 18:13:15 +08:00
|
|
|
# Set the default language.
|
|
|
|
ifndef LANGUAGE
|
|
|
|
override LANGUAGE = en
|
|
|
|
endif
|
|
|
|
|
2017-05-17 18:09:12 +08:00
|
|
|
# Convert something like "en_US" to "en", because Sphinx does not recognize
|
|
|
|
# underscores. Country codes should be passed using a dash, e.g. "pt-BR".
|
|
|
|
LANGUAGEOPT = $(firstword $(subst _, ,$(LANGUAGE)))
|
|
|
|
|
2008-03-27 23:03:52 +08:00
|
|
|
# Internal variables.
|
|
|
|
PAPEROPT_a4 = -D latex_paper_size=a4
|
|
|
|
PAPEROPT_letter = -D latex_paper_size=letter
|
2017-05-17 18:09:12 +08:00
|
|
|
ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees -D language=$(LANGUAGEOPT) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
2012-04-08 06:35:57 +08:00
|
|
|
# the i18n builder cannot share the environment and doctrees with the others
|
|
|
|
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
2008-03-27 23:03:52 +08:00
|
|
|
|
2014-12-08 07:34:03 +08:00
|
|
|
.PHONY: help clean html htmlview dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
2008-03-27 23:03:52 +08:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Please use \`make <target>' where <target> is one of"
|
2010-07-24 18:21:21 +08:00
|
|
|
@echo " html to make standalone HTML files"
|
2014-12-08 07:34:03 +08:00
|
|
|
@echo " htmlview to open the index page built by the html target in your browser"
|
2010-07-24 18:21:21 +08:00
|
|
|
@echo " dirhtml to make HTML files named index.html in directories"
|
|
|
|
@echo " singlehtml to make a single large HTML file"
|
|
|
|
@echo " pickle to make pickle files"
|
|
|
|
@echo " json to make JSON files"
|
|
|
|
@echo " htmlhelp to make HTML files and a HTML help project"
|
|
|
|
@echo " qthelp to make HTML files and a qthelp project"
|
|
|
|
@echo " devhelp to make HTML files and a Devhelp project"
|
|
|
|
@echo " epub to make an epub"
|
|
|
|
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
|
|
|
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
|
|
|
@echo " text to make text files"
|
|
|
|
@echo " man to make manual pages"
|
2012-11-09 16:00:27 +08:00
|
|
|
@echo " texinfo to make a Texinfo source file"
|
2012-04-08 06:35:57 +08:00
|
|
|
@echo " gettext to make PO message catalogs"
|
2010-07-24 18:21:21 +08:00
|
|
|
@echo " changes to make an overview of all changed/added/deprecated items"
|
|
|
|
@echo " linkcheck to check all external links for integrity"
|
|
|
|
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
2014-02-23 01:46:31 +08:00
|
|
|
@echo " spelling to check for typos in documentation"
|
2023-02-28 20:14:51 +08:00
|
|
|
@echo " black to apply the black formatting to code blocks in documentation"
|
2014-02-23 01:46:31 +08:00
|
|
|
|
2008-03-27 23:03:52 +08:00
|
|
|
|
|
|
|
clean:
|
2010-05-08 15:30:53 +08:00
|
|
|
-rm -rf $(BUILDDIR)/*
|
2008-03-27 23:03:52 +08:00
|
|
|
|
|
|
|
html:
|
2010-05-08 22:31:20 +08:00
|
|
|
$(SPHINXBUILD) -b djangohtml $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
2008-03-27 23:03:52 +08:00
|
|
|
@echo
|
2010-05-08 15:30:53 +08:00
|
|
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
|
|
|
2014-12-08 07:34:03 +08:00
|
|
|
htmlview: html
|
|
|
|
$(PYTHON) -c "import webbrowser; webbrowser.open('_build/html/index.html')"
|
|
|
|
|
2010-05-08 15:30:53 +08:00
|
|
|
dirhtml:
|
|
|
|
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
|
|
|
@echo
|
|
|
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
2008-03-27 23:03:52 +08:00
|
|
|
|
2010-07-24 18:21:21 +08:00
|
|
|
singlehtml:
|
|
|
|
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
|
|
|
@echo
|
|
|
|
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
pickle:
|
2010-05-08 15:30:53 +08:00
|
|
|
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
2008-03-27 23:03:52 +08:00
|
|
|
@echo
|
2010-05-08 15:30:53 +08:00
|
|
|
@echo "Build finished; now you can process the pickle files."
|
2008-08-24 06:25:40 +08:00
|
|
|
|
2010-05-08 15:30:53 +08:00
|
|
|
json:
|
|
|
|
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
|
|
|
@echo
|
|
|
|
@echo "Build finished; now you can process the JSON files."
|
2008-03-27 23:03:52 +08:00
|
|
|
|
|
|
|
htmlhelp:
|
2010-05-08 15:30:53 +08:00
|
|
|
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
2008-03-27 23:03:52 +08:00
|
|
|
@echo
|
|
|
|
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
2010-05-08 15:30:53 +08:00
|
|
|
".hhp project file in $(BUILDDIR)/htmlhelp."
|
|
|
|
|
|
|
|
qthelp:
|
|
|
|
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
|
|
|
@echo
|
|
|
|
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
|
|
|
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
|
|
|
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django.qhcp"
|
|
|
|
@echo "To view the help file:"
|
|
|
|
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django.qhc"
|
2008-03-27 23:03:52 +08:00
|
|
|
|
2010-07-24 18:21:21 +08:00
|
|
|
devhelp:
|
|
|
|
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
|
|
|
@echo
|
|
|
|
@echo "Build finished."
|
|
|
|
@echo "To view the help file:"
|
|
|
|
@echo "# mkdir -p $$HOME/.local/share/devhelp/django"
|
|
|
|
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django"
|
|
|
|
@echo "# devhelp"
|
|
|
|
|
|
|
|
epub:
|
|
|
|
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
|
|
|
@echo
|
|
|
|
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
|
|
|
|
2008-03-27 23:03:52 +08:00
|
|
|
latex:
|
2010-05-08 15:30:53 +08:00
|
|
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
2008-03-27 23:03:52 +08:00
|
|
|
@echo
|
2010-05-08 15:30:53 +08:00
|
|
|
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
2010-07-24 18:21:21 +08:00
|
|
|
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
|
|
|
"(use \`make latexpdf' here to do that automatically)."
|
|
|
|
|
|
|
|
latexpdf:
|
|
|
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
|
|
@echo "Running LaTeX files through pdflatex..."
|
|
|
|
make -C $(BUILDDIR)/latex all-pdf
|
|
|
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
|
|
|
|
|
|
text:
|
|
|
|
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
|
|
|
@echo
|
|
|
|
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
|
|
|
|
|
|
|
man:
|
|
|
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
|
|
|
@echo
|
|
|
|
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
2008-03-27 23:03:52 +08:00
|
|
|
|
2012-11-09 16:00:27 +08:00
|
|
|
texinfo:
|
|
|
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
|
|
@echo
|
|
|
|
@echo "Build finished; the Texinfo files are in $(BUILDDIR)/texinfo."
|
|
|
|
|
2012-04-08 06:35:57 +08:00
|
|
|
gettext:
|
|
|
|
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
|
|
|
@echo
|
|
|
|
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
|
|
|
|
2008-03-27 23:03:52 +08:00
|
|
|
changes:
|
2010-05-08 15:30:53 +08:00
|
|
|
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
2008-03-27 23:03:52 +08:00
|
|
|
@echo
|
2010-05-08 15:30:53 +08:00
|
|
|
@echo "The overview file is in $(BUILDDIR)/changes."
|
2008-03-27 23:03:52 +08:00
|
|
|
|
|
|
|
linkcheck:
|
2010-05-08 15:30:53 +08:00
|
|
|
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
2008-03-27 23:03:52 +08:00
|
|
|
@echo
|
|
|
|
@echo "Link check complete; look for any errors in the above output " \
|
2010-05-08 15:30:53 +08:00
|
|
|
"or in $(BUILDDIR)/linkcheck/output.txt."
|
|
|
|
|
|
|
|
doctest:
|
|
|
|
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
|
|
|
@echo "Testing of doctests in the sources finished, look at the " \
|
|
|
|
"results in $(BUILDDIR)/doctest/output.txt."
|
2014-02-23 01:46:31 +08:00
|
|
|
|
|
|
|
spelling:
|
|
|
|
$(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling
|
|
|
|
@echo
|
|
|
|
@echo "Check finished. Wrong words can be found in " \
|
|
|
|
"$(BUILDDIR)/spelling/output.txt."
|
2023-02-28 20:14:51 +08:00
|
|
|
|
|
|
|
black:
|
|
|
|
@mkdir -p $(BUILDDIR)/black
|
|
|
|
find -name "*.txt" -not -path "./_build/*" -not -path "./_theme/*" \
|
|
|
|
| xargs blacken-docs --rst-literal-block; echo $$? > "$(BUILDDIR)/black/output.txt"
|
|
|
|
@echo
|
|
|
|
@echo "Code blocks reformatted"
|