| 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. | 
| Guido van Rossum | ba9c9ac | 2007-08-18 00:03:44 +0000 | [diff] [blame] | 7 | PYTHON       = python2.5 | 
| Guido van Rossum | da27fd2 | 2007-08-17 00:24:54 +0000 | [diff] [blame] | 8 | SVNROOT      = http://svn.python.org/projects | 
 | 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 |  | 
| Georg Brandl | 45f5337 | 2009-01-03 21:15:20 +0000 | [diff] [blame] | 17 | .PHONY: help checkout update build html htmlhelp clean coverage dist check | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 18 |  | 
 | 19 | help: | 
 | 20 | 	@echo "Please use \`make <target>' where <target> is one of" | 
| Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 21 | 	@echo "  html      to make standalone HTML files" | 
| Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 22 | 	@echo "  htmlhelp  to make HTML files and a HTML help project" | 
 | 23 | 	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter" | 
| Georg Brandl | 0c77a82 | 2008-06-10 16:37:50 +0000 | [diff] [blame] | 24 | 	@echo "  text      to make plain text files" | 
| Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 25 | 	@echo "  changes   to make an overview over all changed/added/deprecated items" | 
 | 26 | 	@echo "  linkcheck to check all external links for integrity" | 
| Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 27 | 	@echo "  coverage  to check documentation coverage for library and C API" | 
| Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 28 | 	@echo "  dist      to create a \"dist\" directory with archived docs for download" | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 29 |  | 
 | 30 | checkout: | 
 | 31 | 	@if [ ! -d tools/sphinx ]; then \ | 
 | 32 | 	  echo "Checking out Sphinx..."; \ | 
 | 33 | 	  svn checkout $(SVNROOT)/doctools/trunk/sphinx tools/sphinx; \ | 
 | 34 | 	fi | 
 | 35 | 	@if [ ! -d tools/docutils ]; then \ | 
 | 36 | 	  echo "Checking out Docutils..."; \ | 
| Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 37 | 	  svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 38 | 	fi | 
| Benjamin Peterson | d860762 | 2008-04-13 23:11:15 +0000 | [diff] [blame] | 39 | 	@if [ ! -d tools/jinja ]; then \ | 
 | 40 | 	  echo "Checking out Jinja..."; \ | 
| Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 41 | 	  svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \ | 
| Benjamin Peterson | d860762 | 2008-04-13 23:11:15 +0000 | [diff] [blame] | 42 | 	fi | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 43 | 	@if [ ! -d tools/pygments ]; then \ | 
 | 44 | 	  echo "Checking out Pygments..."; \ | 
| Georg Brandl | 617027f | 2008-09-09 19:14:12 +0000 | [diff] [blame] | 45 | 	  svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \ | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 46 | 	fi | 
 | 47 |  | 
| Thomas Wouters | bca5480 | 2007-09-10 19:32:14 +0000 | [diff] [blame] | 48 | update: checkout | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 49 | 	svn update tools/sphinx | 
 | 50 | 	svn update tools/docutils | 
| Benjamin Peterson | d860762 | 2008-04-13 23:11:15 +0000 | [diff] [blame] | 51 | 	svn update tools/jinja | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 52 | 	svn update tools/pygments | 
 | 53 |  | 
 | 54 | build: checkout | 
 | 55 | 	mkdir -p build/$(BUILDER) build/doctrees | 
 | 56 | 	$(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS) | 
 | 57 | 	@echo | 
 | 58 |  | 
 | 59 | html: BUILDER = html | 
 | 60 | html: build | 
 | 61 | 	@echo "Build finished. The HTML pages are in build/html." | 
 | 62 |  | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 63 | htmlhelp: BUILDER = htmlhelp | 
 | 64 | htmlhelp: build | 
 | 65 | 	@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] | 66 | 	      "build/htmlhelp/pydoc.hhp project file." | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 67 |  | 
| Christian Heimes | d8654cf | 2007-12-02 15:22:16 +0000 | [diff] [blame] | 68 | latex: BUILDER = latex | 
 | 69 | latex: build | 
 | 70 | 	@echo "Build finished; the LaTeX files are in build/latex." | 
| Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 71 | 	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ | 
 | 72 | 	      "run these through (pdf)latex." | 
| Christian Heimes | d8654cf | 2007-12-02 15:22:16 +0000 | [diff] [blame] | 73 |  | 
| Georg Brandl | 0c77a82 | 2008-06-10 16:37:50 +0000 | [diff] [blame] | 74 | text: BUILDER = text | 
 | 75 | text: build | 
 | 76 | 	@echo "Build finished; the text files are in build/text." | 
 | 77 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 78 | changes: BUILDER = changes | 
 | 79 | changes: build | 
 | 80 | 	@echo "The overview file is in build/changes." | 
 | 81 |  | 
| Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 82 | linkcheck: BUILDER = linkcheck | 
 | 83 | linkcheck: build | 
| Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 84 | 	@echo "Link check complete; look for any errors in the above output " \ | 
| Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 85 | 	      "or in build/$(BUILDER)/output.txt" | 
 | 86 |  | 
| Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 87 | coverage: BUILDER = coverage | 
 | 88 | coverage: build | 
 | 89 | 	@echo "Coverage finished; see c.txt and python.txt in build/coverage" | 
 | 90 |  | 
| Christian Heimes | fe337bf | 2008-03-23 21:54:12 +0000 | [diff] [blame] | 91 | doctest: BUILDER = doctest | 
 | 92 | doctest: build | 
 | 93 | 	@echo "Testing of doctests in the sources finished, look at the " \ | 
 | 94 | 	      "results in build/doctest/output.txt" | 
 | 95 |  | 
| Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 96 | pydoc-topics: BUILDER = pydoc-topics | 
 | 97 | pydoc-topics: build | 
 | 98 | 	@echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ | 
 | 99 | 	      "into the Lib/ directory" | 
 | 100 |  | 
| Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 101 | htmlview: html | 
 | 102 | 	 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" | 
| Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 103 |  | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 104 | clean: | 
 | 105 | 	-rm -rf build/* | 
 | 106 | 	-rm -rf tools/sphinx | 
| Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 107 |  | 
 | 108 | dist: | 
 | 109 | 	-rm -rf dist | 
 | 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 | 
| Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 129 | 	 | 
 | 130 | 	# archive the A4 latex | 
 | 131 | 	-rm -r build/latex | 
 | 132 | 	make latex PAPER=a4 | 
 | 133 | 	(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] | 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 | 
| Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 136 |  | 
 | 137 | 	# archive the letter latex | 
 | 138 | 	rm -r build/latex | 
 | 139 | 	make latex PAPER=letter | 
 | 140 | 	(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] | 141 | 	cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip | 
 | 142 | 	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] | 143 |  | 
| Georg Brandl | 45f5337 | 2009-01-03 21:15:20 +0000 | [diff] [blame] | 144 | check: | 
| Georg Brandl | d509788 | 2009-01-03 21:30:40 +0000 | [diff] [blame^] | 145 | 	$(PYTHON) tools/rstlint.py -i tools |