More Python 2.3 compatibility fixes for decimal.py.
[python.git] / Doc / Makefile
blob4e84b8c68555320ad11a2c8d2223b796798cb140
2 # Makefile for Python documentation
3 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 # You can set these variables from the command line.
7 PYTHON = python
8 SVNROOT = http://svn.python.org/projects
9 SPHINXOPTS =
10 PAPER =
11 SOURCES =
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 clean coverage dist check
19 help:
20 @echo "Please use \`make <target>' where <target> is one of"
21 @echo " html to make standalone HTML files"
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"
24 @echo " text to make plain text files"
25 @echo " changes to make an overview over all changed/added/deprecated items"
26 @echo " linkcheck to check all external links for integrity"
27 @echo " suspicious to check for suspicious markup in output text"
28 @echo " coverage to check documentation coverage for library and C API"
29 @echo " dist to create a \"dist\" directory with archived docs for download"
31 checkout:
32 @if [ ! -d tools/sphinx ]; then \
33 echo "Checking out Sphinx..."; \
34 svn checkout $(SVNROOT)/doctools/trunk/sphinx tools/sphinx; \
36 @if [ ! -d tools/docutils ]; then \
37 echo "Checking out Docutils..."; \
38 svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \
40 @if [ ! -d tools/jinja ]; then \
41 echo "Checking out Jinja..."; \
42 svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \
44 @if [ ! -d tools/pygments ]; then \
45 echo "Checking out Pygments..."; \
46 svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \
49 update: checkout
50 svn update tools/sphinx
51 svn update tools/docutils
52 svn update tools/jinja
53 svn update tools/pygments
55 build: checkout
56 mkdir -p build/$(BUILDER) build/doctrees
57 $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
58 @echo
60 html: BUILDER = html
61 html: build
62 @echo "Build finished. The HTML pages are in build/html."
64 htmlhelp: BUILDER = htmlhelp
65 htmlhelp: build
66 @echo "Build finished; now you can run HTML Help Workshop with the" \
67 "build/htmlhelp/pydoc.hhp project file."
69 latex: BUILDER = latex
70 latex: build
71 @echo "Build finished; the LaTeX files are in build/latex."
72 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
73 "run these through (pdf)latex."
75 text: BUILDER = text
76 text: build
77 @echo "Build finished; the text files are in build/text."
79 changes: BUILDER = changes
80 changes: build
81 @echo "The overview file is in build/changes."
83 linkcheck: BUILDER = linkcheck
84 linkcheck: build
85 @echo "Link check complete; look for any errors in the above output " \
86 "or in build/$(BUILDER)/output.txt"
88 suspicious: BUILDER = suspicious
89 suspicious: build
90 @echo "Suspicious check complete; look for any errors in the above output " \
91 "or in build/$(BUILDER)/suspicious.txt"
93 coverage: BUILDER = coverage
94 coverage: build
95 @echo "Coverage finished; see c.txt and python.txt in build/coverage"
97 doctest: BUILDER = doctest
98 doctest: build
99 @echo "Testing of doctests in the sources finished, look at the " \
100 "results in build/doctest/output.txt"
102 pydoc-topics: BUILDER = pydoc-topics
103 pydoc-topics: build
104 @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \
105 "into the Lib/ directory"
107 htmlview: html
108 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
110 clean:
111 -rm -rf build/*
112 -rm -rf tools/sphinx
114 dist:
115 -rm -rf dist
116 mkdir -p dist
118 # archive the HTML
119 make html
120 cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
121 tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
122 bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar
123 (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html)
124 rm -r dist/python-$(DISTVERSION)-docs-html
125 rm dist/python-$(DISTVERSION)-docs-html.tar
127 # archive the text build
128 make text
129 cp -pPR build/text dist/python-$(DISTVERSION)-docs-text
130 tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text
131 bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar
132 (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text)
133 rm -r dist/python-$(DISTVERSION)-docs-text
134 rm dist/python-$(DISTVERSION)-docs-text.tar
136 # archive the A4 latex
137 -rm -r build/latex
138 make latex PAPER=a4
139 (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
140 cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
141 cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
143 # archive the letter latex
144 rm -r build/latex
145 make latex PAPER=letter
146 (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
147 cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
148 cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
150 check:
151 $(PYTHON) tools/rstlint.py -i tools