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 = |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 12 | DISTVERSION = $(shell $(PYTHON) tools/sphinxext/patchlevel.py) |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 13 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 14 | ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ |
Georg Brandl | b98fe5a | 2008-03-22 10:58:38 +0000 | [diff] [blame] | 15 | $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 16 | |
Georg Brandl | 9f7a339 | 2009-01-03 20:30:15 +0000 | [diff] [blame] | 17 | .PHONY: help checkout update build html htmlhelp clean coverage dist check |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 18 | |
| 19 | help: |
| 20 | @echo "Please use \`make <target>' where <target> is one of" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 21 | @echo " html to make standalone HTML files" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 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 Brandl | 4f2c998 | 2008-06-01 16:41:31 +0000 | [diff] [blame] | 24 | @echo " text to make plain text files" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 25 | @echo " changes to make an overview over all changed/added/deprecated items" |
| 26 | @echo " linkcheck to check all external links for integrity" |
Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 27 | @echo " suspicious to check for suspicious markup in output text" |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 28 | @echo " coverage to check documentation coverage for library and C API" |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 29 | @echo " dist to create a \"dist\" directory with archived docs for download" |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 30 | |
| 31 | checkout: |
| 32 | @if [ ! -d tools/sphinx ]; then \ |
| 33 | echo "Checking out Sphinx..."; \ |
| 34 | svn checkout $(SVNROOT)/doctools/trunk/sphinx tools/sphinx; \ |
| 35 | fi |
| 36 | @if [ ! -d tools/docutils ]; then \ |
| 37 | echo "Checking out Docutils..."; \ |
Georg Brandl | aa7c8bd | 2008-06-26 21:12:55 +0000 | [diff] [blame] | 38 | svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 39 | fi |
Benjamin Peterson | d680d96 | 2009-01-04 22:00:18 +0000 | [diff] [blame] | 40 | @if [ ! -d tools/jinja2 ]; then \ |
Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 41 | echo "Checking out Jinja..."; \ |
Benjamin Peterson | d680d96 | 2009-01-04 22:00:18 +0000 | [diff] [blame] | 42 | svn checkout $(SVNROOT)/external/Jinja-2.1.1/jinja2 tools/jinja2; \ |
Georg Brandl | 8ffb573 | 2008-04-13 20:51:27 +0000 | [diff] [blame] | 43 | fi |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 44 | @if [ ! -d tools/pygments ]; then \ |
| 45 | echo "Checking out Pygments..."; \ |
Benjamin Peterson | 9ba7a30 | 2008-09-09 23:16:48 +0000 | [diff] [blame] | 46 | svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \ |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 47 | fi |
| 48 | |
Martin v. Löwis | 3994240 | 2007-09-10 13:19:10 +0000 | [diff] [blame] | 49 | update: checkout |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 50 | svn update tools/sphinx |
| 51 | svn update tools/docutils |
Benjamin Peterson | d680d96 | 2009-01-04 22:00:18 +0000 | [diff] [blame] | 52 | svn update tools/jinja2 |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 53 | svn update tools/pygments |
| 54 | |
| 55 | build: checkout |
| 56 | mkdir -p build/$(BUILDER) build/doctrees |
| 57 | $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS) |
| 58 | @echo |
| 59 | |
| 60 | html: BUILDER = html |
| 61 | html: build |
| 62 | @echo "Build finished. The HTML pages are in build/html." |
| 63 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 64 | htmlhelp: BUILDER = htmlhelp |
| 65 | htmlhelp: build |
| 66 | @echo "Build finished; now you can run HTML Help Workshop with the" \ |
Georg Brandl | 09a5c3e | 2007-08-15 18:30:42 +0000 | [diff] [blame] | 67 | "build/htmlhelp/pydoc.hhp project file." |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 68 | |
Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 69 | latex: BUILDER = latex |
| 70 | latex: build |
| 71 | @echo "Build finished; the LaTeX files are in build/latex." |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 72 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
| 73 | "run these through (pdf)latex." |
Georg Brandl | 584265b | 2007-12-02 14:58:50 +0000 | [diff] [blame] | 74 | |
Georg Brandl | 4f2c998 | 2008-06-01 16:41:31 +0000 | [diff] [blame] | 75 | text: BUILDER = text |
| 76 | text: build |
| 77 | @echo "Build finished; the text files are in build/text." |
| 78 | |
Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 79 | changes: BUILDER = changes |
| 80 | changes: build |
| 81 | @echo "The overview file is in build/changes." |
| 82 | |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 83 | linkcheck: BUILDER = linkcheck |
| 84 | linkcheck: build |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 85 | @echo "Link check complete; look for any errors in the above output " \ |
Georg Brandl | 7be67ff | 2008-02-01 19:24:01 +0000 | [diff] [blame] | 86 | "or in build/$(BUILDER)/output.txt" |
Georg Brandl | cd23527 | 2008-02-01 15:50:15 +0000 | [diff] [blame] | 87 | |
Georg Brandl | 700cf28 | 2009-01-04 10:23:49 +0000 | [diff] [blame] | 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" |
| 92 | |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 93 | coverage: BUILDER = coverage |
| 94 | coverage: build |
| 95 | @echo "Coverage finished; see c.txt and python.txt in build/coverage" |
| 96 | |
Georg Brandl | 17baef0 | 2008-03-22 10:56:23 +0000 | [diff] [blame] | 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" |
| 101 | |
Georg Brandl | 681001e | 2008-06-01 20:33:55 +0000 | [diff] [blame] | 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" |
| 106 | |
Benjamin Peterson | b279b8a | 2008-06-26 21:23:30 +0000 | [diff] [blame] | 107 | htmlview: html |
| 108 | $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 109 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 110 | clean: |
| 111 | -rm -rf build/* |
| 112 | -rm -rf tools/sphinx |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 113 | |
| 114 | dist: |
| 115 | -rm -rf dist |
| 116 | mkdir -p dist |
| 117 | |
| 118 | # archive the HTML |
| 119 | make html |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 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 |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 126 | |
| 127 | # archive the text build |
| 128 | make text |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 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 |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 135 | |
| 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) |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 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 |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 142 | |
| 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) |
Benjamin Peterson | f281ff8 | 2008-12-21 21:00:53 +0000 | [diff] [blame] | 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 |
Georg Brandl | 267acd2 | 2008-09-21 10:03:39 +0000 | [diff] [blame] | 149 | |
Georg Brandl | 9f7a339 | 2009-01-03 20:30:15 +0000 | [diff] [blame] | 150 | check: |
Georg Brandl | 3b62c2f | 2009-01-03 21:11:58 +0000 | [diff] [blame] | 151 | $(PYTHON) tools/rstlint.py -i tools |