Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | # |
| 2 | # Makefile for Python documentation |
| 3 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4 | # |
| 5 | |
| 6 | # You can set these variables from the command line. |
Georg Brandl | 7094a0c | 2007-08-15 18:02:37 +0000 | [diff] [blame] | 7 | PYTHON = python |
| 8 | SVNROOT = http://svn.python.org/projects |
| 9 | SPHINXOPTS = |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 10 | PAPER = |
Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 11 | SOURCES = |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 12 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 13 | ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ |
Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 14 | $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 15 | |
Georg Brandl | 450a7f5 | 2008-09-21 07:36:22 +0000 | [diff] [blame^] | 16 | .PHONY: help checkout update build html htmlhelp clean coverage |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 17 | |
| 18 | help: |
| 19 | @echo "Please use \`make <target>' where <target> is one of" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 20 | @echo " html to make standalone HTML files" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 21 | @echo " htmlhelp to make HTML files and a HTML help project" |
| 22 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" |
Georg Brandl | 4f2c998 | 2008-06-01 16:41:31 +0000 | [diff] [blame] | 23 | @echo " text to make plain text files" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 24 | @echo " changes to make an overview over all changed/added/deprecated items" |
| 25 | @echo " linkcheck to check all external links for integrity" |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 26 | @echo " coverage to check documentation coverage for library and C API" |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 27 | |
| 28 | checkout: |
| 29 | @if [ ! -d tools/sphinx ]; then \ |
| 30 | echo "Checking out Sphinx..."; \ |
| 31 | svn checkout $(SVNROOT)/doctools/trunk/sphinx tools/sphinx; \ |
| 32 | fi |
| 33 | @if [ ! -d tools/docutils ]; then \ |
| 34 | echo "Checking out Docutils..."; \ |
Georg Brandl | aa7c8bd | 2008-06-26 21:12:55 +0000 | [diff] [blame] | 35 | svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 36 | fi |
Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 37 | @if [ ! -d tools/jinja ]; then \ |
| 38 | echo "Checking out Jinja..."; \ |
Georg Brandl | aa7c8bd | 2008-06-26 21:12:55 +0000 | [diff] [blame] | 39 | svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \ |
Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 40 | fi |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 41 | @if [ ! -d tools/pygments ]; then \ |
| 42 | echo "Checking out Pygments..."; \ |
Benjamin Peterson | 9ba7a30 | 2008-09-09 23:16:48 +0000 | [diff] [blame] | 43 | svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \ |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 44 | fi |
| 45 | |
Martin v. Löwis | 3994240 | 2007-09-10 13:19:10 +0000 | [diff] [blame] | 46 | update: checkout |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 47 | svn update tools/sphinx |
| 48 | svn update tools/docutils |
Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 49 | svn update tools/jinja |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 50 | svn update tools/pygments |
| 51 | |
| 52 | build: checkout |
| 53 | mkdir -p build/$(BUILDER) build/doctrees |
| 54 | $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS) |
| 55 | @echo |
| 56 | |
| 57 | html: BUILDER = html |
| 58 | html: build |
| 59 | @echo "Build finished. The HTML pages are in build/html." |
| 60 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 61 | htmlhelp: BUILDER = htmlhelp |
| 62 | htmlhelp: build |
| 63 | @echo "Build finished; now you can run HTML Help Workshop with the" \ |
Georg Brandl | 09a5c3e | 2007-08-15 18:30:42 +0000 | [diff] [blame] | 64 | "build/htmlhelp/pydoc.hhp project file." |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 65 | |
Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 66 | latex: BUILDER = latex |
| 67 | latex: build |
| 68 | @echo "Build finished; the LaTeX files are in build/latex." |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 69 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
| 70 | "run these through (pdf)latex." |
Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 71 | |
Georg Brandl | 4f2c998 | 2008-06-01 16:41:31 +0000 | [diff] [blame] | 72 | text: BUILDER = text |
| 73 | text: build |
| 74 | @echo "Build finished; the text files are in build/text." |
| 75 | |
Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 76 | changes: BUILDER = changes |
| 77 | changes: build |
| 78 | @echo "The overview file is in build/changes." |
| 79 | |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 80 | linkcheck: BUILDER = linkcheck |
| 81 | linkcheck: build |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 82 | @echo "Link check complete; look for any errors in the above output " \ |
Georg Brandl | 7be67ff | 2008-02-01 19:24:01 +0000 | [diff] [blame] | 83 | "or in build/$(BUILDER)/output.txt" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 84 | |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 85 | coverage: BUILDER = coverage |
| 86 | coverage: build |
| 87 | @echo "Coverage finished; see c.txt and python.txt in build/coverage" |
| 88 | |
Georg Brandl | 17baef0 | 2008-03-22 10:56:23 +0000 | [diff] [blame] | 89 | doctest: BUILDER = doctest |
| 90 | doctest: build |
| 91 | @echo "Testing of doctests in the sources finished, look at the " \ |
| 92 | "results in build/doctest/output.txt" |
| 93 | |
Georg Brandl | 681001e | 2008-06-01 20:33:55 +0000 | [diff] [blame] | 94 | pydoc-topics: BUILDER = pydoc-topics |
| 95 | pydoc-topics: build |
| 96 | @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ |
| 97 | "into the Lib/ directory" |
| 98 | |
Benjamin Peterson | b279b8a | 2008-06-26 21:23:30 +0000 | [diff] [blame] | 99 | htmlview: html |
| 100 | $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 101 | clean: |
| 102 | -rm -rf build/* |
| 103 | -rm -rf tools/sphinx |