1@ECHO OFF
2
3REM Command file for Sphinx documentation
4
5if "%SPHINXBUILD%" == "" (
6	set SPHINXBUILD=sphinx-build
7)
8set BUILDDIR=build
9set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
10set I18NSPHINXOPTS=%SPHINXOPTS% source
11if NOT "%PAPER%" == "" (
12	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
13	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
14)
15
16if "%1" == "" goto help
17
18if "%1" == "help" (
19	:help
20	echo.Please use `make ^<target^>` where ^<target^> is one of
21	echo.  html       to make standalone HTML files
22	echo.  dirhtml    to make HTML files named index.html in directories
23	echo.  singlehtml to make a single large HTML file
24	echo.  pickle     to make pickle files
25	echo.  json       to make JSON files
26	echo.  htmlhelp   to make HTML files and a HTML help project
27	echo.  qthelp     to make HTML files and a qthelp project
28	echo.  devhelp    to make HTML files and a Devhelp project
29	echo.  epub       to make an epub
30	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
31	echo.  text       to make text files
32	echo.  man        to make manual pages
33	echo.  texinfo    to make Texinfo files
34	echo.  gettext    to make PO message catalogs
35	echo.  changes    to make an overview over all changed/added/deprecated items
36	echo.  xml        to make Docutils-native XML files
37	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
38	echo.  linkcheck  to check all external links for integrity
39	echo.  doctest    to run all doctests embedded in the documentation if enabled
40	echo.  coverage   to run coverage check of the documentation if enabled
41	goto end
42)
43
44if "%1" == "clean" (
45	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
46	del /q /s %BUILDDIR%\*
47	goto end
48)
49
50
51REM Check if sphinx-build is available and fallback to Python version if any
52%SPHINXBUILD% 1>NUL 2>NUL
53if errorlevel 9009 goto sphinx_python
54goto sphinx_ok
55
56:sphinx_python
57
58set SPHINXBUILD=python -m sphinx.__init__
59%SPHINXBUILD% 2> nul
60if errorlevel 9009 (
61	echo.
62	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
63	echo.installed, then set the SPHINXBUILD environment variable to point
64	echo.to the full path of the 'sphinx-build' executable. Alternatively you
65	echo.may add the Sphinx directory to PATH.
66	echo.
67	echo.If you don't have Sphinx installed, grab it from
68	echo.http://sphinx-doc.org/
69	exit /b 1
70)
71
72:sphinx_ok
73
74
75if "%1" == "html" (
76        doxygen
77	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
78	if errorlevel 1 exit /b 1
79	echo.
80	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
81	goto end
82)
83
84if "%1" == "dirhtml" (
85	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
86	if errorlevel 1 exit /b 1
87	echo.
88	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
89	goto end
90)
91
92if "%1" == "singlehtml" (
93	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
94	if errorlevel 1 exit /b 1
95	echo.
96	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
97	goto end
98)
99
100if "%1" == "pickle" (
101	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
102	if errorlevel 1 exit /b 1
103	echo.
104	echo.Build finished; now you can process the pickle files.
105	goto end
106)
107
108if "%1" == "json" (
109	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
110	if errorlevel 1 exit /b 1
111	echo.
112	echo.Build finished; now you can process the JSON files.
113	goto end
114)
115
116if "%1" == "htmlhelp" (
117	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
118	if errorlevel 1 exit /b 1
119	echo.
120	echo.Build finished; now you can run HTML Help Workshop with the ^
121.hhp project file in %BUILDDIR%/htmlhelp.
122	goto end
123)
124
125if "%1" == "qthelp" (
126	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
127	if errorlevel 1 exit /b 1
128	echo.
129	echo.Build finished; now you can run "qcollectiongenerator" with the ^
130.qhcp project file in %BUILDDIR%/qthelp, like this:
131	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\packagename.qhcp
132	echo.To view the help file:
133	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\packagename.ghc
134	goto end
135)
136
137if "%1" == "devhelp" (
138	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
139	if errorlevel 1 exit /b 1
140	echo.
141	echo.Build finished.
142	goto end
143)
144
145if "%1" == "epub" (
146	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
147	if errorlevel 1 exit /b 1
148	echo.
149	echo.Build finished. The epub file is in %BUILDDIR%/epub.
150	goto end
151)
152
153if "%1" == "latex" (
154	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
155	if errorlevel 1 exit /b 1
156	echo.
157	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
158	goto end
159)
160
161if "%1" == "latexpdf" (
162	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
163	cd %BUILDDIR%/latex
164	make all-pdf
165	cd %~dp0
166	echo.
167	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
168	goto end
169)
170
171if "%1" == "latexpdfja" (
172	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
173	cd %BUILDDIR%/latex
174	make all-pdf-ja
175	cd %~dp0
176	echo.
177	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
178	goto end
179)
180
181if "%1" == "text" (
182	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
183	if errorlevel 1 exit /b 1
184	echo.
185	echo.Build finished. The text files are in %BUILDDIR%/text.
186	goto end
187)
188
189if "%1" == "man" (
190	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
191	if errorlevel 1 exit /b 1
192	echo.
193	echo.Build finished. The manual pages are in %BUILDDIR%/man.
194	goto end
195)
196
197if "%1" == "texinfo" (
198	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
199	if errorlevel 1 exit /b 1
200	echo.
201	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
202	goto end
203)
204
205if "%1" == "gettext" (
206	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
207	if errorlevel 1 exit /b 1
208	echo.
209	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
210	goto end
211)
212
213if "%1" == "changes" (
214	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
215	if errorlevel 1 exit /b 1
216	echo.
217	echo.The overview file is in %BUILDDIR%/changes.
218	goto end
219)
220
221if "%1" == "linkcheck" (
222	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
223	if errorlevel 1 exit /b 1
224	echo.
225	echo.Link check complete; look for any errors in the above output ^
226or in %BUILDDIR%/linkcheck/output.txt.
227	goto end
228)
229
230if "%1" == "doctest" (
231	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
232	if errorlevel 1 exit /b 1
233	echo.
234	echo.Testing of doctests in the sources finished, look at the ^
235results in %BUILDDIR%/doctest/output.txt.
236	goto end
237)
238
239if "%1" == "coverage" (
240	%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
241	if errorlevel 1 exit /b 1
242	echo.
243	echo.Testing of coverage in the sources finished, look at the ^
244results in %BUILDDIR%/coverage/python.txt.
245	goto end
246)
247
248if "%1" == "xml" (
249	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
250	if errorlevel 1 exit /b 1
251	echo.
252	echo.Build finished. The XML files are in %BUILDDIR%/xml.
253	goto end
254)
255
256if "%1" == "pseudoxml" (
257	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
258	if errorlevel 1 exit /b 1
259	echo.
260	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
261	goto end
262)
263
264:end
265