| 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 | 
 | 8 | SVNROOT      = http://svn.python.org/projects | 
 | 9 | SPHINXOPTS   = | 
| Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 10 | PAPER        = | 
| Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 11 | SOURCES      = | 
| Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 12 | DISTVERSION  = $(shell $(PYTHON) tools/sphinxext/patchlevel.py) | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 13 |  | 
| Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 14 | ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ | 
| Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 15 |                 $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 16 |  | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 17 | .PHONY: help checkout update build html htmlhelp latex text changes linkcheck \ | 
 | 18 | 	suspicious coverage doctest pydoc-topics htmlview clean dist check serve \ | 
 | 19 | 	autobuild-dev autobuild-stable | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 20 |  | 
 | 21 | help: | 
 | 22 | 	@echo "Please use \`make <target>' where <target> is one of" | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 23 | 	@echo "  clean      to remove build files" | 
 | 24 | 	@echo "  update     to update build tools" | 
 | 25 | 	@echo "  html       to make standalone HTML files" | 
 | 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" | 
 | 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 |  | 
| Georg Brandl | 4381925 | 2009-04-26 09:56:44 +0000 | [diff] [blame] | 39 | # Note: if you update versions here, do the same in make.bat and README.txt | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 40 | checkout: | 
 | 41 | 	@if [ ! -d tools/sphinx ]; then \ | 
 | 42 | 	  echo "Checking out Sphinx..."; \ | 
| Sandro Tosi | bbd41d0 | 2012-01-14 16:41:26 +0100 | [diff] [blame] | 43 | 	  svn checkout $(SVNROOT)/external/Sphinx-1.0.7/sphinx tools/sphinx; \ | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 44 | 	fi | 
 | 45 | 	@if [ ! -d tools/docutils ]; then \ | 
 | 46 | 	  echo "Checking out Docutils..."; \ | 
| Georg Brandl | fce7b86 | 2010-03-13 10:54:12 +0000 | [diff] [blame] | 47 | 	  svn checkout $(SVNROOT)/external/docutils-0.6/docutils tools/docutils; \ | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 48 | 	fi | 
| Benjamin Peterson | d680d96 | 2009-01-04 22:00:18 +0000 | [diff] [blame] | 49 | 	@if [ ! -d tools/jinja2 ]; then \ | 
| Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 50 | 	  echo "Checking out Jinja..."; \ | 
| Georg Brandl | fce7b86 | 2010-03-13 10:54:12 +0000 | [diff] [blame] | 51 | 	  svn checkout $(SVNROOT)/external/Jinja-2.3.1/jinja2 tools/jinja2; \ | 
| Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 52 | 	fi | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 53 | 	@if [ ! -d tools/pygments ]; then \ | 
 | 54 | 	  echo "Checking out Pygments..."; \ | 
| Georg Brandl | fce7b86 | 2010-03-13 10:54:12 +0000 | [diff] [blame] | 55 | 	  svn checkout $(SVNROOT)/external/Pygments-1.3.1/pygments tools/pygments; \ | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 56 | 	fi | 
 | 57 |  | 
| Georg Brandl | e5ee7e3 | 2009-12-30 18:36:09 +0000 | [diff] [blame] | 58 | update: clean checkout | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 59 |  | 
 | 60 | build: checkout | 
 | 61 | 	mkdir -p build/$(BUILDER) build/doctrees | 
 | 62 | 	$(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS) | 
 | 63 | 	@echo | 
 | 64 |  | 
 | 65 | html: BUILDER = html | 
 | 66 | html: build | 
 | 67 | 	@echo "Build finished. The HTML pages are in build/html." | 
 | 68 |  | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 69 | htmlhelp: BUILDER = htmlhelp | 
 | 70 | htmlhelp: build | 
 | 71 | 	@echo "Build finished; now you can run HTML Help Workshop with the" \ | 
