Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | # |
| 2 | # Makefile for Python documentation |
| 3 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4 | # |
| 5 | |
| 6 | # You can set these variables from the command line. |
Georg Brandl | 7094a0c | 2007-08-15 18:02:37 +0000 | [diff] [blame] | 7 | PYTHON = python |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 8 | SPHINXBUILD = sphinx-build |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 9 | PAPER = |
Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 10 | SOURCES = |
Benjamin Peterson | 402bd79 | 2014-12-10 11:04:17 -0500 | [diff] [blame] | 11 | DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 12 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 13 | ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ |
Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 14 | $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 15 | |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 16 | .PHONY: help build html htmlhelp latex text changes linkcheck \ |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 17 | suspicious coverage doctest pydoc-topics htmlview clean dist check serve \ |
| 18 | autobuild-dev autobuild-stable |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 19 | |
| 20 | help: |
| 21 | @echo "Please use \`make <target>' where <target> is one of" |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 22 | @echo " clean to remove build files" |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 23 | @echo " html to make standalone HTML files" |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 24 | @echo " htmlview to open the index page built by the html target in your browser" |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 25 | @echo " htmlhelp to make HTML files and a HTML help project" |
| 26 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" |
| 27 | @echo " text to make plain text files" |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 28 | @echo " epub to make EPUB files" |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 29 | @echo " changes to make an overview over all changed/added/deprecated items" |
| 30 | @echo " linkcheck to check all external links for integrity" |
| 31 | @echo " coverage to check documentation coverage for library and C API" |
| 32 | @echo " doctest to run doctests in the documentation" |
| 33 | @echo " pydoc-topics to regenerate the pydoc topics file" |
| 34 | @echo " dist to create a \"dist\" directory with archived docs for download" |
Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 35 | @echo " suspicious to check for suspicious markup in output text" |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 36 | @echo " check to run a check for frequent markup errors" |
| 37 | @echo " serve to serve the documentation on the localhost (8000)" |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 38 | |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 39 | build: |
| 40 | $(SPHINXBUILD) $(ALLSPHINXOPTS) |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 41 | @echo |
| 42 | |
| 43 | html: BUILDER = html |
| 44 | html: build |
| 45 | @echo "Build finished. The HTML pages are in build/html." |
| 46 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 47 | htmlhelp: BUILDER = htmlhelp |
| 48 | htmlhelp: build |
| 49 | @echo "Build finished; now you can run HTML Help Workshop with the" \ |
Georg Brandl | 09a5c3e | 2007-08-15 18:30:42 +0000 | [diff] [blame] | 50 | "build/htmlhelp/pydoc.hhp project file." |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 51 | |
Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 52 | latex: BUILDER = latex |
| 53 | latex: build |
| 54 | @echo "Build finished; the LaTeX files are in build/latex." |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 55 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
| 56 | "run these through (pdf)latex." |
Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 57 | |
Georg Brandl | 4f2c998 | 2008-06-01 16:41:31 +0000 | [diff] [blame] | 58 | text: BUILDER = text |
| 59 | text: build |
| 60 | @echo "Build finished; the text files are in build/text." |
| 61 | |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 62 | epub: BUILDER = epub |
| 63 | epub: build |
| 64 | @echo "Build finished; the epub files are in build/epub." |
| 65 | |
Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 66 | changes: BUILDER = changes |
| 67 | changes: build |
| 68 | @echo "The overview file is in build/changes." |
| 69 | |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 70 | linkcheck: BUILDER = linkcheck |
Serhiy Storchaka | 7f7d99c | 2014-07-22 10:28:36 +0300 | [diff] [blame] | 71 | linkcheck: |
| 72 | @$(MAKE) build BUILDER=$(BUILDER) || { \ |
| 73 | echo "Link check complete; look for any errors in the above output" \ |
| 74 | "or in build/$(BUILDER)/output.txt"; \ |
| 75 | false; } |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 76 | |
Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 77 | suspicious: BUILDER = suspicious |
Serhiy Storchaka | 7f7d99c | 2014-07-22 10:28:36 +0300 | [diff] [blame] | 78 | suspicious: |
| 79 | @$(MAKE) build BUILDER=$(BUILDER) || { \ |
| 80 | echo "Suspicious check complete; look for any errors in the above output" \ |
| 81 | "or in build/$(BUILDER)/suspicious.csv. If all issues are false" \ |
Georg Brandl | f16fbf9 | 2014-09-30 22:51:30 +0200 | [diff] [blame] | 82 | "positives, append that file to tools/susp-ignored.csv."; \ |
Serhiy Storchaka | 7f7d99c | 2014-07-22 10:28:36 +0300 | [diff] [blame] | 83 | false; } |
Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 84 | |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 85 | coverage: BUILDER = coverage |
| 86 | coverage: build |
| 87 | @echo "Coverage finished; see c.txt and python.txt in build/coverage" |
| 88 | |
Georg Brandl | 17baef0 | 2008-03-22 10:56:23 +0000 | [diff] [blame] | 89 | doctest: BUILDER = doctest |
Serhiy Storchaka | 7f7d99c | 2014-07-22 10:28:36 +0300 | [diff] [blame] | 90 | doctest: |
| 91 | @$(MAKE) build BUILDER=$(BUILDER) || { \ |
| 92 | echo "Testing of doctests in the sources finished, look at the" \ |
| 93 | "results in build/doctest/output.txt"; \ |
| 94 | false; } |
Georg Brandl | 17baef0 | 2008-03-22 10:56:23 +0000 | [diff] [blame] | 95 | |
Georg Brandl | 681001e | 2008-06-01 20:33:55 +0000 | [diff] [blame] | 96 | pydoc-topics: BUILDER = pydoc-topics |
| 97 | pydoc-topics: build |
Georg Brandl | 2471063 | 2010-10-06 10:47:20 +0000 | [diff] [blame] | 98 | @echo "Building finished; now copy build/pydoc-topics/topics.py" \ |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 99 | "to ../Lib/pydoc_data/topics.py" |
Georg Brandl | 681001e | 2008-06-01 20:33:55 +0000 | [diff] [blame] | 100 | |
Benjamin Peterson | b279b8a | 2008-06-26 21:23:30 +0000 | [diff] [blame] | 101 | htmlview: html |
| 102 | $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 103 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 104 | clean: |
| 105 | -rm -rf build/* |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 106 | |
| 107 | dist: |
Georg Brandl | 10c78a7 | 2010-08-03 12:37:19 +0000 | [diff] [blame] | 108 | rm -rf dist |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 109 | mkdir -p dist |
| 110 | |
| 111 | # archive the HTML |
| 112 | make html |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 113 | cp -pPR build/html dist/python-$(DISTVERSION)-docs-html |
| 114 | tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html |
| 115 | bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar |
| 116 | (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html) |
| 117 | rm -r dist/python-$(DISTVERSION)-docs-html |
| 118 | rm dist/python-$(DISTVERSION)-docs-html.tar |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 119 | |
| 120 | # archive the text build |
| 121 | make text |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 122 | cp -pPR build/text dist/python-$(DISTVERSION)-docs-text |
| 123 | tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text |
| 124 | bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar |
| 125 | (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text) |
| 126 | rm -r dist/python-$(DISTVERSION)-docs-text |
| 127 | rm dist/python-$(DISTVERSION)-docs-text.tar |
Georg Brandl | 4381925 | 2009-04-26 09:56:44 +0000 | [diff] [blame] | 128 | |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 129 | # archive the A4 latex |
Georg Brandl | 10c78a7 | 2010-08-03 12:37:19 +0000 | [diff] [blame] | 130 | rm -rf build/latex |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 131 | make latex PAPER=a4 |
Georg Brandl | 2e73a3f | 2010-07-11 08:57:05 +0000 | [diff] [blame] | 132 | -sed -i 's/makeindex/makeindex -q/' build/latex/Makefile |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 133 | (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 134 | cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip |
| 135 | cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2 |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 136 | |
| 137 | # archive the letter latex |
Georg Brandl | 10c78a7 | 2010-08-03 12:37:19 +0000 | [diff] [blame] | 138 | rm -rf build/latex |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 139 | make latex PAPER=letter |
Georg Brandl | 2e73a3f | 2010-07-11 08:57:05 +0000 | [diff] [blame] | 140 | -sed -i 's/makeindex/makeindex -q/' build/latex/Makefile |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 141 | (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 142 | cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip |
| 143 | cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2 |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 144 | |
Benjamin Peterson | 423f128 | 2014-09-04 23:07:03 -0400 | [diff] [blame] | 145 | # copy the epub build |
| 146 | rm -rf build/epub |
| 147 | make epub |
| 148 | cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub |
| 149 | |
Georg Brandl | 9f7a339 | 2009-01-03 20:30:15 +0000 | [diff] [blame] | 150 | check: |
Georg Brandl | 3b62c2f | 2009-01-03 21:11:58 +0000 | [diff] [blame] | 151 | $(PYTHON) tools/rstlint.py -i tools |
Dirkjan Ochtman | e4c74e1 | 2010-02-24 04:12:11 +0000 | [diff] [blame] | 152 | |
| 153 | serve: |
| 154 | ../Tools/scripts/serve.py build/html |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 155 | |
Georg Brandl | e82110f | 2010-03-13 13:39:46 +0000 | [diff] [blame] | 156 | # Targets for daily automated doc build |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 157 | |
| 158 | # for development releases: always build |
| 159 | autobuild-dev: |
Ezio Melotti | 8645890 | 2012-10-27 22:28:48 +0300 | [diff] [blame] | 160 | make dist SPHINXOPTS='-A daily=1 -A versionswitcher=1' |
Georg Brandl | 40dcf7f | 2013-11-24 16:17:54 +0100 | [diff] [blame] | 161 | -make suspicious |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 162 | |
Georg Brandl | 5fb657d | 2012-10-28 08:09:02 +0100 | [diff] [blame] | 163 | # for quick rebuilds (HTML only) |
| 164 | autobuild-html: |
| 165 | make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' |
| 166 | |
Benjamin Peterson | d1a4f99 | 2014-09-24 20:22:24 -0400 | [diff] [blame] | 167 | # for stable releases: only build if not in pre-release stage (alpha, beta) |
| 168 | # release candidate downloads are okay, since the stable tree can be in that stage |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 169 | autobuild-stable: |
Benjamin Peterson | d1a4f99 | 2014-09-24 20:22:24 -0400 | [diff] [blame] | 170 | @case $(DISTVERSION) in *[ab]*) \ |
Georg Brandl | e82110f | 2010-03-13 13:39:46 +0000 | [diff] [blame] | 171 | echo "Not building; $(DISTVERSION) is not a release version."; \ |
| 172 | exit 1;; \ |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 173 | esac |
| 174 | @make autobuild-dev |
Georg Brandl | 5fb657d | 2012-10-28 08:09:02 +0100 | [diff] [blame] | 175 | |