/Doc/Makefile

http://unladen-swallow.googlecode.com/ · Makefile · 152 lines · 117 code · 25 blank · 10 comment · 10 complexity · 0d6c374bf91bc421dedff1b14cb703b7 MD5 · raw file

  1. #
  2. # Makefile for Python documentation
  3. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. #
  5. # You can set these variables from the command line.
  6. PYTHON = python
  7. SVNROOT = http://svn.python.org/projects
  8. SPHINXOPTS =
  9. PAPER =
  10. SOURCES =
  11. DISTVERSION = $(shell $(PYTHON) tools/sphinxext/patchlevel.py)
  12. ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
  13. $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
  14. .PHONY: help checkout update build html htmlhelp clean coverage dist check
  15. help:
  16. @echo "Please use \`make <target>' where <target> is one of"
  17. @echo " html to make standalone HTML files"
  18. @echo " htmlhelp to make HTML files and a HTML help project"
  19. @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
  20. @echo " text to make plain text files"
  21. @echo " changes to make an overview over all changed/added/deprecated items"
  22. @echo " linkcheck to check all external links for integrity"
  23. @echo " suspicious to check for suspicious markup in output text"
  24. @echo " coverage to check documentation coverage for library and C API"
  25. @echo " dist to create a \"dist\" directory with archived docs for download"
  26. # Note: if you update versions here, do the same in make.bat and README.txt
  27. checkout:
  28. @if [ ! -d tools/sphinx ]; then \
  29. echo "Checking out Sphinx..."; \
  30. svn checkout $(SVNROOT)/external/Sphinx-0.6.2/sphinx tools/sphinx; \
  31. fi
  32. @if [ ! -d tools/docutils ]; then \
  33. echo "Checking out Docutils..."; \
  34. svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \
  35. fi
  36. @if [ ! -d tools/jinja2 ]; then \
  37. echo "Checking out Jinja..."; \
  38. svn checkout $(SVNROOT)/external/Jinja-2.1.1/jinja2 tools/jinja2; \
  39. fi
  40. @if [ ! -d tools/pygments ]; then \
  41. echo "Checking out Pygments..."; \
  42. svn checkout $(SVNROOT)/external/Pygments-0.11.1/pygments tools/pygments; \
  43. fi
  44. update: checkout
  45. svn update tools/sphinx
  46. svn update tools/docutils
  47. svn update tools/jinja2
  48. svn update tools/pygments
  49. build: checkout
  50. mkdir -p build/$(BUILDER) build/doctrees
  51. $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
  52. @echo
  53. html: BUILDER = html
  54. html: build
  55. @echo "Build finished. The HTML pages are in build/html."
  56. htmlhelp: BUILDER = htmlhelp
  57. htmlhelp: build
  58. @echo "Build finished; now you can run HTML Help Workshop with the" \
  59. "build/htmlhelp/pydoc.hhp project file."
  60. latex: BUILDER = latex
  61. latex: build
  62. @echo "Build finished; the LaTeX files are in build/latex."
  63. @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
  64. "run these through (pdf)latex."
  65. text: BUILDER = text
  66. text: build
  67. @echo "Build finished; the text files are in build/text."
  68. changes: BUILDER = changes
  69. changes: build
  70. @echo "The overview file is in build/changes."
  71. linkcheck: BUILDER = linkcheck
  72. linkcheck: build
  73. @echo "Link check complete; look for any errors in the above output " \
  74. "or in build/$(BUILDER)/output.txt"
  75. suspicious: BUILDER = suspicious
  76. suspicious: build
  77. @echo "Suspicious check complete; look for any errors in the above output " \
  78. "or in build/$(BUILDER)/suspicious.txt"
  79. coverage: BUILDER = coverage
  80. coverage: build
  81. @echo "Coverage finished; see c.txt and python.txt in build/coverage"
  82. doctest: BUILDER = doctest
  83. doctest: build
  84. @echo "Testing of doctests in the sources finished, look at the " \
  85. "results in build/doctest/output.txt"
  86. pydoc-topics: BUILDER = pydoc-topics
  87. pydoc-topics: build
  88. @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \
  89. "into the Lib/ directory"
  90. htmlview: html
  91. $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
  92. clean:
  93. -rm -rf build/*
  94. -rm -rf tools/sphinx
  95. dist:
  96. -rm -rf dist
  97. mkdir -p dist
  98. # archive the HTML
  99. make html
  100. cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
  101. tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
  102. bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar
  103. (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html)
  104. rm -r dist/python-$(DISTVERSION)-docs-html
  105. rm dist/python-$(DISTVERSION)-docs-html.tar
  106. # archive the text build
  107. make text
  108. cp -pPR build/text dist/python-$(DISTVERSION)-docs-text
  109. tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text
  110. bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar
  111. (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text)
  112. rm -r dist/python-$(DISTVERSION)-docs-text
  113. rm dist/python-$(DISTVERSION)-docs-text.tar
  114. # archive the A4 latex
  115. -rm -r build/latex
  116. make latex PAPER=a4
  117. (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
  118. cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
  119. cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
  120. # archive the letter latex
  121. rm -r build/latex
  122. make latex PAPER=letter
  123. (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
  124. cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
  125. cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
  126. check:
  127. $(PYTHON) tools/rstlint.py -i tools