| Georg Brandl | 09a5c3e | 2007-08-15 18:30:42 +0000 | [diff] [blame] | 72 | 	      "build/htmlhelp/pydoc.hhp project file." | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 73 |  | 
| Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 74 | latex: BUILDER = latex | 
 | 75 | latex: build | 
 | 76 | 	@echo "Build finished; the LaTeX files are in build/latex." | 
| Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 77 | 	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ | 
 | 78 | 	      "run these through (pdf)latex." | 
| Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 79 |  | 
| Georg Brandl | 4f2c998 | 2008-06-01 16:41:31 +0000 | [diff] [blame] | 80 | text: BUILDER = text | 
 | 81 | text: build | 
 | 82 | 	@echo "Build finished; the text files are in build/text." | 
 | 83 |  | 
| Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 84 | changes: BUILDER = changes | 
 | 85 | changes: build | 
 | 86 | 	@echo "The overview file is in build/changes." | 
 | 87 |  | 
| Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 88 | linkcheck: BUILDER = linkcheck | 
 | 89 | linkcheck: build | 
| Georg Brandl | 2471063 | 2010-10-06 10:47:20 +0000 | [diff] [blame] | 90 | 	@echo "Link check complete; look for any errors in the above output" \ | 
| Georg Brandl | 7be67ff | 2008-02-01 19:24:01 +0000 | [diff] [blame] | 91 | 	      "or in build/$(BUILDER)/output.txt" | 
| Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 92 |  | 
| Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 93 | suspicious: BUILDER = suspicious | 
 | 94 | suspicious: build | 
| Georg Brandl | 2471063 | 2010-10-06 10:47:20 +0000 | [diff] [blame] | 95 | 	@echo "Suspicious check complete; look for any errors in the above output" \ | 
 | 96 | 	      "or in build/$(BUILDER)/suspicious.csv.  If all issues are false" \ | 
 | 97 | 	      "positives, append that file to tools/sphinxext/susp-ignored.csv." | 
| Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 98 |  | 
| Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 99 | coverage: BUILDER = coverage | 
 | 100 | coverage: build | 
 | 101 | 	@echo "Coverage finished; see c.txt and python.txt in build/coverage" | 
 | 102 |  | 
| Georg Brandl | 17baef0 | 2008-03-22 10:56:23 +0000 | [diff] [blame] | 103 | doctest: BUILDER = doctest | 
 | 104 | doctest: build | 
| Georg Brandl | 2471063 | 2010-10-06 10:47:20 +0000 | [diff] [blame] | 105 | 	@echo "Testing of doctests in the sources finished, look at the" \ | 
| Georg Brandl | 17baef0 | 2008-03-22 10:56:23 +0000 | [diff] [blame] | 106 | 	      "results in build/doctest/output.txt" | 
 | 107 |  | 
| Georg Brandl | 681001e | 2008-06-01 20:33:55 +0000 | [diff] [blame] | 108 | pydoc-topics: BUILDER = pydoc-topics | 
 | 109 | pydoc-topics: build | 
