1 # Makefile for Sphinx documentation
4 # You can set these variables from the command line.
6 SRC_DOC_DIR = $(WS_ROOT)/test/doc
7 SPHINXBUILD = sphinx-build
9 BUILD_DOC_ROOT = $(BR)/test-doc
10 BUILD_DOC_DIR = $(BUILD_DOC_ROOT)/build
11 API_DOC_GEN_DIR = $(BUILD_DOC_ROOT)/apidoc
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 INDEX_REL_PATH:=$(shell realpath --relative-to=$(API_DOC_GEN_DIR) $(SRC_DOC_DIR)/index.rst)
20 IN_VENV:=$(shell if pip -V | grep "virtualenv" 2>&1 > /dev/null; then echo 1; else echo 0; fi)
22 .PHONY: verify-virtualenv
25 $(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
29 regen-api-doc: verify-virtualenv
30 @mkdir -p $(API_DOC_GEN_DIR)
31 #@echo ".. include:: $(INDEX_REL_PATH)" > $(API_DOC_GEN_DIR)/index.rst
32 @cp $(SRC_DOC_DIR)/index.rst $(API_DOC_GEN_DIR)
33 sphinx-apidoc -o $(API_DOC_GEN_DIR) ..
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"
67 rm -rf $(BUILD_DOC_ROOT)
70 html: regen-api-doc verify-virtualenv
71 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/html
73 @echo "Build finished. The HTML pages are in $(BUILD_DOC_DIR)/html."
76 dirhtml: regen-api-doc verify-virtualenv
77 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/dirhtml
79 @echo "Build finished. The HTML pages are in $(BUILD_DOC_DIR)/dirhtml."
82 singlehtml: regen-api-doc verify-virtualenv
83 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/singlehtml
85 @echo "Build finished. The HTML page is in $(BUILD_DOC_DIR)/singlehtml."
88 pickle: regen-api-doc verify-virtualenv
89 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/pickle
91 @echo "Build finished; now you can process the pickle files."
94 json: regen-api-doc verify-virtualenv
95 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/json
97 @echo "Build finished; now you can process the JSON files."
100 htmlhelp: regen-api-doc verify-virtualenv
101 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/htmlhelp
103 @echo "Build finished; now you can run HTML Help Workshop with the" \
104 ".hhp project file in $(BUILD_DOC_DIR)/htmlhelp."
107 qthelp: regen-api-doc verify-virtualenv
108 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/qthelp
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"
117 applehelp: regen-api-doc verify-virtualenv
118 $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/applehelp
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" \
126 devhelp: regen-api-doc verify-virtualenv
127 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/devhelp
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"
136 epub: regen-api-doc verify-virtualenv
137 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/epub
139 @echo "Build finished. The epub file is in $(BUILD_DOC_DIR)/epub."
143 $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/epub3
145 @echo "Build finished. The epub3 file is in $(BUILD_DOC_DIR)/epub3."
148 latex: regen-api-doc verify-virtualenv
149 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/latex
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)."
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."
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."
170 text: regen-api-doc verify-virtualenv
171 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/text
173 @echo "Build finished. The text files are in $(BUILD_DOC_DIR)/text."
176 man: regen-api-doc verify-virtualenv
177 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/man
179 @echo "Build finished. The manual pages are in $(BUILD_DOC_DIR)/man."
182 texinfo: regen-api-doc verify-virtualenv
183 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/texinfo
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)."
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."
197 gettext: regen-api-doc verify-virtualenv
198 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILD_DOC_DIR)/locale
200 @echo "Build finished. The message catalogs are in $(BUILD_DOC_DIR)/locale."
203 changes: regen-api-doc verify-virtualenv
204 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/changes
206 @echo "The overview file is in $(BUILD_DOC_DIR)/changes."
209 linkcheck: regen-api-doc verify-virtualenv
210 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/linkcheck
212 @echo "Link check complete; look for any errors in the above output " \
213 "or in $(BUILD_DOC_DIR)/linkcheck/output.txt."
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."
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."
228 xml: regen-api-doc verify-virtualenv
229 $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/xml
231 @echo "Build finished. The XML files are in $(BUILD_DOC_DIR)/xml."
234 pseudoxml: regen-api-doc verify-virtualenv
235 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/pseudoxml
237 @echo "Build finished. The pseudo-XML files are in $(BUILD_DOC_DIR)/pseudoxml."
240 dummy: regen-api-doc verify-virtualenv
241 $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILD_DOC_DIR)/dummy
243 @echo "Build finished. Dummy builder generates no files."