~bzr-pqm/bzr/bzr.dev

4557.3.1 by Ian Clatworthy
Core website & navigation working
1
# Makefile for Sphinx documentation
2
#
3
4
# You can set these variables from the command line.
5
SPHINXOPTS    =
6
SPHINXBUILD   = sphinx-build
7
PAPER         =
8
9
# Internal variables.
10
PAPEROPT_a4     = -D latex_paper_size=a4
11
PAPEROPT_letter = -D latex_paper_size=letter
12
ALLSPHINXOPTS   = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
13
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
14
# Note that this assumes name of the output dir is same as name of the rule.
15
define make_output_dirs
16
# Create output directory (only needed for sphinx < 0.5)
4797.44.7 by Michael Gliwinski
Avoid using 'mkdir -p' to create directories as it may not be portable.
17
[ -d _build ] || mkdir _build
18
[ -d "_build/$@" ] || mkdir "_build/$@"
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
19
# Workaround for a bug in sphinx < 0.5 where it tries to delete
20
# nonexistent static dirs and does not catch the exception.  This was
21
# fixed in svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
22
# at r65551 and merged as 280b62246342 in hg branch released as 0.5.
4797.44.7 by Michael Gliwinski
Avoid using 'mkdir -p' to create directories as it may not be portable.
23
[ -d "_build/$@/_static" ] || mkdir "_build/$@/_static"
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
24
for fn in _static/*; do \
4797.44.7 by Michael Gliwinski
Avoid using 'mkdir -p' to create directories as it may not be portable.
25
    [ ! -d "$$fn" ] && continue; \
26
    [ -d "_build/$@/$$fn" ] || mkdir "_build/$@/$$fn"; \
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
27
done
28
endef
29
4557.3.1 by Ian Clatworthy
Core website & navigation working
30
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
31
32
help:
33
	@echo "Please use \`make <target>' where <target> is one of"
34
	@echo "  html      to make standalone HTML files"
35
	@echo "  dirhtml   to make HTML files named index.html in directories"
36
	@echo "  pickle    to make pickle files"
37
	@echo "  json      to make JSON files"
38
	@echo "  htmlhelp  to make HTML files and a HTML help project"
39
	@echo "  qthelp    to make HTML files and a qthelp project"
40
	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
41
	@echo "  changes   to make an overview of all changed/added/deprecated items"
42
	@echo "  linkcheck to check all external links for integrity"
43
	@echo "  doctest   to run all doctests embedded in the documentation (if enabled)"
44
45
clean:
46
	-rm -rf _build/*
47
48
html:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
49
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
50
	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
51
	@echo
52
	@echo "Build finished. The HTML pages are in _build/html."
53
54
dirhtml:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
55
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
56
	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
57
	@echo
58
	@echo "Build finished. The HTML pages are in _build/dirhtml."
59
60
pickle:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
61
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
62
	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
63
	@echo
64
	@echo "Build finished; now you can process the pickle files."
65
66
json:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
67
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
68
	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
69
	@echo
70
	@echo "Build finished; now you can process the JSON files."
71
72
htmlhelp:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
73
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
74
	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
75
	@echo
76
	@echo "Build finished; now you can run HTML Help Workshop with the" \
77
	      ".hhp project file in _build/htmlhelp."
78
79
qthelp:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
80
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
81
	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
82
	@echo
83
	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
84
	      ".qhcp project file in _build/qthelp, like this:"
85
	@echo "# qcollectiongenerator _build/qthelp/Bazaar.qhcp"
86
	@echo "To view the help file:"
87
	@echo "# assistant -collectionFile _build/qthelp/Bazaar.qhc"
88
89
latex:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
90
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
91
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
92
	@echo
93
	@echo "Build finished; the LaTeX files are in _build/latex."
94
	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
95
	      "run these through (pdf)latex."
96
97
changes:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
98
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
99
	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
100
	@echo
101
	@echo "The overview file is in _build/changes."
102
103
linkcheck:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
104
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
105
	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
106
	@echo
107
	@echo "Link check complete; look for any errors in the above output " \
108
	      "or in _build/linkcheck/output.txt."
109
110
doctest:
4797.44.6 by Michael Gliwinski
Externalized workarounds into a canned command sequence so they can be used for other targets.
111
	$(make_output_dirs)
4557.3.1 by Ian Clatworthy
Core website & navigation working
112
	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
113
	@echo "Testing of doctests in the sources finished, look at the " \
114
	      "results in _build/doctest/output.txt."