]> git.proxmox.com Git - mirror_frr.git/blob - doc/frr-sphinx.mk
zebra/lib: code cleaning
[mirror_frr.git] / doc / frr-sphinx.mk
1 # Makefile for Sphinx documentation
2 #
3
4 # Sphinx is not designed to be invoked multiple times against the same toctree.
5 .NOTPARALLEL:
6
7 # You can set these variables from the command line.
8 SPHINXOPTS ?=
9 SPHINXBUILD ?= sphinx-build
10 PAPER ?=
11 BUILDDIR = _build
12
13 # This is a custom FRR variable just for this docs subdirectory used to support
14 # VPATH builds. Makefiles which include this file should override it to point
15 # to the correct sources path.
16 SOURCESDIR ?= .
17
18 # User-friendly check for sphinx-build
19 ifneq ($(MAKECMDGOALS), clean)
20 ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
21 SPHINXBUILD = sphinx-1.0-build
22 endif
23 ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
24 $(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/")
25 endif
26 endif
27
28 # Internal variables.
29 PAPEROPT_a4 = -D latex_paper_size=a4
30 PAPEROPT_letter = -D latex_paper_size=letter
31 ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCESDIR)
32 # the i18n builder cannot share the environment and doctrees with the others
33 I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCESDIR)
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 " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
49 @echo " latexpdf to make LaTeX files and run them through pdflatex"
50 @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
51 @echo " text to make text files"
52 @echo " man to make manual pages"
53 @echo " texinfo to make Texinfo files"
54 @echo " info to make Texinfo files and run them through makeinfo"
55 @echo " gettext to make PO message catalogs"
56 @echo " changes to make an overview of all changed/added/deprecated items"
57 @echo " xml to make Docutils-native XML files"
58 @echo " pseudoxml to make pseudoxml-XML files for display purposes"
59 @echo " linkcheck to check all external links for integrity"
60 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
61 @echo " coverage to run coverage check of the documentation (if enabled)"
62
63 .PHONY: clean
64 clean:
65 rm -rf $(BUILDDIR)/*
66
67 .PHONY: html
68 html:
69 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
70 @echo
71 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
72
73 .PHONY: dirhtml
74 dirhtml:
75 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
76 @echo
77 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
78
79 .PHONY: singlehtml
80 singlehtml:
81 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
82 @echo
83 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
84
85 .PHONY: pickle
86 pickle:
87 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
88 @echo
89 @echo "Build finished; now you can process the pickle files."
90
91 .PHONY: json
92 json:
93 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
94 @echo
95 @echo "Build finished; now you can process the JSON files."
96
97 .PHONY: htmlhelp
98 htmlhelp:
99 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
100 @echo
101 @echo "Build finished; now you can run HTML Help Workshop with the" \
102 ".hhp project file in $(BUILDDIR)/htmlhelp."
103
104 .PHONY: qthelp
105 qthelp:
106 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
107 @echo
108 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
109 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
110 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/FRR.qhcp"
111 @echo "To view the help file:"
112 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/FRR.qhc"
113
114 .PHONY: applehelp
115 applehelp:
116 $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
117 @echo
118 @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
119 @echo "N.B. You won't be able to view it unless you put it in" \
120 "~/Library/Documentation/Help or install it in your application" \
121 "bundle."
122
123 .PHONY: devhelp
124 devhelp:
125 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
126 @echo
127 @echo "Build finished."
128 @echo "To view the help file:"
129 @echo "# mkdir -p $$HOME/.local/share/devhelp/FRR"
130 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/FRR"
131 @echo "# devhelp"
132
133 .PHONY: epub
134 epub:
135 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
136 @echo
137 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
138
139 .PHONY: latex
140 latex:
141 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
142 @echo
143 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
144 @echo "Run \`make' in that directory to run these through (pdf)latex" \
145 "(use \`make latexpdf' here to do that automatically)."
146
147 .PHONY: latexpdf
148 latexpdf:
149 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
150 @echo "Running LaTeX files through pdflatex..."
151 $(MAKE) -C $(BUILDDIR)/latex all-pdf
152 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
153
154 .PHONY: latexpdfja
155 latexpdfja:
156 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
157 @echo "Running LaTeX files through platex and dvipdfmx..."
158 $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
159 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
160
161 .PHONY: text
162 text:
163 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
164 @echo
165 @echo "Build finished. The text files are in $(BUILDDIR)/text."
166
167 .PHONY: man
168 man:
169 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
170 @echo
171 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
172
173 .PHONY: texinfo
174 texinfo:
175 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
176 @echo
177 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
178 @echo "Run \`make' in that directory to run these through makeinfo" \
179 "(use \`make info' here to do that automatically)."
180
181 .PHONY: info
182 info:
183 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
184 @echo "Running Texinfo files through makeinfo..."
185 $(MAKE) -C $(BUILDDIR)/texinfo info
186 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
187
188 .PHONY: gettext
189 gettext:
190 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
191 @echo
192 @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
193
194 .PHONY: changes
195 changes:
196 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
197 @echo
198 @echo "The overview file is in $(BUILDDIR)/changes."
199
200 .PHONY: linkcheck
201 linkcheck:
202 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
203 @echo
204 @echo "Link check complete; look for any errors in the above output " \
205 "or in $(BUILDDIR)/linkcheck/output.txt."
206
207 .PHONY: doctest
208 doctest:
209 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
210 @echo "Testing of doctests in the sources finished, look at the " \
211 "results in $(BUILDDIR)/doctest/output.txt."
212
213 .PHONY: coverage
214 coverage:
215 $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
216 @echo "Testing of coverage in the sources finished, look at the " \
217 "results in $(BUILDDIR)/coverage/python.txt."
218
219 .PHONY: xml
220 xml:
221 $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
222 @echo
223 @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
224
225 .PHONY: pseudoxml
226 pseudoxml:
227 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
228 @echo
229 @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."