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