Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 1 | # Makefile for Sphinx documentation |
| 2 | # |
| 3 | |
Anas Nashif | 06382b8 | 2017-01-13 22:25:09 -0500 | [diff] [blame] | 4 | CONFIG_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 Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 7 | # You can set these variables from the command line. |
Inaky Perez-Gonzalez | 55280d9 | 2016-06-13 16:31:14 -0700 | [diff] [blame] | 8 | SPHINXOPTS ?= -q |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 9 | SPHINXBUILD = sphinx-build |
| 10 | PAPER = |
Anas Nashif | 88be483 | 2016-12-23 17:41:27 -0500 | [diff] [blame] | 11 | BUILDDIR ?= _build |
Anas Nashif | 13ce2d6 | 2016-04-21 11:23:57 -0400 | [diff] [blame] | 12 | DOC_TAG ?= development |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 13 | |
| 14 | # User-friendly check for sphinx-build |
| 15 | ifeq ($(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/) |
| 17 | endif |
| 18 | |
| 19 | # Internal variables. |
| 20 | PAPEROPT_a4 = -D latex_paper_size=a4 |
| 21 | PAPEROPT_letter = -D latex_paper_size=letter |
Anas Nashif | 06382b8 | 2017-01-13 22:25:09 -0500 | [diff] [blame] | 22 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 23 | # the i18n builder cannot share the environment and doctrees with the others |
| 24 | I18NSPHINXOPTS = $(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 | |
| 28 | doxy-code: |
Anas Nashif | dc87059 | 2017-11-19 15:15:27 -0500 | [diff] [blame] | 29 | $(Q)(cat zephyr.doxyfile ; echo "STRIP_FROM_PATH=${ZEPHYR_BASE}" ) | doxygen - 2>&1 | tee doc.log |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 30 | |
| 31 | doxy: doxy-code |
| 32 | |
| 33 | help: |
| 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 | |
| 60 | clean: |
Anas Nashif | c01a5c5 | 2015-08-12 14:24:39 -0400 | [diff] [blame] | 61 | @rm -rf $(BUILDDIR)/* |
| 62 | @rm -rf html |
Benjamin Walsh | c45fc04 | 2015-08-17 15:48:05 -0400 | [diff] [blame] | 63 | @rm -rf xml |
David B. Kinder | a023027 | 2017-02-09 15:09:01 -0800 | [diff] [blame] | 64 | @rm -rf doxygen |
Benjamin Walsh | c45fc04 | 2015-08-17 15:48:05 -0400 | [diff] [blame] | 65 | @rm -rf latex |
Inaky Perez-Gonzalez | c70f361 | 2016-06-30 12:51:24 -0700 | [diff] [blame] | 66 | @rm -rf reference/kconfig/*.rst |
David B. Kinder | 65d7ffe | 2017-01-27 12:33:29 -0800 | [diff] [blame] | 67 | @rm -rf samples |
| 68 | @rm -rf boards |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 69 | |
Anas Nashif | 486a2a1 | 2015-07-30 07:06:40 -0400 | [diff] [blame] | 70 | htmldocs: doxy html |
Anas Nashif | dada389 | 2015-08-29 07:19:06 -0400 | [diff] [blame] | 71 | |
Anas Nashif | 06382b8 | 2017-01-13 22:25:09 -0500 | [diff] [blame] | 72 | content: scripts/extract_content.py |
| 73 | $(Q)$< |
| 74 | |
Anas Nashif | dada389 | 2015-08-29 07:19:06 -0400 | [diff] [blame] | 75 | kconfig: scripts/genrest/genrest.py |
Anas Nashif | 3bbd1c7 | 2018-01-12 15:01:44 -0500 | [diff] [blame] | 76 | $(Q)srctree=../ ENV_VAR_BOARD_DIR=boards/*/*/ ENV_VAR_ARCH=* KERNELVERSION=1.9.99 SRCARCH=x86 python3 $< ../Kconfig reference/kconfig/ |
Anas Nashif | dada389 | 2015-08-29 07:19:06 -0400 | [diff] [blame] | 77 | |
Anas Nashif | 03ca26f | 2017-04-02 10:25:13 -0400 | [diff] [blame] | 78 | |
| 79 | prep: doxy content kconfig |
| 80 | |
Anas Nashif | 06382b8 | 2017-01-13 22:25:09 -0500 | [diff] [blame] | 81 | html: content kconfig |
David B. Kinder | 2d4d295 | 2017-11-14 15:10:27 -0800 | [diff] [blame] | 82 | $(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 2>&1 | tee -a doc.log; |
Anas Nashif | e754d44 | 2017-11-11 10:02:00 -0500 | [diff] [blame] | 83 | $(Q)./scripts/filter-doc-log.sh doc.log |
David B. Kinder | 65d7ffe | 2017-01-27 12:33:29 -0800 | [diff] [blame] | 84 | @rm -rf samples |
| 85 | @rm -rf boards |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 86 | |
| 87 | dirhtml: |
| 88 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml |
| 89 | @echo |
| 90 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." |
| 91 | |
| 92 | singlehtml: |
| 93 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml |
| 94 | @echo |
| 95 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." |
| 96 | |
| 97 | pickle: |
| 98 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle |
| 99 | @echo |
| 100 | @echo "Build finished; now you can process the pickle files." |
| 101 | |
Anas Nashif | 03ca26f | 2017-04-02 10:25:13 -0400 | [diff] [blame] | 102 | json: prep |
| 103 | $(SPHINXBUILD) -t $(DOC_TAG) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json |
| 104 | @rm -rf samples |
| 105 | @rm -rf boards |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 106 | @echo |
| 107 | @echo "Build finished; now you can process the JSON files." |
| 108 | |
| 109 | htmlhelp: |
| 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 | |
| 115 | qthelp: |
| 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 Nashif | ee55374 | 2016-02-21 08:06:48 -0500 | [diff] [blame] | 120 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zephyr.qhcp" |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 121 | @echo "To view the help file:" |
Anas Nashif | ee55374 | 2016-02-21 08:06:48 -0500 | [diff] [blame] | 122 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zephyr.qhc" |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 123 | |
| 124 | applehelp: |
| 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 | |
| 132 | devhelp: |
| 133 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp |
| 134 | @echo |
| 135 | @echo "Build finished." |
| 136 | @echo "To view the help file:" |
Anas Nashif | ee55374 | 2016-02-21 08:06:48 -0500 | [diff] [blame] | 137 | @echo "# mkdir -p $$HOME/.local/share/devhelp/zephyr" |
| 138 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zephyr" |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 139 | @echo "# devhelp" |
| 140 | |
| 141 | epub: |
| 142 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub |
| 143 | @echo |
| 144 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." |
| 145 | |
| 146 | latex: |
| 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 | |
| 153 | latexpdf: |
| 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 | |
| 159 | latexpdfja: |
| 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 | |
| 165 | text: |
| 166 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text |
| 167 | @echo |
| 168 | @echo "Build finished. The text files are in $(BUILDDIR)/text." |
| 169 | |
| 170 | man: |
| 171 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man |
| 172 | @echo |
| 173 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." |
| 174 | |
| 175 | texinfo: |
| 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 | |
| 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 | gettext: |
| 189 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale |
| 190 | @echo |
| 191 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." |
| 192 | |
| 193 | changes: |
| 194 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes |
| 195 | @echo |
| 196 | @echo "The overview file is in $(BUILDDIR)/changes." |
| 197 | |
David B. Kinder | 2a1adfc | 2017-04-27 14:59:04 -0700 | [diff] [blame] | 198 | linkcheck: content kconfig |
| 199 | $(SPHINXBUILD) -n -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck |
Anas Nashif | 06d380c | 2015-05-13 14:05:30 -0400 | [diff] [blame] | 200 | @echo |
| 201 | @echo "Link check complete; look for any errors in the above output " \ |
| 202 | "or in $(BUILDDIR)/linkcheck/output.txt." |
| 203 | |
| 204 | doctest: |
| 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 | |
| 209 | coverage: |
| 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 | |
| 214 | xml: |
| 215 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml |
| 216 | @echo |
| 217 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." |
| 218 | |
| 219 | pseudoxml: |
| 220 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml |
| 221 | @echo |
| 222 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." |