1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements.  See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership.  The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License.  You may obtain a copy of the License at
8#
9#   http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied.  See the License for the
15# specific language governing permissions and limitations
16# under the License.
17
18# Makefile for Sphinx documentation
19#
20
21# You can set these variables from the command line.
22SPHINXOPTS    =
23SPHINXBUILD   = python3 -m sphinx
24PAPER         =
25BUILDDIR      = _build
26
27# Internal variables.
28PAPEROPT_a4     = -D latex_paper_size=a4
29PAPEROPT_letter = -D latex_paper_size=letter
30ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
31# the i18n builder cannot share the environment and doctrees with the others
32I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
33
34.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
35
36help:
37	@echo "Please use \`make <target>' where <target> is one of"
38	@echo "  html       to make standalone HTML files"
39	@echo "  dirhtml    to make HTML files named index.html in directories"
40	@echo "  singlehtml to make a single large HTML file"
41	@echo "  pickle     to make pickle files"
42	@echo "  json       to make JSON files"
43	@echo "  htmlhelp   to make HTML files and a HTML help project"
44	@echo "  qthelp     to make HTML files and a qthelp project"
45	@echo "  applehelp  to make an Apple Help Book"
46	@echo "  devhelp    to make HTML files and a Devhelp project"
47	@echo "  epub       to make an epub"
48	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
49	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
50	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
51	@echo "  text       to make text files"
52	@echo "  man        to make manual pages"
53	@echo "  texinfo    to make Texinfo files"
54	@echo "  info       to make Texinfo files and run them through makeinfo"
55	@echo "  gettext    to make PO message catalogs"
56	@echo "  changes    to make an overview of all changed/added/deprecated items"
57	@echo "  xml        to make Docutils-native XML files"
58	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
59	@echo "  linkcheck  to check all external links for integrity"
60	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
61	@echo "  coverage   to run coverage check of the documentation (if enabled)"
62
63clean:
64	rm -rf $(BUILDDIR)/*
65	rm -rf gen_modules
66	rm -rf tutorials
67	rm -rf vta/tutorials
68
69html:
70	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
71	@echo
72	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
73
74dirhtml:
75	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
76	@echo
77	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
78
79singlehtml:
80	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
81	@echo
82	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
83
84pickle:
85	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
86	@echo
87	@echo "Build finished; now you can process the pickle files."
88
89json:
90	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
91	@echo
92	@echo "Build finished; now you can process the JSON files."
93
94htmlhelp:
95	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
96	@echo
97	@echo "Build finished; now you can run HTML Help Workshop with the" \
98	      ".hhp project file in $(BUILDDIR)/htmlhelp."
99
100qthelp:
101	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
102	@echo
103	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
104	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
105	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/rabit.qhcp"
106	@echo "To view the help file:"
107	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/rabit.qhc"
108
109applehelp:
110	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
111	@echo
112	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
113	@echo "N.B. You won't be able to view it unless you put it in" \
114	      "~/Library/Documentation/Help or install it in your application" \
115	      "bundle."
116
117devhelp:
118	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
119	@echo
120	@echo "Build finished."
121	@echo "To view the help file:"
122	@echo "# mkdir -p $$HOME/.local/share/devhelp/rabit"
123	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/rabit"
124	@echo "# devhelp"
125
126epub:
127	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
128	@echo
129	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
130
131latex:
132	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
133	@echo
134	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
135	@echo "Run \`make' in that directory to run these through (pdf)latex" \
136	      "(use \`make latexpdf' here to do that automatically)."
137
138latexpdf:
139	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
140	@echo "Running LaTeX files through pdflatex..."
141	$(MAKE) -C $(BUILDDIR)/latex all-pdf
142	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
143
144latexpdfja:
145	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
146	@echo "Running LaTeX files through platex and dvipdfmx..."
147	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
148	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
149
150text:
151	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
152	@echo
153	@echo "Build finished. The text files are in $(BUILDDIR)/text."
154
155man:
156	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
157	@echo
158	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
159
160texinfo:
161	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
162	@echo
163	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
164	@echo "Run \`make' in that directory to run these through makeinfo" \
165	      "(use \`make info' here to do that automatically)."
166
167info:
168	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
169	@echo "Running Texinfo files through makeinfo..."
170	make -C $(BUILDDIR)/texinfo info
171	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
172
173gettext:
174	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
175	@echo
176	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
177
178changes:
179	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
180	@echo
181	@echo "The overview file is in $(BUILDDIR)/changes."
182
183linkcheck:
184	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
185	@echo
186	@echo "Link check complete; look for any errors in the above output " \
187	      "or in $(BUILDDIR)/linkcheck/output.txt."
188
189doctest:
190	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
191	@echo "Testing of doctests in the sources finished, look at the " \
192	      "results in $(BUILDDIR)/doctest/output.txt."
193
194coverage:
195	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
196	@echo "Testing of coverage in the sources finished, look at the " \
197	      "results in $(BUILDDIR)/coverage/python.txt."
198
199xml:
200	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
201	@echo
202	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
203
204pseudoxml:
205	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
206	@echo
207	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
208