blob: 91da93cc3089d314fb405fb47e6d7b816c550f3c [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001#
2# Makefile for Python documentation
3# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4#
5
6# You can set these variables from the command line.
Guido van Rossumba9c9ac2007-08-18 00:03:44 +00007PYTHON = python2.5
Guido van Rossumda27fd22007-08-17 00:24:54 +00008SVNROOT = http://svn.python.org/projects
9SPHINXOPTS =
Christian Heimes2c181612007-12-17 20:04:13 +000010PAPER =
Christian Heimesfe337bf2008-03-23 21:54:12 +000011SOURCES =
Benjamin Peterson92035012008-12-27 16:00:54 +000012DISTVERSION = $(shell $(PYTHON) tools/sphinxext/patchlevel.py)
Georg Brandl116aa622007-08-15 14:28:22 +000013
Christian Heimes2c181612007-12-17 20:04:13 +000014ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
Christian Heimesfe337bf2008-03-23 21:54:12 +000015 $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
Georg Brandl116aa622007-08-15 14:28:22 +000016
Benjamin Peterson9bc93512008-09-22 22:10:59 +000017.PHONY: help checkout update build html htmlhelp clean coverage dist
Georg Brandl116aa622007-08-15 14:28:22 +000018
19help:
20 @echo "Please use \`make <target>' where <target> is one of"
Christian Heimes292d3512008-02-03 16:51:08 +000021 @echo " html to make standalone HTML files"
Christian Heimes292d3512008-02-03 16:51:08 +000022 @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 Brandl0c77a822008-06-10 16:37:50 +000024 @echo " text to make plain text files"
Christian Heimes292d3512008-02-03 16:51:08 +000025 @echo " changes to make an overview over all changed/added/deprecated items"
26 @echo " linkcheck to check all external links for integrity"
Christian Heimesd3eb5a152008-02-24 00:38:49 +000027 @echo " coverage to check documentation coverage for library and C API"
Benjamin Peterson9bc93512008-09-22 22:10:59 +000028 @echo " dist to create a \"dist\" directory with archived docs for download"
Georg Brandl116aa622007-08-15 14:28:22 +000029
30checkout:
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 Peterson41181742008-07-02 20:22:54 +000037 svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \
Georg Brandl116aa622007-08-15 14:28:22 +000038 fi
Benjamin Petersond8607622008-04-13 23:11:15 +000039 @if [ ! -d tools/jinja ]; then \
40 echo "Checking out Jinja..."; \
Benjamin Peterson41181742008-07-02 20:22:54 +000041 svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \
Benjamin Petersond8607622008-04-13 23:11:15 +000042 fi
Georg Brandl116aa622007-08-15 14:28:22 +000043 @if [ ! -d tools/pygments ]; then \
44 echo "Checking out Pygments..."; \
Georg Brandl617027f2008-09-09 19:14:12 +000045 svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \
Georg Brandl116aa622007-08-15 14:28:22 +000046 fi
47
Thomas Woutersbca54802007-09-10 19:32:14 +000048update: checkout
Georg Brandl116aa622007-08-15 14:28:22 +000049 svn update tools/sphinx
50 svn update tools/docutils
Benjamin Petersond8607622008-04-13 23:11:15 +000051 svn update tools/jinja
Georg Brandl116aa622007-08-15 14:28:22 +000052 svn update tools/pygments
53
54build: checkout
55 mkdir -p build/$(BUILDER) build/doctrees
56 $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
57 @echo
58
59html: BUILDER = html
60html: build
61 @echo "Build finished. The HTML pages are in build/html."
62
Georg Brandl116aa622007-08-15 14:28:22 +000063htmlhelp: BUILDER = htmlhelp
64htmlhelp: build
65 @echo "Build finished; now you can run HTML Help Workshop with the" \
Guido van Rossumda27fd22007-08-17 00:24:54 +000066 "build/htmlhelp/pydoc.hhp project file."
Georg Brandl116aa622007-08-15 14:28:22 +000067
Christian Heimesd8654cf2007-12-02 15:22:16 +000068latex: BUILDER = latex
69latex: build
70 @echo "Build finished; the LaTeX files are in build/latex."
Christian Heimes2c181612007-12-17 20:04:13 +000071 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
72 "run these through (pdf)latex."
Christian Heimesd8654cf2007-12-02 15:22:16 +000073
Georg Brandl0c77a822008-06-10 16:37:50 +000074text: BUILDER = text
75text: build
76 @echo "Build finished; the text files are in build/text."
77
Christian Heimes5b5e81c2007-12-31 16:14:33 +000078changes: BUILDER = changes
79changes: build
80 @echo "The overview file is in build/changes."
81
Christian Heimes292d3512008-02-03 16:51:08 +000082linkcheck: BUILDER = linkcheck
83linkcheck: build
Christian Heimesd3eb5a152008-02-24 00:38:49 +000084 @echo "Link check complete; look for any errors in the above output " \
Christian Heimes292d3512008-02-03 16:51:08 +000085 "or in build/$(BUILDER)/output.txt"
86
Christian Heimesd3eb5a152008-02-24 00:38:49 +000087coverage: BUILDER = coverage
88coverage: build
89 @echo "Coverage finished; see c.txt and python.txt in build/coverage"
90
Christian Heimesfe337bf2008-03-23 21:54:12 +000091doctest: BUILDER = doctest
92doctest: build
93 @echo "Testing of doctests in the sources finished, look at the " \
94 "results in build/doctest/output.txt"
95
Georg Brandl6b38daa2008-06-01 21:05:17 +000096pydoc-topics: BUILDER = pydoc-topics
97pydoc-topics: build
98 @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \
99 "into the Lib/ directory"
100
Benjamin Peterson41181742008-07-02 20:22:54 +0000101htmlview: html
102 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
Benjamin Peterson9bc93512008-09-22 22:10:59 +0000103
Georg Brandl116aa622007-08-15 14:28:22 +0000104clean:
105 -rm -rf build/*
106 -rm -rf tools/sphinx
Benjamin Peterson9bc93512008-09-22 22:10:59 +0000107
108dist:
109 -rm -rf dist
110 mkdir -p dist
111
112 # archive the HTML
113 make html
Benjamin Peterson92035012008-12-27 16:00:54 +0000114 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 Peterson9bc93512008-09-22 22:10:59 +0000120
121 # archive the text build
122 make text
Benjamin Peterson92035012008-12-27 16:00:54 +0000123 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 Peterson9bc93512008-09-22 22:10:59 +0000129
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 Peterson92035012008-12-27 16:00:54 +0000134 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 Peterson9bc93512008-09-22 22:10:59 +0000136
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 Peterson92035012008-12-27 16:00:54 +0000141 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 Peterson9bc93512008-09-22 22:10:59 +0000143