| Georg Brandl | 2471063 | 2010-10-06 10:47:20 +0000 | [diff] [blame] | 110 | 	@echo "Building finished; now copy build/pydoc-topics/topics.py" \ | 
| Georg Brandl | 4381925 | 2009-04-26 09:56:44 +0000 | [diff] [blame] | 111 | 	      "to Lib/pydoc_data/topics.py" | 
| Georg Brandl | 681001e | 2008-06-01 20:33:55 +0000 | [diff] [blame] | 112 |  | 
| Benjamin Peterson | b279b8a | 2008-06-26 21:23:30 +0000 | [diff] [blame] | 113 | htmlview: html | 
 | 114 | 	 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 115 |  | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 116 | clean: | 
 | 117 | 	-rm -rf build/* | 
 | 118 | 	-rm -rf tools/sphinx | 
| Georg Brandl | e5ee7e3 | 2009-12-30 18:36:09 +0000 | [diff] [blame] | 119 | 	-rm -rf tools/pygments | 
 | 120 | 	-rm -rf tools/jinja2 | 
 | 121 | 	-rm -rf tools/docutils | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 122 |  | 
 | 123 | dist: | 
| Georg Brandl | 10c78a7 | 2010-08-03 12:37:19 +0000 | [diff] [blame] | 124 | 	rm -rf dist | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 125 | 	mkdir -p dist | 
 | 126 |  | 
 | 127 | 	# archive the HTML | 
 | 128 | 	make html | 
| Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 129 | 	cp -pPR build/html dist/python-$(DISTVERSION)-docs-html | 
 | 130 | 	tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html | 
 | 131 | 	bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar | 
 | 132 | 	(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html) | 
 | 133 | 	rm -r dist/python-$(DISTVERSION)-docs-html | 
 | 134 | 	rm dist/python-$(DISTVERSION)-docs-html.tar | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 135 |  | 
 | 136 | 	# archive the text build | 
 | 137 | 	make text | 
| Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 138 | 	cp -pPR build/text dist/python-$(DISTVERSION)-docs-text | 
 | 139 | 	tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text | 
 | 140 | 	bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar | 
 | 141 | 	(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text) | 
 | 142 | 	rm -r dist/python-$(DISTVERSION)-docs-text | 
 | 143 | 	rm dist/python-$(DISTVERSION)-docs-text.tar | 
| Georg Brandl | 4381925 | 2009-04-26 09:56:44 +0000 | [diff] [blame] | 144 |  | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 145 | 	# archive the A4 latex | 
| Georg Brandl | 10c78a7 | 2010-08-03 12:37:19 +0000 | [diff] [blame] | 146 | 	rm -rf build/latex | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 147 | 	make latex PAPER=a4 | 
| Georg Brandl | 2e73a3f | 2010-07-11 08:57:05 +0000 | [diff] [blame] | 148 | 	-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 149 | 	(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] | 150 | 	cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip | 
 | 151 | 	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] | 152 |  | 
 | 153 | 	# archive the letter latex | 
| Georg Brandl | 10c78a7 | 2010-08-03 12:37:19 +0000 | [diff] [blame] | 154 | 	rm -rf build/latex | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 155 | 	make latex PAPER=letter | 
| Georg Brandl | 2e73a3f | 2010-07-11 08:57:05 +0000 | [diff] [blame] | 156 | 	-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile | 
| Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 157 | 	(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] | 158 | 	cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip | 
 | 159 | 	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] | 160 |  | 
| Georg Brandl | 9f7a339 | 2009-01-03 20:30:15 +0000 | [diff] [blame] | 161 | check: | 
| Georg Brandl | 3b62c2f | 2009-01-03 21:11:58 +0000 | [diff] [blame] | 162 | 	$(PYTHON) tools/rstlint.py -i tools | 
| Dirkjan Ochtman | e4c74e1 | 2010-02-24 04:12:11 +0000 | [diff] [blame] | 163 |  | 
 | 164 | serve: | 
 | 165 | 	../Tools/scripts/serve.py build/html | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 166 |  | 
| Georg Brandl | e82110f | 2010-03-13 13:39:46 +0000 | [diff] [blame] | 167 | # Targets for daily automated doc build | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 168 |  | 
 | 169 | # for development releases: always build | 
 | 170 | autobuild-dev: | 
 | 171 | 	make update | 
| Georg Brandl | e82110f | 2010-03-13 13:39:46 +0000 | [diff] [blame] | 172 | 	make dist SPHINXOPTS='-A daily=1' | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 173 |  | 
| Georg Brandl | e82110f | 2010-03-13 13:39:46 +0000 | [diff] [blame] | 174 | # for stable releases: only build if not in pre-release stage (alpha, beta, rc) | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 175 | autobuild-stable: | 
 | 176 | 	@case $(DISTVERSION) in *[abc]*) \ | 
| Georg Brandl | e82110f | 2010-03-13 13:39:46 +0000 | [diff] [blame] | 177 | 		echo "Not building; $(DISTVERSION) is not a release version."; \ | 
 | 178 | 		exit 1;; \ | 
| Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 179 | 	esac | 
 | 180 | 	@make autobuild-dev |