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