blob: ff96b5fd80e16a44853936b14cfad0d3beeecdab [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
Matej Klotton86d87c42016-11-11 11:38:55 +010011API_DOC_GEN_DIR = $(BUILD_DOC_ROOT)/apidoc
Klement Sekeraf62ae122016-10-11 11:47:09 +020012
13# Internal variables.
14PAPEROPT_a4 = -D latex_paper_size=a4
15PAPEROPT_letter = -D latex_paper_size=letter
Matej Klotton86d87c42016-11-11 11:38:55 +010016ALLSPHINXOPTS = -d $(BUILD_DOC_DIR)/.sphinx-cache $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(API_DOC_GEN_DIR) -c $(SRC_DOC_DIR)
Klement Sekeraf62ae122016-10-11 11:47:09 +020017# the i18n builder cannot share the environment and doctrees with the others
18I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
Klement Sekera277b89c2016-10-28 13:20:27 +020019IN_VENV:=$(shell if pip -V | grep "virtualenv" 2>&1 > /dev/null; then echo 1; else echo 0; fi)
20
21.PHONY: verify-virtualenv
22verify-virtualenv:
23ifeq ($(IN_VENV),0)
24 $(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
25endif
Klement Sekeraf62ae122016-10-11 11:47:09 +020026
Matej Klotton86d87c42016-11-11 11:38:55 +010027.PHONY: regen-api-doc
28regen-api-doc: verify-virtualenv
29 @mkdir -p $(API_DOC_GEN_DIR)
Matej Klotton86d87c42016-11-11 11:38:55 +010030 @cp $(SRC_DOC_DIR)/index.rst $(API_DOC_GEN_DIR)
Klement Sekerae7c034b2017-01-26 14:54:47 +010031 @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" ..
Matej Klotton86d87c42016-11-11 11:38:55 +010034
Klement Sekeraf62ae122016-10-11 11:47:09 +020035.PHONY: help
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 " 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
Klement Sekera277b89c2016-10-28 13:20:27 +020065.PHONY: wipe
66wipe:
67 rm -rf $(BUILD_DOC_ROOT)
Klement Sekeraf62ae122016-10-11 11:47:09 +020068
69.PHONY: html
Matej Klotton86d87c42016-11-11 11:38:55 +010070html: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020071 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/html
Klement Sekeraf62ae122016-10-11 11:47:09 +020072 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +020073 @echo "Build finished. The HTML pages are in $(BUILD_DOC_DIR)/html."
Klement Sekeraf62ae122016-10-11 11:47:09 +020074
75.PHONY: dirhtml
Matej Klotton86d87c42016-11-11 11:38:55 +010076dirhtml: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020077 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/dirhtml
Klement Sekeraf62ae122016-10-11 11:47:09 +020078 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +020079 @echo "Build finished. The HTML pages are in $(BUILD_DOC_DIR)/dirhtml."
Klement Sekeraf62ae122016-10-11 11:47:09 +020080
81.PHONY: singlehtml
Matej Klotton86d87c42016-11-11 11:38:55 +010082singlehtml: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020083 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/singlehtml
Klement Sekeraf62ae122016-10-11 11:47:09 +020084 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +020085 @echo "Build finished. The HTML page is in $(BUILD_DOC_DIR)/singlehtml."
Klement Sekeraf62ae122016-10-11 11:47:09 +020086
87.PHONY: pickle
Matej Klotton86d87c42016-11-11 11:38:55 +010088pickle: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020089 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/pickle
Klement Sekeraf62ae122016-10-11 11:47:09 +020090 @echo
91 @echo "Build finished; now you can process the pickle files."
92
93.PHONY: json
Matej Klotton86d87c42016-11-11 11:38:55 +010094json: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +020095 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/json
Klement Sekeraf62ae122016-10-11 11:47:09 +020096 @echo
97 @echo "Build finished; now you can process the JSON files."
98
99.PHONY: htmlhelp
Matej Klotton86d87c42016-11-11 11:38:55 +0100100htmlhelp: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200101 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/htmlhelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200102 @echo
103 @echo "Build finished; now you can run HTML Help Workshop with the" \
Klement Sekera277b89c2016-10-28 13:20:27 +0200104 ".hhp project file in $(BUILD_DOC_DIR)/htmlhelp."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200105
106.PHONY: qthelp
Matej Klotton86d87c42016-11-11 11:38:55 +0100107qthelp: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200108 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/qthelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200109 @echo
110 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
Klement Sekera277b89c2016-10-28 13:20:27 +0200111 ".qhcp project file in $(BUILD_DOC_DIR)/qthelp, like this:"
112 @echo "# qcollectiongenerator $(BUILD_DOC_DIR)/qthelp/VPPtestframework.qhcp"
Klement Sekeraf62ae122016-10-11 11:47:09 +0200113 @echo "To view the help file:"
Klement Sekera277b89c2016-10-28 13:20:27 +0200114 @echo "# assistant -collectionFile $(BUILD_DOC_DIR)/qthelp/VPPtestframework.qhc"
Klement Sekeraf62ae122016-10-11 11:47:09 +0200115
116.PHONY: applehelp
Matej Klotton86d87c42016-11-11 11:38:55 +0100117applehelp: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200118 $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/applehelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200119 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200120 @echo "Build finished. The help book is in $(BUILD_DOC_DIR)/applehelp."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200121 @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
Matej Klotton86d87c42016-11-11 11:38:55 +0100126devhelp: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200127 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/devhelp
Klement Sekeraf62ae122016-10-11 11:47:09 +0200128 @echo
129 @echo "Build finished."
130 @echo "To view the help file:"
131 @echo "# mkdir -p $$HOME/.local/share/devhelp/VPPtestframework"
Klement Sekera277b89c2016-10-28 13:20:27 +0200132 @echo "# ln -s $(BUILD_DOC_DIR)/devhelp $$HOME/.local/share/devhelp/VPPtestframework"
Klement Sekeraf62ae122016-10-11 11:47:09 +0200133 @echo "# devhelp"
134
135.PHONY: epub
Matej Klotton86d87c42016-11-11 11:38:55 +0100136epub: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200137 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/epub
Klement Sekeraf62ae122016-10-11 11:47:09 +0200138 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200139 @echo "Build finished. The epub file is in $(BUILD_DOC_DIR)/epub."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200140
141.PHONY: epub3
142epub3:
Klement Sekera277b89c2016-10-28 13:20:27 +0200143 $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/epub3
Klement Sekeraf62ae122016-10-11 11:47:09 +0200144 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200145 @echo "Build finished. The epub3 file is in $(BUILD_DOC_DIR)/epub3."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200146
147.PHONY: latex
Matej Klotton86d87c42016-11-11 11:38:55 +0100148latex: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200149 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
Klement Sekeraf62ae122016-10-11 11:47:09 +0200150 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200151 @echo "Build finished; the LaTeX files are in $(BUILD_DOC_DIR)/latex."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200152 @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
Matej Klotton86d87c42016-11-11 11:38:55 +0100156latexpdf: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200157 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
Klement Sekeraf62ae122016-10-11 11:47:09 +0200158 @echo "Running LaTeX files through pdflatex..."
Klement Sekera277b89c2016-10-28 13:20:27 +0200159 $(MAKE) -C $(BUILD_DOC_DIR)/latex all-pdf
160 @echo "pdflatex finished; the PDF files are in $(BUILD_DOC_DIR)/latex."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200161
162.PHONY: latexpdfja
Matej Klotton86d87c42016-11-11 11:38:55 +0100163latexpdfja: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200164 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
Klement Sekeraf62ae122016-10-11 11:47:09 +0200165 @echo "Running LaTeX files through platex and dvipdfmx..."
Klement Sekera277b89c2016-10-28 13:20:27 +0200166 $(MAKE) -C $(BUILD_DOC_DIR)/latex all-pdf-ja
167 @echo "pdflatex finished; the PDF files are in $(BUILD_DOC_DIR)/latex."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200168
169.PHONY: text
Matej Klotton86d87c42016-11-11 11:38:55 +0100170text: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200171 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/text
Klement Sekeraf62ae122016-10-11 11:47:09 +0200172 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200173 @echo "Build finished. The text files are in $(BUILD_DOC_DIR)/text."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200174
175.PHONY: man
Matej Klotton86d87c42016-11-11 11:38:55 +0100176man: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200177 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/man
Klement Sekeraf62ae122016-10-11 11:47:09 +0200178 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200179 @echo "Build finished. The manual pages are in $(BUILD_DOC_DIR)/man."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200180
181.PHONY: texinfo
Matej Klotton86d87c42016-11-11 11:38:55 +0100182texinfo: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200183 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/texinfo
Klement Sekeraf62ae122016-10-11 11:47:09 +0200184 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200185 @echo "Build finished. The Texinfo files are in $(BUILD_DOC_DIR)/texinfo."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200186 @echo "Run \`make' in that directory to run these through makeinfo" \
187 "(use \`make info' here to do that automatically)."
188
189.PHONY: info
Matej Klotton86d87c42016-11-11 11:38:55 +0100190info: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200191 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/texinfo
Klement Sekeraf62ae122016-10-11 11:47:09 +0200192 @echo "Running Texinfo files through makeinfo..."
Klement Sekera277b89c2016-10-28 13:20:27 +0200193 make -C $(BUILD_DOC_DIR)/texinfo info
194 @echo "makeinfo finished; the Info files are in $(BUILD_DOC_DIR)/texinfo."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200195
196.PHONY: gettext
Matej Klotton86d87c42016-11-11 11:38:55 +0100197gettext: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200198 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILD_DOC_DIR)/locale
Klement Sekeraf62ae122016-10-11 11:47:09 +0200199 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200200 @echo "Build finished. The message catalogs are in $(BUILD_DOC_DIR)/locale."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200201
202.PHONY: changes
Matej Klotton86d87c42016-11-11 11:38:55 +0100203changes: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200204 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/changes
Klement Sekeraf62ae122016-10-11 11:47:09 +0200205 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200206 @echo "The overview file is in $(BUILD_DOC_DIR)/changes."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200207
208.PHONY: linkcheck
Matej Klotton86d87c42016-11-11 11:38:55 +0100209linkcheck: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200210 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/linkcheck
Klement Sekeraf62ae122016-10-11 11:47:09 +0200211 @echo
212 @echo "Link check complete; look for any errors in the above output " \
Klement Sekera277b89c2016-10-28 13:20:27 +0200213 "or in $(BUILD_DOC_DIR)/linkcheck/output.txt."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200214
215.PHONY: doctest
Matej Klotton86d87c42016-11-11 11:38:55 +0100216doctest: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200217 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/doctest
Klement Sekeraf62ae122016-10-11 11:47:09 +0200218 @echo "Testing of doctests in the sources finished, look at the " \
Klement Sekera277b89c2016-10-28 13:20:27 +0200219 "results in $(BUILD_DOC_DIR)/doctest/output.txt."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200220
221.PHONY: coverage
Matej Klotton86d87c42016-11-11 11:38:55 +0100222coverage: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200223 $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/coverage
Klement Sekeraf62ae122016-10-11 11:47:09 +0200224 @echo "Testing of coverage in the sources finished, look at the " \
Klement Sekera277b89c2016-10-28 13:20:27 +0200225 "results in $(BUILD_DOC_DIR)/coverage/python.txt."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200226
227.PHONY: xml
Matej Klotton86d87c42016-11-11 11:38:55 +0100228xml: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200229 $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/xml
Klement Sekeraf62ae122016-10-11 11:47:09 +0200230 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200231 @echo "Build finished. The XML files are in $(BUILD_DOC_DIR)/xml."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200232
233.PHONY: pseudoxml
Matej Klotton86d87c42016-11-11 11:38:55 +0100234pseudoxml: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200235 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/pseudoxml
Klement Sekeraf62ae122016-10-11 11:47:09 +0200236 @echo
Klement Sekera277b89c2016-10-28 13:20:27 +0200237 @echo "Build finished. The pseudo-XML files are in $(BUILD_DOC_DIR)/pseudoxml."
Klement Sekeraf62ae122016-10-11 11:47:09 +0200238
239.PHONY: dummy
Matej Klotton86d87c42016-11-11 11:38:55 +0100240dummy: regen-api-doc verify-virtualenv
Klement Sekera277b89c2016-10-28 13:20:27 +0200241 $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/dummy
Klement Sekeraf62ae122016-10-11 11:47:09 +0200242 @echo
243 @echo "Build finished. Dummy builder generates no files."