blob: 3b4c02b8420a1f64421f8483ecb6d5665879f10e [file] [log] [blame]
Klement Sekeraf62ae122016-10-11 11:47:09 +02001# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS =
Klement Sekera277b89c2016-10-28 13:20:27 +02006SRC_DOC_DIR = $(WS_ROOT)/test/doc
7SPHINXBUILD = sphinx-build
Klement Sekeraf62ae122016-10-11 11:47:09 +02008PAPER =
Klement Sekera277b89c2016-10-28 13:20:27 +02009BUILD_DOC_ROOT = $(BR)/test-doc
10BUILD_DOC_DIR = $(BUILD_DOC_ROOT)/build
Klement Sekeraf62ae122016-10-11 11:47:09 +020011
12# Internal variables.
13PAPEROPT_a4 = -D latex_paper_size=a4
14PAPEROPT_letter = -D latex_paper_size=letter
Klement Sekera778c2762016-11-08 02:00:28 +010015ALLSPHINXOPTS = -d $(BUILD_DOC_DIR)/.sphinx-cache $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRC_DOC_DIR)
Klement Sekeraf62ae122016-10-11 11:47:09 +020016# the i18n builder cannot share the environment and doctrees with the others
17I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
Klement Sekera277b89c2016-10-28 13:20:27 +020018IN_VENV:=$(shell if pip -V | grep "virtualenv" 2>&1 > /dev/null; then echo 1; else echo 0; fi)
19
20.PHONY: verify-virtualenv
21verify-virtualenv:
22ifeq ($(IN_VENV),0)
23 $(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
24endif
Klement Sekeraf62ae122016-10-11 11:47:09 +020025
Klement Sekeraf62ae122016-10-11 11:47:09 +020026.PHONY: help
27help:
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
Klement Sekera277b89c2016-10-28 13:20:27 +020056.PHONY: wipe
57wipe:
58 rm -rf $(BUILD_DOC_ROOT)
Klement Sekeraf62ae122016-10-11 11:47:09 +020059
60.PHONY: html
Klement Sekera778c2762016-11-08 02:00:28 +010061html: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020062 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/html
Klement Sekeraf62ae122016-10-11 11:47:09 +020063 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +020064 @echo "Build finished. The HTML pages are in $(BUILD_DOC_DIR)/html."
Klement Sekeraf62ae122016-10-11 11:47:09 +020065
66.PHONY: dirhtml
Klement Sekera778c2762016-11-08 02:00:28 +010067dirhtml: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020068 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/dirhtml
Klement Sekeraf62ae122016-10-11 11:47:09 +020069 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +020070 @echo "Build finished. The HTML pages are in $(BUILD_DOC_DIR)/dirhtml."
Klement Sekeraf62ae122016-10-11 11:47:09 +020071
72.PHONY: singlehtml
Klement Sekera778c2762016-11-08 02:00:28 +010073singlehtml: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020074 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/singlehtml
Klement Sekeraf62ae122016-10-11 11:47:09 +020075 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +020076 @echo "Build finished. The HTML page is in $(BUILD_DOC_DIR)/singlehtml."
Klement Sekeraf62ae122016-10-11 11:47:09 +020077
78.PHONY: pickle
Klement Sekera778c2762016-11-08 02:00:28 +010079pickle: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020080 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/pickle
Klement Sekeraf62ae122016-10-11 11:47:09 +020081 @echo
82 @echo "Build finished; now you can process the pickle files."
83
84.PHONY: json
Klement Sekera778c2762016-11-08 02:00:28 +010085json: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020086 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/json
Klement Sekeraf62ae122016-10-11 11:47:09 +020087 @echo
88 @echo "Build finished; now you can process the JSON files."
89
90.PHONY: htmlhelp
Klement Sekera778c2762016-11-08 02:00:28 +010091htmlhelp: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020092 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/htmlhelp
Klement Sekeraf62ae122016-10-11 11:47:09 +020093 @echo
94 @echo "Build finished; now you can run HTML Help Workshop with the" \
Klement Sekera277b89c2016-10-28 13:20:27 +020095 ".hhp project file in $(BUILD_DOC_DIR)/htmlhelp."
Klement Sekeraf62ae122016-10-11 11:47:09 +020096
97.PHONY: qthelp
Klement Sekera778c2762016-11-08 02:00:28 +010098qthelp: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020099 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/qthelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200100 @echo
101 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
Klement Sekera277b89c2016-10-28 13:20:27 +0200102 ".qhcp project file in $(BUILD_DOC_DIR)/qthelp, like this:"
103 @echo "# qcollectiongenerator $(BUILD_DOC_DIR)/qthelp/VPPtestframework.qhcp"
Klement Sekeraf62ae122016-10-11 11:47:09 +0200104 @echo "To view the help file:"
Klement Sekera277b89c2016-10-28 13:20:27 +0200105 @echo "# assistant -collectionFile $(BUILD_DOC_DIR)/qthelp/VPPtestframework.qhc"
Klement Sekeraf62ae122016-10-11 11:47:09 +0200106
107.PHONY: applehelp
Klement Sekera778c2762016-11-08 02:00:28 +0100108applehelp: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200109 $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/applehelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200110 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200111 @echo "Build finished. The help book is in $(BUILD_DOC_DIR)/applehelp."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200112 @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
Klement Sekera778c2762016-11-08 02:00:28 +0100117devhelp: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200118 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/devhelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200119 @echo
120 @echo "Build finished."
121 @echo "To view the help file:"
122 @echo "# mkdir -p $$HOME/.local/share/devhelp/VPPtestframework"
Klement Sekera277b89c2016-10-28 13:20:27 +0200123 @echo "# ln -s $(BUILD_DOC_DIR)/devhelp $$HOME/.local/share/devhelp/VPPtestframework"
Klement Sekeraf62ae122016-10-11 11:47:09 +0200124 @echo "# devhelp"
125
126.PHONY: epub
Klement Sekera778c2762016-11-08 02:00:28 +0100127epub: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200128 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/epub
Klement Sekeraf62ae122016-10-11 11:47:09 +0200129 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200130 @echo "Build finished. The epub file is in $(BUILD_DOC_DIR)/epub."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200131
132.PHONY: epub3
133epub3:
Klement Sekera277b89c2016-10-28 13:20:27 +0200134 $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/epub3
Klement Sekeraf62ae122016-10-11 11:47:09 +0200135 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200136 @echo "Build finished. The epub3 file is in $(BUILD_DOC_DIR)/epub3."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200137
138.PHONY: latex
Klement Sekera778c2762016-11-08 02:00:28 +0100139latex: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200140 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
Klement Sekeraf62ae122016-10-11 11:47:09 +0200141 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200142 @echo "Build finished; the LaTeX files are in $(BUILD_DOC_DIR)/latex."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200143 @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
Klement Sekera778c2762016-11-08 02:00:28 +0100147latexpdf: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200148 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
Klement Sekeraf62ae122016-10-11 11:47:09 +0200149 @echo "Running LaTeX files through pdflatex..."
Klement Sekera277b89c2016-10-28 13:20:27 +0200150 $(MAKE) -C $(BUILD_DOC_DIR)/latex all-pdf
151 @echo "pdflatex finished; the PDF files are in $(BUILD_DOC_DIR)/latex."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200152
153.PHONY: latexpdfja
Klement Sekera778c2762016-11-08 02:00:28 +0100154latexpdfja: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200155 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
Klement Sekeraf62ae122016-10-11 11:47:09 +0200156 @echo "Running LaTeX files through platex and dvipdfmx..."
Klement Sekera277b89c2016-10-28 13:20:27 +0200157 $(MAKE) -C $(BUILD_DOC_DIR)/latex all-pdf-ja
158 @echo "pdflatex finished; the PDF files are in $(BUILD_DOC_DIR)/latex."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200159
160.PHONY: text
Klement Sekera778c2762016-11-08 02:00:28 +0100161text: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200162 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/text
Klement Sekeraf62ae122016-10-11 11:47:09 +0200163 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200164 @echo "Build finished. The text files are in $(BUILD_DOC_DIR)/text."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200165
166.PHONY: man
Klement Sekera778c2762016-11-08 02:00:28 +0100167man: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200168 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/man
Klement Sekeraf62ae122016-10-11 11:47:09 +0200169 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200170 @echo "Build finished. The manual pages are in $(BUILD_DOC_DIR)/man."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200171
172.PHONY: texinfo
Klement Sekera778c2762016-11-08 02:00:28 +0100173texinfo: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200174 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/texinfo
Klement Sekeraf62ae122016-10-11 11:47:09 +0200175 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200176 @echo "Build finished. The Texinfo files are in $(BUILD_DOC_DIR)/texinfo."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200177 @echo "Run \`make' in that directory to run these through makeinfo" \
178 "(use \`make info' here to do that automatically)."
179
180.PHONY: info
Klement Sekera778c2762016-11-08 02:00:28 +0100181info: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200182 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/texinfo
Klement Sekeraf62ae122016-10-11 11:47:09 +0200183 @echo "Running Texinfo files through makeinfo..."
Klement Sekera277b89c2016-10-28 13:20:27 +0200184 make -C $(BUILD_DOC_DIR)/texinfo info
185 @echo "makeinfo finished; the Info files are in $(BUILD_DOC_DIR)/texinfo."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200186
187.PHONY: gettext
Klement Sekera778c2762016-11-08 02:00:28 +0100188gettext: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200189 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILD_DOC_DIR)/locale
Klement Sekeraf62ae122016-10-11 11:47:09 +0200190 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200191 @echo "Build finished. The message catalogs are in $(BUILD_DOC_DIR)/locale."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200192
193.PHONY: changes
Klement Sekera778c2762016-11-08 02:00:28 +0100194changes: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200195 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/changes
Klement Sekeraf62ae122016-10-11 11:47:09 +0200196 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200197 @echo "The overview file is in $(BUILD_DOC_DIR)/changes."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200198
199.PHONY: linkcheck
Klement Sekera778c2762016-11-08 02:00:28 +0100200linkcheck: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200201 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/linkcheck
Klement Sekeraf62ae122016-10-11 11:47:09 +0200202 @echo
203 @echo "Link check complete; look for any errors in the above output " \
Klement Sekera277b89c2016-10-28 13:20:27 +0200204 "or in $(BUILD_DOC_DIR)/linkcheck/output.txt."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200205
206.PHONY: doctest
Klement Sekera778c2762016-11-08 02:00:28 +0100207doctest: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200208 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/doctest
Klement Sekeraf62ae122016-10-11 11:47:09 +0200209 @echo "Testing of doctests in the sources finished, look at the " \
Klement Sekera277b89c2016-10-28 13:20:27 +0200210 "results in $(BUILD_DOC_DIR)/doctest/output.txt."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200211
212.PHONY: coverage
Klement Sekera778c2762016-11-08 02:00:28 +0100213coverage: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200214 $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/coverage
Klement Sekeraf62ae122016-10-11 11:47:09 +0200215 @echo "Testing of coverage in the sources finished, look at the " \
Klement Sekera277b89c2016-10-28 13:20:27 +0200216 "results in $(BUILD_DOC_DIR)/coverage/python.txt."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200217
218.PHONY: xml
Klement Sekera778c2762016-11-08 02:00:28 +0100219xml: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200220 $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/xml
Klement Sekeraf62ae122016-10-11 11:47:09 +0200221 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200222 @echo "Build finished. The XML files are in $(BUILD_DOC_DIR)/xml."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200223
224.PHONY: pseudoxml
Klement Sekera778c2762016-11-08 02:00:28 +0100225pseudoxml: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200226 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/pseudoxml
Klement Sekeraf62ae122016-10-11 11:47:09 +0200227 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200228 @echo "Build finished. The pseudo-XML files are in $(BUILD_DOC_DIR)/pseudoxml."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200229
230.PHONY: dummy
Klement Sekera778c2762016-11-08 02:00:28 +0100231dummy: verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200232 $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/dummy
Klement Sekeraf62ae122016-10-11 11:47:09 +0200233 @echo
234 @echo "Build finished. Dummy builder generates no files."