blob: 624e12c760800a0b561c496f8db6c40c6d86f833 [file] [log] [blame]
Anas Nashif06d380c2015-05-13 14:05:30 -04001# Makefile for Sphinx documentation
2#
3
Anas Nashif06382b82017-01-13 22:25:09 -05004CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
5 else if [ -x /bin/bash ]; then echo /bin/bash; \
6 else echo sh; fi ; fi)
Anas Nashif06d380c2015-05-13 14:05:30 -04007# You can set these variables from the command line.
Inaky Perez-Gonzalez55280d92016-06-13 16:31:14 -07008SPHINXOPTS ?= -q
Anas Nashif06d380c2015-05-13 14:05:30 -04009SPHINXBUILD = sphinx-build
10PAPER =
Anas Nashif88be4832016-12-23 17:41:27 -050011BUILDDIR ?= _build
Anas Nashif13ce2d62016-04-21 11:23:57 -040012DOC_TAG ?= development
Anas Nashif06d380c2015-05-13 14:05:30 -040013
14# User-friendly check for sphinx-build
15ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
16$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment 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/)
17endif
18
19# Internal variables.
20PAPEROPT_a4 = -D latex_paper_size=a4
21PAPEROPT_letter = -D latex_paper_size=letter
Anas Nashif06382b82017-01-13 22:25:09 -050022ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
Anas Nashif06d380c2015-05-13 14:05:30 -040023# the i18n builder cannot share the environment and doctrees with the others
24I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
25
26.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
27
28doxy-code:
Anas Nashif1fdfc5d2017-02-05 09:24:50 -050029 $(Q)doxygen zephyr.doxyfile
Anas Nashif06d380c2015-05-13 14:05:30 -040030
31doxy: doxy-code
32
33help:
34 @echo "Please use \`make <target>' where <target> is one of"
35 @echo " html to make standalone HTML files"
36 @echo " dirhtml to make HTML files named index.html in directories"
37 @echo " singlehtml to make a single large HTML file"
38 @echo " pickle to make pickle files"
39 @echo " json to make JSON files"
40 @echo " htmlhelp to make HTML files and a HTML help project"
41 @echo " qthelp to make HTML files and a qthelp project"
42 @echo " applehelp to make an Apple Help Book"
43 @echo " devhelp to make HTML files and a Devhelp project"
44 @echo " epub to make an epub"
45 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
46 @echo " latexpdf to make LaTeX files and run them through pdflatex"
47 @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
48 @echo " text to make text files"
49 @echo " man to make manual pages"
50 @echo " texinfo to make Texinfo files"
51 @echo " info to make Texinfo files and run them through makeinfo"
52 @echo " gettext to make PO message catalogs"
53 @echo " changes to make an overview of all changed/added/deprecated items"
54 @echo " xml to make Docutils-native XML files"
55 @echo " pseudoxml to make pseudoxml-XML files for display purposes"
56 @echo " linkcheck to check all external links for integrity"
57 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
58 @echo " coverage to run coverage check of the documentation (if enabled)"
59
60clean:
Anas Nashifc01a5c52015-08-12 14:24:39 -040061 @rm -rf $(BUILDDIR)/*
62 @rm -rf html
Benjamin Walshc45fc042015-08-17 15:48:05 -040063 @rm -rf xml
David B. Kindera0230272017-02-09 15:09:01 -080064 @rm -rf doxygen
Benjamin Walshc45fc042015-08-17 15:48:05 -040065 @rm -rf latex
Inaky Perez-Gonzalezc70f3612016-06-30 12:51:24 -070066 @rm -rf reference/kconfig/*.rst
David B. Kinder65d7ffe2017-01-27 12:33:29 -080067 @rm -rf samples
68 @rm -rf boards
Anas Nashif06d380c2015-05-13 14:05:30 -040069
Anas Nashif486a2a12015-07-30 07:06:40 -040070htmldocs: doxy html
Anas Nashifdada3892015-08-29 07:19:06 -040071
Anas Nashif06382b82017-01-13 22:25:09 -050072content: scripts/extract_content.py
73 $(Q)$<
74
Anas Nashifdada3892015-08-29 07:19:06 -040075kconfig: scripts/genrest/genrest.py
Anas Nashif47be9a52017-01-15 18:19:59 -050076 $(Q)srctree=../ SRCARCH=x86 python $< ../Kconfig reference/kconfig/
Anas Nashifdada3892015-08-29 07:19:06 -040077
Anas Nashif03ca26f2017-04-02 10:25:13 -040078
79prep: doxy content kconfig
80
Anas Nashif06382b82017-01-13 22:25:09 -050081html: content kconfig
Anas Nashif47be9a52017-01-15 18:19:59 -050082 $(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
David B. Kinder65d7ffe2017-01-27 12:33:29 -080083 @rm -rf samples
84 @rm -rf boards
Anas Nashif06d380c2015-05-13 14:05:30 -040085
86dirhtml:
87 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
88 @echo
89 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
90
91singlehtml:
92 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
93 @echo
94 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
95
96pickle:
97 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
98 @echo
99 @echo "Build finished; now you can process the pickle files."
100
Anas Nashif03ca26f2017-04-02 10:25:13 -0400101json: prep
102 $(SPHINXBUILD) -t $(DOC_TAG) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
103 @rm -rf samples
104 @rm -rf boards
Anas Nashif06d380c2015-05-13 14:05:30 -0400105 @echo
106 @echo "Build finished; now you can process the JSON files."
107
108htmlhelp:
109 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
110 @echo
111 @echo "Build finished; now you can run HTML Help Workshop with the" \
112 ".hhp project file in $(BUILDDIR)/htmlhelp."
113
114qthelp:
115 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
116 @echo
117 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
118 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
Anas Nashifee553742016-02-21 08:06:48 -0500119 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zephyr.qhcp"
Anas Nashif06d380c2015-05-13 14:05:30 -0400120 @echo "To view the help file:"
Anas Nashifee553742016-02-21 08:06:48 -0500121 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zephyr.qhc"
Anas Nashif06d380c2015-05-13 14:05:30 -0400122
123applehelp:
124 $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
125 @echo
126 @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
127 @echo "N.B. You won't be able to view it unless you put it in" \
128 "~/Library/Documentation/Help or install it in your application" \
129 "bundle."
130
131devhelp:
132 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
133 @echo
134 @echo "Build finished."
135 @echo "To view the help file:"
Anas Nashifee553742016-02-21 08:06:48 -0500136 @echo "# mkdir -p $$HOME/.local/share/devhelp/zephyr"
137 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zephyr"
Anas Nashif06d380c2015-05-13 14:05:30 -0400138 @echo "# devhelp"
139
140epub:
141 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
142 @echo
143 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
144
145latex:
146 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
147 @echo
148 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
149 @echo "Run \`make' in that directory to run these through (pdf)latex" \
150 "(use \`make latexpdf' here to do that automatically)."
151
152latexpdf:
153 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
154 @echo "Running LaTeX files through pdflatex..."
155 $(MAKE) -C $(BUILDDIR)/latex all-pdf
156 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
157
158latexpdfja:
159 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
160 @echo "Running LaTeX files through platex and dvipdfmx..."
161 $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
162 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
163
164text:
165 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
166 @echo
167 @echo "Build finished. The text files are in $(BUILDDIR)/text."
168
169man:
170 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
171 @echo
172 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
173
174texinfo:
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
181info:
182 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
183 @echo "Running Texinfo files through makeinfo..."
184 make -C $(BUILDDIR)/texinfo info
185 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
186
187gettext:
188 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
189 @echo
190 @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
191
192changes:
193 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
194 @echo
195 @echo "The overview file is in $(BUILDDIR)/changes."
196
David B. Kinder2a1adfc2017-04-27 14:59:04 -0700197linkcheck: content kconfig
198 $(SPHINXBUILD) -n -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
Anas Nashif06d380c2015-05-13 14:05:30 -0400199 @echo
200 @echo "Link check complete; look for any errors in the above output " \
201 "or in $(BUILDDIR)/linkcheck/output.txt."
202
203doctest:
204 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
205 @echo "Testing of doctests in the sources finished, look at the " \
206 "results in $(BUILDDIR)/doctest/output.txt."
207
208coverage:
209 $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
210 @echo "Testing of coverage in the sources finished, look at the " \
211 "results in $(BUILDDIR)/coverage/python.txt."
212
213xml:
214 $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
215 @echo
216 @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
217
218pseudoxml:
219 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
220 @echo
221 @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."