|
1 | | -# Makefile for Sphinx documentation |
| 1 | +# Minimal makefile for Sphinx documentation |
2 | 2 | # |
3 | 3 |
|
4 | | -# You can set these variables from the command line. |
5 | | -SPHINXOPTS = |
6 | | -SPHINXBUILD = sphinx-build |
7 | | -PAPER = |
| 4 | +# You can set these variables from the command line, and also |
| 5 | +# from the environment for the first two. |
| 6 | +SPHINXOPTS ?= |
| 7 | +SPHINXBUILD ?= sphinx-build |
| 8 | +SOURCEDIR = . |
8 | 9 | BUILDDIR = _build |
9 | 10 |
|
10 | | -.PHONY: sphinx |
11 | | -sphinx: |
12 | | - # User-friendly check for sphinx-build |
13 | | - ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) |
14 | | - $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/) |
15 | | - endif |
16 | | - |
17 | | -# Internal variables. |
18 | | -PAPEROPT_a4 = -D latex_paper_size=a4 |
19 | | -PAPEROPT_letter = -D latex_paper_size=letter |
20 | | -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
21 | | -# the i18n builder cannot share the environment and doctrees with the others |
22 | | -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
23 | | - |
24 | | -.PHONY: help |
| 11 | +# Put it first so that "make" without argument is like "make help". |
25 | 12 | help: |
26 | | - @echo "Please use \`make <target>' where <target> is one of" |
27 | | - @echo " html to make standalone HTML files" |
28 | | - @echo " dirhtml to make HTML files named index.html in directories" |
29 | | - @echo " singlehtml to make a single large HTML file" |
30 | | - @echo " pickle to make pickle files" |
31 | | - @echo " json to make JSON files" |
32 | | - @echo " htmlhelp to make HTML files and a HTML help project" |
33 | | - @echo " qthelp to make HTML files and a qthelp project" |
34 | | - @echo " applehelp to make an Apple Help Book" |
35 | | - @echo " devhelp to make HTML files and a Devhelp project" |
36 | | - @echo " epub to make an epub" |
37 | | - @echo " epub3 to make an epub3" |
38 | | - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" |
39 | | - @echo " latexpdf to make LaTeX files and run them through pdflatex" |
40 | | - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" |
41 | | - @echo " text to make text files" |
42 | | - @echo " man to make manual pages" |
43 | | - @echo " texinfo to make Texinfo files" |
44 | | - @echo " info to make Texinfo files and run them through makeinfo" |
45 | | - @echo " gettext to make PO message catalogs" |
46 | | - @echo " changes to make an overview of all changed/added/deprecated items" |
47 | | - @echo " xml to make Docutils-native XML files" |
48 | | - @echo " pseudoxml to make pseudoxml-XML files for display purposes" |
49 | | - @echo " linkcheck to check all external links for integrity" |
50 | | - @echo " doctest to run all doctests embedded in the documentation (if enabled)" |
51 | | - @echo " coverage to run coverage check of the documentation (if enabled)" |
52 | | - @echo " dummy to check syntax errors of document sources" |
53 | | - |
54 | | -.PHONY: clean |
55 | | -clean: |
56 | | - rm -rf $(BUILDDIR)/* |
57 | | - |
58 | | -.PHONY: html |
59 | | -html: sphinx |
60 | | - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html |
61 | | - @echo |
62 | | - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." |
63 | | - |
64 | | -.PHONY: dirhtml |
65 | | -dirhtml: sphinx |
66 | | - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml |
67 | | - @echo |
68 | | - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." |
69 | | - |
70 | | -.PHONY: singlehtml |
71 | | -singlehtml: sphinx |
72 | | - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml |
73 | | - @echo |
74 | | - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." |
75 | | - |
76 | | -.PHONY: pickle |
77 | | -pickle: sphinx |
78 | | - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle |
79 | | - @echo |
80 | | - @echo "Build finished; now you can process the pickle files." |
81 | | - |
82 | | -.PHONY: json |
83 | | -json: sphinx |
84 | | - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json |
85 | | - @echo |
86 | | - @echo "Build finished; now you can process the JSON files." |
87 | | - |
88 | | -.PHONY: htmlhelp |
89 | | -htmlhelp: sphinx |
90 | | - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp |
91 | | - @echo |
92 | | - @echo "Build finished; now you can run HTML Help Workshop with the" \ |
93 | | - ".hhp project file in $(BUILDDIR)/htmlhelp." |
94 | | - |
95 | | -.PHONY: qthelp |
96 | | -qthelp: sphinx |
97 | | - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp |
98 | | - @echo |
99 | | - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ |
100 | | - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" |
101 | | - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zarr.qhcp" |
102 | | - @echo "To view the help file:" |
103 | | - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zarr.qhc" |
104 | | - |
105 | | -.PHONY: applehelp |
106 | | -applehelp: sphinx |
107 | | - $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp |
108 | | - @echo |
109 | | - @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." |
110 | | - @echo "N.B. You won't be able to view it unless you put it in" \ |
111 | | - "~/Library/Documentation/Help or install it in your application" \ |
112 | | - "bundle." |
113 | | - |
114 | | -.PHONY: devhelp |
115 | | -devhelp: sphinx |
116 | | - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp |
117 | | - @echo |
118 | | - @echo "Build finished." |
119 | | - @echo "To view the help file:" |
120 | | - @echo "# mkdir -p $$HOME/.local/share/devhelp/zarr" |
121 | | - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zarr" |
122 | | - @echo "# devhelp" |
123 | | - |
124 | | -.PHONY: epub |
125 | | -epub: sphinx |
126 | | - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub |
127 | | - @echo |
128 | | - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." |
129 | | - |
130 | | -.PHONY: epub3 |
131 | | -epub3: sphinx |
132 | | - $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 |
133 | | - @echo |
134 | | - @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." |
135 | | - |
136 | | -.PHONY: latex |
137 | | -latex: sphinx |
138 | | - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
139 | | - @echo |
140 | | - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." |
141 | | - @echo "Run \`make' in that directory to run these through (pdf)latex" \ |
142 | | - "(use \`make latexpdf' here to do that automatically)." |
143 | | - |
144 | | -.PHONY: latexpdf |
145 | | -latexpdf: sphinx |
146 | | - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
147 | | - @echo "Running LaTeX files through pdflatex..." |
148 | | - $(MAKE) -C $(BUILDDIR)/latex all-pdf |
149 | | - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." |
150 | | - |
151 | | -.PHONY: latexpdfja |
152 | | -latexpdfja: sphinx |
153 | | - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
154 | | - @echo "Running LaTeX files through platex and dvipdfmx..." |
155 | | - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja |
156 | | - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." |
157 | | - |
158 | | -.PHONY: text |
159 | | -text: sphinx |
160 | | - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text |
161 | | - @echo |
162 | | - @echo "Build finished. The text files are in $(BUILDDIR)/text." |
163 | | - |
164 | | -.PHONY: man |
165 | | -man: sphinx |
166 | | - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man |
167 | | - @echo |
168 | | - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." |
169 | | - |
170 | | -.PHONY: texinfo |
171 | | -texinfo: sphinx |
172 | | - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
173 | | - @echo |
174 | | - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." |
175 | | - @echo "Run \`make' in that directory to run these through makeinfo" \ |
176 | | - "(use \`make info' here to do that automatically)." |
177 | | - |
178 | | -.PHONY: info |
179 | | -info: sphinx |
180 | | - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
181 | | - @echo "Running Texinfo files through makeinfo..." |
182 | | - make -C $(BUILDDIR)/texinfo info |
183 | | - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." |
184 | | - |
185 | | -.PHONY: gettext |
186 | | -gettext: sphinx |
187 | | - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale |
188 | | - @echo |
189 | | - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." |
190 | | - |
191 | | -.PHONY: changes |
192 | | -changes: sphinx |
193 | | - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes |
194 | | - @echo |
195 | | - @echo "The overview file is in $(BUILDDIR)/changes." |
196 | | - |
197 | | -.PHONY: linkcheck |
198 | | -linkcheck: sphinx |
199 | | - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck |
200 | | - @echo |
201 | | - @echo "Link check complete; look for any errors in the above output " \ |
202 | | - "or in $(BUILDDIR)/linkcheck/output.txt." |
203 | | - |
204 | | -.PHONY: doctest |
205 | | -doctest: sphinx |
206 | | - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest |
207 | | - @echo "Testing of doctests in the sources finished, look at the " \ |
208 | | - "results in $(BUILDDIR)/doctest/output.txt." |
209 | | - |
210 | | -.PHONY: coverage |
211 | | -coverage: sphinx |
212 | | - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage |
213 | | - @echo "Testing of coverage in the sources finished, look at the " \ |
214 | | - "results in $(BUILDDIR)/coverage/python.txt." |
215 | | - |
216 | | -.PHONY: xml |
217 | | -xml: sphinx |
218 | | - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml |
219 | | - @echo |
220 | | - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." |
221 | | - |
222 | | -.PHONY: pseudoxml |
223 | | -pseudoxml: sphinx |
224 | | - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml |
225 | | - @echo |
226 | | - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." |
| 13 | + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
227 | 14 |
|
228 | | -.PHONY: dummy |
229 | | -dummy: sphinx |
230 | | - $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy |
231 | | - @echo |
232 | | - @echo "Build finished. Dummy builder generates no files." |
| 15 | +.PHONY: help Makefile |
233 | 16 |
|
| 17 | +# Catch-all target: route all unknown targets to Sphinx using the new |
| 18 | +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). |
| 19 | +%: Makefile |
| 20 | + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
0 commit comments