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 |
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" |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 27 | @echo " suspicious to check for suspicious markup in output text" |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 28 | @echo " coverage to check documentation coverage for library and C API" |
Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 29 | @echo " dist to create a \"dist\" directory with archived docs for download" |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 30 | |
Georg Brandl | 5617db8 | 2009-04-27 16:28:57 +0000 | [diff] [blame] | 31 | # Note: if you update versions here, do the same in make.bat and README.txt |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 32 | checkout: |
| 33 | @if [ ! -d tools/sphinx ]; then \ |
| 34 | echo "Checking out Sphinx..."; \ |
Benjamin Peterson | 864b3f0 | 2009-11-13 23:14:24 +0000 | [diff] [blame^] | 35 | svn checkout $(SVNROOT)/external/Sphinx-0.6.3/sphinx tools/sphinx; \ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 36 | fi |
| 37 | @if [ ! -d tools/docutils ]; then \ |
| 38 | echo "Checking out Docutils..."; \ |
Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 39 | svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 40 | fi |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 41 | @if [ ! -d tools/jinja2 ]; then \ |
Benjamin Peterson | d860762 | 2008-04-13 23:11:15 +0000 | [diff] [blame] | 42 | echo "Checking out Jinja..."; \ |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 43 | svn checkout $(SVNROOT)/external/Jinja-2.1.1/jinja2 tools/jinja2; \ |
Benjamin Peterson | d860762 | 2008-04-13 23:11:15 +0000 | [diff] [blame] | 44 | fi |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 45 | @if [ ! -d tools/pygments ]; then \ |
| 46 | echo "Checking out Pygments..."; \ |
Georg Brandl | 617027f | 2008-09-09 19:14:12 +0000 | [diff] [blame] | 47 | svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 48 | fi |
| 49 | |
Thomas Wouters | bca5480 | 2007-09-10 19:32:14 +0000 | [diff] [blame] | 50 | update: checkout |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 51 | svn update tools/sphinx |
| 52 | svn update tools/docutils |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 53 | svn update tools/jinja2 |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 54 | svn update tools/pygments |
| 55 | |
| 56 | build: checkout |
| 57 | mkdir -p build/$(BUILDER) build/doctrees |
| 58 | $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS) |
| 59 | @echo |
| 60 | |
| 61 | html: BUILDER = html |
| 62 | html: build |
| 63 | @echo "Build finished. The HTML pages are in build/html." |
| 64 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 65 | htmlhelp: BUILDER = htmlhelp |
| 66 | htmlhelp: build |
| 67 | @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] | 68 | "build/htmlhelp/pydoc.hhp project file." |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 69 | |
Christian Heimes | d8654cf | 2007-12-02 15:22:16 +0000 | [diff] [blame] | 70 | latex: BUILDER = latex |
| 71 | latex: build |
| 72 | @echo "Build finished; the LaTeX files are in build/latex." |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 73 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
| 74 | "run these through (pdf)latex." |
Christian Heimes | d8654cf | 2007-12-02 15:22:16 +0000 | [diff] [blame] | 75 | |
Georg Brandl | 0c77a82 | 2008-06-10 16:37:50 +0000 | [diff] [blame] | 76 | text: BUILDER = text |
| 77 | text: build |
| 78 | @echo "Build finished; the text files are in build/text." |
| 79 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 80 | changes: BUILDER = changes |
| 81 | changes: build |
| 82 | @echo "The overview file is in build/changes." |
| 83 | |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 84 | linkcheck: BUILDER = linkcheck |
| 85 | linkcheck: build |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 86 | @echo "Link check complete; look for any errors in the above output " \ |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 87 | "or in build/$(BUILDER)/output.txt" |
| 88 | |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 89 | suspicious: BUILDER = suspicious |
| 90 | suspicious: build |
| 91 | @echo "Suspicious check complete; look for any errors in the above output " \ |
| 92 | "or in build/$(BUILDER)/suspicious.txt" |
| 93 | |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 94 | coverage: BUILDER = coverage |
| 95 | coverage: build |
| 96 | @echo "Coverage finished; see c.txt and python.txt in build/coverage" |
| 97 | |
Christian Heimes | fe337bf | 2008-03-23 21:54:12 +0000 | [diff] [blame] | 98 | doctest: BUILDER = doctest |
| 99 | doctest: build |
| 100 | @echo "Testing of doctests in the sources finished, look at the " \ |
| 101 | "results in build/doctest/output.txt" |
| 102 | |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 103 | pydoc-topics: BUILDER = pydoc-topics |
| 104 | pydoc-topics: build |
Georg Brandl | 5617db8 | 2009-04-27 16:28:57 +0000 | [diff] [blame] | 105 | @echo "Building finished; now copy build/pydoc-topics/topics.py " \ |
| 106 | "to Lib/pydoc_data/topics.py" |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 107 | |
Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 108 | htmlview: html |
| 109 | $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" |
Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 110 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 111 | clean: |
| 112 | -rm -rf build/* |
| 113 | -rm -rf tools/sphinx |
Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 114 | |
| 115 | dist: |
| 116 | -rm -rf dist |
| 117 | mkdir -p dist |
| 118 | |
| 119 | # archive the HTML |
| 120 | make html |
Benjamin Peterson | 9203501 | 2008-12-27 16:00:54 +0000 | [diff] [blame] | 121 | cp -pPR build/html dist/python-$(DISTVERSION)-docs-html |
| 122 | tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html |
| 123 | bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar |
| 124 | (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html) |
| 125 | rm -r dist/python-$(DISTVERSION)-docs-html |
| 126 | rm dist/python-$(DISTVERSION)-docs-html.tar |
Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 127 | |
| 128 | # archive the text build |
| 129 | make text |
Benjamin Peterson | 9203501 | 2008-12-27 16:00:54 +0000 | [diff] [blame] | 130 | cp -pPR build/text dist/python-$(DISTVERSION)-docs-text |
| 131 | tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text |
| 132 | bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar |
| 133 | (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text) |
| 134 | rm -r dist/python-$(DISTVERSION)-docs-text |
| 135 | rm dist/python-$(DISTVERSION)-docs-text.tar |
Georg Brandl | 5617db8 | 2009-04-27 16:28:57 +0000 | [diff] [blame] | 136 | |
Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 137 | # archive the A4 latex |
| 138 | -rm -r build/latex |
| 139 | make latex PAPER=a4 |
| 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-a4.zip |
| 142 | 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] | 143 | |
| 144 | # archive the letter latex |
| 145 | rm -r build/latex |
| 146 | make latex PAPER=letter |
| 147 | (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] | 148 | cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip |
| 149 | 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] | 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 |