blob: 0cbd93f5b3fa93041caced254f163724d1c80298 [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 =
Georg Brandl116aa622007-08-15 14:28:22 +000012
Christian Heimes2c181612007-12-17 20:04:13 +000013ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
Christian Heimesfe337bf2008-03-23 21:54:12 +000014 $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
Georg Brandl116aa622007-08-15 14:28:22 +000015
Christian Heimesd3eb5a152008-02-24 00:38:49 +000016.PHONY: help checkout update build html web htmlhelp clean coverage
Georg Brandl116aa622007-08-15 14:28:22 +000017
18help:
19 @echo "Please use \`make <target>' where <target> is one of"
Christian Heimes292d3512008-02-03 16:51:08 +000020 @echo " html to make standalone HTML files"
21 @echo " web to make file usable by Sphinx.web"
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 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"
Georg Brandl116aa622007-08-15 14:28:22 +000028
29checkout:
30 @if [ ! -d tools/sphinx ]; then \
31 echo "Checking out Sphinx..."; \
32 svn checkout $(SVNROOT)/doctools/trunk/sphinx tools/sphinx; \
33 fi
34 @if [ ! -d tools/docutils ]; then \
35 echo "Checking out Docutils..."; \
Benjamin Peterson41181742008-07-02 20:22:54 +000036 svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \
Georg Brandl116aa622007-08-15 14:28:22 +000037 fi
Benjamin Petersond8607622008-04-13 23:11:15 +000038 @if [ ! -d tools/jinja ]; then \
39 echo "Checking out Jinja..."; \
Benjamin Peterson41181742008-07-02 20:22:54 +000040 svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \
Benjamin Petersond8607622008-04-13 23:11:15 +000041 fi
Georg Brandl116aa622007-08-15 14:28:22 +000042 @if [ ! -d tools/pygments ]; then \
43 echo "Checking out Pygments..."; \
Georg Brandl617027f2008-09-09 19:14:12 +000044 svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \
Georg Brandl116aa622007-08-15 14:28:22 +000045 fi
46
Thomas Woutersbca54802007-09-10 19:32:14 +000047update: checkout
Georg Brandl116aa622007-08-15 14:28:22 +000048 svn update tools/sphinx
49 svn update tools/docutils
Benjamin Petersond8607622008-04-13 23:11:15 +000050 svn update tools/jinja
Georg Brandl116aa622007-08-15 14:28:22 +000051 svn update tools/pygments
52
53build: checkout
54 mkdir -p build/$(BUILDER) build/doctrees
55 $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
56 @echo
57
58html: BUILDER = html
59html: build
60 @echo "Build finished. The HTML pages are in build/html."
61
62web: BUILDER = web
63web: build
64 @echo "Build finished; now you can run"
65 @echo " PYTHONPATH=tools $(PYTHON) -m sphinx.web build/web"
66 @echo "to start the server."
67
68htmlhelp: BUILDER = htmlhelp
69htmlhelp: build
70 @echo "Build finished; now you can run HTML Help Workshop with the" \
Guido van Rossumda27fd22007-08-17 00:24:54 +000071 "build/htmlhelp/pydoc.hhp project file."
Georg Brandl116aa622007-08-15 14:28:22 +000072
Christian Heimesd8654cf2007-12-02 15:22:16 +000073latex: BUILDER = latex
74latex: build
75 @echo "Build finished; the LaTeX files are in build/latex."
Christian Heimes2c181612007-12-17 20:04:13 +000076 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
77 "run these through (pdf)latex."
Christian Heimesd8654cf2007-12-02 15:22:16 +000078
Georg Brandl0c77a822008-06-10 16:37:50 +000079text: BUILDER = text
80text: build
81 @echo "Build finished; the text files are in build/text."
82
Christian Heimes5b5e81c2007-12-31 16:14:33 +000083changes: BUILDER = changes
84changes: build
85 @echo "The overview file is in build/changes."
86
Christian Heimes292d3512008-02-03 16:51:08 +000087linkcheck: BUILDER = linkcheck
88linkcheck: build
Christian Heimesd3eb5a152008-02-24 00:38:49 +000089 @echo "Link check complete; look for any errors in the above output " \
Christian Heimes292d3512008-02-03 16:51:08 +000090 "or in build/$(BUILDER)/output.txt"
91
Christian Heimesd3eb5a152008-02-24 00:38:49 +000092coverage: BUILDER = coverage
93coverage: build
94 @echo "Coverage finished; see c.txt and python.txt in build/coverage"
95
Christian Heimesfe337bf2008-03-23 21:54:12 +000096doctest: BUILDER = doctest
97doctest: build
98 @echo "Testing of doctests in the sources finished, look at the " \
99 "results in build/doctest/output.txt"
100
Georg Brandl6b38daa2008-06-01 21:05:17 +0000101pydoc-topics: BUILDER = pydoc-topics
102pydoc-topics: build
103 @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \
104 "into the Lib/ directory"
105
Benjamin Peterson41181742008-07-02 20:22:54 +0000106htmlview: html
107 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
Georg Brandl116aa622007-08-15 14:28:22 +0000108clean:
109 -rm -rf build/*
110 -rm -rf tools/sphinx