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