blob: 52148a81ce904fa98becc90695d0057e4e9aa874 [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 Nashifdc870592017-11-19 15:15:27 -050029 $(Q)(cat zephyr.doxyfile ; echo "STRIP_FROM_PATH=${ZEPHYR_BASE}" ) | doxygen - 2>&1 | tee doc.log
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 Nashif3bbd1c72018-01-12 15:01:44 -050076 $(Q)srctree=../ ENV_VAR_BOARD_DIR=boards/*/*/ ENV_VAR_ARCH=* KERNELVERSION=1.9.99 SRCARCH=x86 python3 $< ../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
David B. Kinder2d4d2952017-11-14 15:10:27 -080082 $(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 2>&1 | tee -a doc.log;
Anas Nashife754d442017-11-11 10:02:00 -050083 $(Q)./scripts/filter-doc-log.sh doc.log
David B. Kinder65d7ffe2017-01-27 12:33:29 -080084 @rm -rf samples
85 @rm -rf boards
Anas Nashif06d380c2015-05-13 14:05:30 -040086
87dirhtml:
88 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
89 @echo
90 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
91
92singlehtml:
93 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
94 @echo
95 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
96
97pickle:
98 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
99 @echo
100 @echo "Build finished; now you can process the pickle files."
101
Anas Nashif03ca26f2017-04-02 10:25:13 -0400102json: prep
103 $(SPHINXBUILD) -t $(DOC_TAG) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
104 @rm -rf samples
105 @rm -rf boards
Anas Nashif06d380c2015-05-13 14:05:30 -0400106 @echo
107 @echo "Build finished; now you can process the JSON files."
108
109htmlhelp:
110 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
111 @echo
112 @echo "Build finished; now you can run HTML Help Workshop with the" \
113 ".hhp project file in $(BUILDDIR)/htmlhelp."
114
115qthelp:
116 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
117 @echo
118 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
119 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
Anas Nashifee553742016-02-21 08:06:48 -0500120 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zephyr.qhcp"
Anas Nashif06d380c2015-05-13 14:05:30 -0400121 @echo "To view the help file:"
Anas Nashifee553742016-02-21 08:06:48 -0500122 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zephyr.qhc"
Anas Nashif06d380c2015-05-13 14:05:30 -0400123
124applehelp:
125 $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
126 @echo
127 @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
128 @echo "N.B. You won't be able to view it unless you put it in" \
129 "~/Library/Documentation/Help or install it in your application" \
130 "bundle."
131
132devhelp:
133 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
134 @echo
135 @echo "Build finished."
136 @echo "To view the help file:"
Anas Nashifee553742016-02-21 08:06:48 -0500137 @echo "# mkdir -p $$HOME/.local/share/devhelp/zephyr"
138 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zephyr"
Anas Nashif06d380c2015-05-13 14:05:30 -0400139 @echo "# devhelp"
140
141epub:
142 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
143 @echo
144 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
145
146latex:
147 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
148 @echo
149 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
150 @echo "Run \`make' in that directory to run these through (pdf)latex" \
151 "(use \`make latexpdf' here to do that automatically)."
152
153latexpdf:
154 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
155 @echo "Running LaTeX files through pdflatex..."
156 $(MAKE) -C $(BUILDDIR)/latex all-pdf
157 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
158
159latexpdfja:
160 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
161 @echo "Running LaTeX files through platex and dvipdfmx..."
162 $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
163 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
164
165text:
166 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
167 @echo
168 @echo "Build finished. The text files are in $(BUILDDIR)/text."
169
170man:
171 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
172 @echo
173 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
174
175texinfo:
176 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
177 @echo
178 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
179 @echo "Run \`make' in that directory to run these through makeinfo" \
180 "(use \`make info' here to do that automatically)."
181
182info:
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
188gettext:
189 $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
190 @echo
191 @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
192
193changes:
194 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
195 @echo
196 @echo "The overview file is in $(BUILDDIR)/changes."
197
David B. Kinder2a1adfc2017-04-27 14:59:04 -0700198linkcheck: content kconfig
199 $(SPHINXBUILD) -n -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
Anas Nashif06d380c2015-05-13 14:05:30 -0400200 @echo
201 @echo "Link check complete; look for any errors in the above output " \
202 "or in $(BUILDDIR)/linkcheck/output.txt."
203
204doctest:
205 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
206 @echo "Testing of doctests in the sources finished, look at the " \
207 "results in $(BUILDDIR)/doctest/output.txt."
208
209coverage:
210 $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
211 @echo "Testing of coverage in the sources finished, look at the " \
212 "results in $(BUILDDIR)/coverage/python.txt."
213
214xml:
215 $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
216 @echo
217 @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
218
219pseudoxml:
220 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
221 @echo
222 @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."