Debian Codegraph @

docs/Makefile

raw
1 # Makefile for Sphinx documentation
2 #
3
4 # You can set these variables from the command line.
5 PYTHON ?= python
6 SPHINXOPTS ?=
7 SPHINXBUILD ?= sphinx-build
8 PAPER ?=
9 BUILDDIR ?= _build
10 LANGUAGE ?=
11 JOBS ?= auto
12
13 # Set the default language.
14 ifndef LANGUAGE
15 override LANGUAGE = en
16 endif
17
18 # Convert something like "en_US" to "en", because Sphinx does not recognize
19 # underscores. Country codes should be passed using a dash, e.g. "pt-BR".
20 LANGUAGEOPT = $(firstword $(subst _, ,$(LANGUAGE)))
21
22 # Internal variables.
23 PAPEROPT_a4 = -D latex_paper_size=a4
24 PAPEROPT_letter = -D latex_paper_size=letter
25 ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees -D language=$(LANGUAGEOPT) --jobs $(JOBS) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
26 # the i18n builder cannot share the environment and doctrees with the others
27 I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
28
29 .PHONY: help clean html htmlview dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
30
31 help:
32 @echo "Please use \`make <target>' where <target> is one of"
33 @echo " html to make standalone HTML files"
34 @echo " htmlview to open the index page built by the html target in your browser"
35 @echo " dirhtml to make HTML files named index.html in directories"
36 @echo " singlehtml to make a single large HTML file"
37 @echo " pickle to make pickle files"
38 @echo " json to make JSON files"
39 @echo " htmlhelp to make HTML files and a HTML help project"
40 @echo " qthelp to make HTML files and a qthelp project"
41 @echo " devhelp to make HTML files and a Devhelp project"
42 @echo " epub to make an epub"
43 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
44 @echo " latexpdf to make LaTeX files and run them through pdflatex"
45 @echo " text to make text files"
46 @echo " man to make manual pages"
47 @echo " texinfo to make a Texinfo source file"
48 @echo " gettext to make PO message catalogs"
49 @echo " changes to make an overview of all changed/added/deprecated items"
50 @echo " linkcheck to check all external links for integrity"
51 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
52 @echo " spelling to check for typos in documentation"
53 @echo " black to apply the black formatting to code blocks in documentation"
54
55
56 clean:
57 -rm -rf $(BUILDDIR)/*
58
59 html:
60 $(SPHINXBUILD) -b djangohtml $(ALLSPHINXOPTS) $(BUILDDIR)/html
61 @echo
62 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
63
64 htmlview: html
65 $(PYTHON) -m webbrowser "$(BUILDDIR)/html/index.html"
66
67 dirhtml:
68 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
69 @echo
70 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
71
72 singlehtml:
73 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
74 @echo
75 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
76
77 pickle:
78 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
79 @echo
80 @echo "Build finished; now you can process the pickle files."
81
82 json:
83 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
84 @echo
85 @echo "Build finished; now you can process the JSON files."
86
87 htmlhelp:
88 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
89 @echo
90 @echo "Build finished; now you can run HTML Help Workshop with the" \
91 ".hhp project file in $(BUILDDIR)/htmlhelp."
92
93 qthelp:
94 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
95 @echo
96 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
97 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
98 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django.qhcp"
99 @echo "To view the help file:"
100 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django.qhc"
101
102 devhelp:
103 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
104 @echo
105 @echo "Build finished."
106 @echo "To view the help file:"
107 @echo "# mkdir -p $$HOME/.local/share/devhelp/django"
108 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django"
109 @echo "# devhelp"
110
111 epub:
112 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113 @echo
114 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115
116 latex:
117 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
118 @echo
119 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
120 @echo "Run \`make' in that directory to run these through (pdf)latex" \
121 "(use \`make latexpdf' here to do that automatically)."
122
123 latexpdf:
124 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125 @echo "Running LaTeX files through pdflatex..."
126 make -C $(BUILDDIR)/latex all-pdf
127 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128
129 text:
130 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
131 @echo
132 @echo "Build finished. The text files are in $(BUILDDIR)/text."
133
134 man:
135 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
136 @echo
137 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
138
139 texinfo:
140 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
141 @echo
142 @echo "Build finished; the Texinfo files are in $(BUILDDIR)/texinfo."
143
144 gettext:
145 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
146 @echo
147 @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
148
149 changes:
150 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
151 @echo
152 @echo "The overview file is in $(BUILDDIR)/changes."
153
154 linkcheck:
155 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
156 @echo
157 @echo "Link check complete; look for any errors in the above output " \
158 "or in $(BUILDDIR)/linkcheck/output.txt."
159
160 doctest:
161 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
162 @echo "Testing of doctests in the sources finished, look at the " \
163 "results in $(BUILDDIR)/doctest/output.txt."
164
165 spelling:
166 $(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling
167 @echo
168 @echo "Check finished. Wrong words can be found in " \
169 "$(BUILDDIR)/spelling/output.txt."
170
171 black:
172 @mkdir -p $(BUILDDIR)/black
173 @find . -name "*.txt" -not -path "./_build/*" -not -path "./_theme/*" \
174 | xargs blacken-docs --rst-literal-block; echo $$? > "$(BUILDDIR)/black/output.txt"
175 @RESULT=`cat $(BUILDDIR)/black/output.txt`; \
176 if [ "$$RESULT" -gt 0 ]; then \
177 echo "💥 📢 Code blocks in documentation must be reformatted with blacken-docs 📢 💥"; \
178 exit $$RESULT; \
179 else \
180 echo "Code blocks in documentation are properly formatted ✅"; \
181 fi
182
183 check: spelling black
184 @echo
185 @echo "Style and spelling checks completed."