2
# Makefile for Python documentation
3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6
# You can set these variables from the command line.
8
SVNROOT = http://svn.python.org/projects
12
DISTVERSION = $(shell $(PYTHON) tools/sphinxext/patchlevel.py)
14
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
15
$(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
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
22
@echo "Please use \`make <target>' where <target> is one of"
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 " epub to make EPUB files"
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"
36
@echo " suspicious to check for suspicious markup in output text"
37
@echo " check to run a check for frequent markup errors"
38
@echo " serve to serve the documentation on the localhost (8000)"
40
# Note: if you update versions here, do the same in make.bat and README.txt
42
@if [ ! -d tools/sphinx ]; then \
43
echo "Checking out Sphinx..."; \
44
svn checkout $(SVNROOT)/external/Sphinx-1.0.7/sphinx tools/sphinx; \
46
@if [ ! -d tools/docutils ]; then \
47
echo "Checking out Docutils..."; \
48
svn checkout $(SVNROOT)/external/docutils-0.6/docutils tools/docutils; \
50
@if [ ! -d tools/jinja2 ]; then \
51
echo "Checking out Jinja..."; \
52
svn checkout $(SVNROOT)/external/Jinja-2.3.1/jinja2 tools/jinja2; \
54
@if [ ! -d tools/pygments ]; then \
55
echo "Checking out Pygments..."; \
56
svn checkout $(SVNROOT)/external/Pygments-1.5dev-20120930/pygments tools/pygments; \
59
update: clean checkout
62
mkdir -p build/$(BUILDER) build/doctrees
63
$(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
68
@echo "Build finished. The HTML pages are in build/html."
70
htmlhelp: BUILDER = htmlhelp
72
@echo "Build finished; now you can run HTML Help Workshop with the" \
73
"build/htmlhelp/pydoc.hhp project file."
75
latex: BUILDER = latex
77
@echo "Build finished; the LaTeX files are in build/latex."
78
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
79
"run these through (pdf)latex."
83
@echo "Build finished; the text files are in build/text."
87
@echo "Build finished; the epub files are in build/epub."
89
changes: BUILDER = changes
91
@echo "The overview file is in build/changes."
93
linkcheck: BUILDER = linkcheck
95
@echo "Link check complete; look for any errors in the above output" \
96
"or in build/$(BUILDER)/output.txt"
98
suspicious: BUILDER = suspicious
100
@echo "Suspicious check complete; look for any errors in the above output" \
101
"or in build/$(BUILDER)/suspicious.csv. If all issues are false" \
102
"positives, append that file to tools/sphinxext/susp-ignored.csv."
104
coverage: BUILDER = coverage
106
@echo "Coverage finished; see c.txt and python.txt in build/coverage"
108
doctest: BUILDER = doctest
110
@echo "Testing of doctests in the sources finished, look at the" \
111
"results in build/doctest/output.txt"
113
pydoc-topics: BUILDER = pydoc-topics
115
@echo "Building finished; now copy build/pydoc-topics/topics.py" \
116
"to ../Lib/pydoc_data/topics.py"
119
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
124
-rm -rf tools/pygments
126
-rm -rf tools/docutils
134
cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
135
tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
136
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar
137
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html)
138
rm -r dist/python-$(DISTVERSION)-docs-html
139
rm dist/python-$(DISTVERSION)-docs-html.tar
141
# archive the text build
143
cp -pPR build/text dist/python-$(DISTVERSION)-docs-text
144
tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text
145
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar
146
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text)
147
rm -r dist/python-$(DISTVERSION)-docs-text
148
rm dist/python-$(DISTVERSION)-docs-text.tar
150
# archive the A4 latex
153
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile
154
(cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
155
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
156
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
158
# archive the letter latex
160
make latex PAPER=letter
161
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile
162
(cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
163
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
164
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
166
# archive the epub build
169
mkdir -p dist/python-$(DISTVERSION)-docs-epub
170
cp -pPR build/epub/*.epub dist/python-$(DISTVERSION)-docs-epub/
171
tar -C dist -cf dist/python-$(DISTVERSION)-docs-epub.tar python-$(DISTVERSION)-docs-epub
172
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-epub.tar
173
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-epub.zip python-$(DISTVERSION)-docs-epub)
174
rm -r dist/python-$(DISTVERSION)-docs-epub
175
rm dist/python-$(DISTVERSION)-docs-epub.tar
178
$(PYTHON) tools/rstlint.py -i tools
181
../Tools/scripts/serve.py build/html
183
# Targets for daily automated doc build
185
# for development releases: always build
188
make dist SPHINXOPTS='-A daily=1 -A versionswitcher=1'
190
# for quick rebuilds (HTML only)
192
make html SPHINXOPTS='-A daily=1 -A versionswitcher=1'
194
# for stable releases: only build if not in pre-release stage (alpha, beta, rc)
196
@case $(DISTVERSION) in *[abc]*) \
197
echo "Not building; $(DISTVERSION) is not a release version."; \