|
1 # |
|
2 # Makefile for Python documentation |
|
3 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 # |
|
5 |
|
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 = |
|
13 |
|
14 ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ |
|
15 $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) |
|
16 |
|
17 .PHONY: help checkout update build html htmlhelp clean coverage dist |
|
18 |
|
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 " coverage to check documentation coverage for library and C API" |
|
28 @echo " dist to create a \"dist\" directory with archived docs for download" |
|
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..."; \ |
|
37 svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ |
|
38 fi |
|
39 @if [ ! -d tools/jinja ]; then \ |
|
40 echo "Checking out Jinja..."; \ |
|
41 svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \ |
|
42 fi |
|
43 @if [ ! -d tools/pygments ]; then \ |
|
44 echo "Checking out Pygments..."; \ |
|
45 svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \ |
|
46 fi |
|
47 |
|
48 update: checkout |
|
49 svn update tools/sphinx |
|
50 svn update tools/docutils |
|
51 svn update tools/jinja |
|
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 |
|
63 htmlhelp: BUILDER = htmlhelp |
|
64 htmlhelp: build |
|
65 @echo "Build finished; now you can run HTML Help Workshop with the" \ |
|
66 "build/htmlhelp/pydoc.hhp project file." |
|
67 |
|
68 latex: BUILDER = latex |
|
69 latex: build |
|
70 @echo "Build finished; the LaTeX files are in build/latex." |
|
71 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
|
72 "run these through (pdf)latex." |
|
73 |
|
74 text: BUILDER = text |
|
75 text: build |
|
76 @echo "Build finished; the text files are in build/text." |
|
77 |
|
78 changes: BUILDER = changes |
|
79 changes: build |
|
80 @echo "The overview file is in build/changes." |
|
81 |
|
82 linkcheck: BUILDER = linkcheck |
|
83 linkcheck: build |
|
84 @echo "Link check complete; look for any errors in the above output " \ |
|
85 "or in build/$(BUILDER)/output.txt" |
|
86 |
|
87 coverage: BUILDER = coverage |
|
88 coverage: build |
|
89 @echo "Coverage finished; see c.txt and python.txt in build/coverage" |
|
90 |
|
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 |
|
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 |
|
101 htmlview: html |
|
102 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" |
|
103 |
|
104 clean: |
|
105 -rm -rf build/* |
|
106 -rm -rf tools/sphinx |
|
107 |
|
108 dist: |
|
109 -rm -rf dist |
|
110 mkdir -p dist |
|
111 |
|
112 # archive the HTML |
|
113 make html |
|
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 |
|
120 |
|
121 # archive the text build |
|
122 make text |
|
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 |
|
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) |
|
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 |
|
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) |
|
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 |
|
143 |