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