-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
174 lines (147 loc) · 7.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Makefile for Sphinx documentation
#
export PYTHONPATH = $(shell echo "$$PYTHONPATH"):.
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) source
LATEXPATH = $${PATH}
LATEXEXE = xelatex
LATEXOPTS =
OUTPUTNAME=SupportingPython3
SPELL = aspell -l en_US
TODAY = $(shell date +%Y%m%d)
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " pdf to make a PDF"
@echo " epub to make an ePUB book"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub pages are in $(BUILDDIR)/epub."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
pdf: latex
# Copy in some custom files
cp source/_templates/sphinxcustom.cls $(BUILDDIR)/latex/sphinxcustom.cls
cp source/_templates/sphinx.sty $(BUILDDIR)/latex/sphinx.sty
cp source/_static/by-nc-sa.pdf $(BUILDDIR)/latex/by-nc-sa.pdf
# Run LaTeX three times, the first time generates the text:
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Create the indexes
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# Re run LaTex with indexes. Now we get a content listing and an index.
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Recreate the index since all the page numbers changed when the content listing appeared.
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# And run LaTex again, this time with correct page numbers
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
pdf-screen:
BOOK_SIZE=screen_form $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
# Copy in some custom files
cp source/_templates/sphinxcustom.cls $(BUILDDIR)/latex/sphinxcustom.cls
cp source/_templates/sphinx.sty $(BUILDDIR)/latex/sphinx.sty
cp source/_static/by-nc-sa.pdf $(BUILDDIR)/latex/by-nc-sa.pdf
# Run LaTeX three times, the first time generates the text:
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Create the indexes
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# Re run LaTex with indexes. Now we get a content listing and an index.
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Recreate the index since all the page numbers changed when the content listing appeared.
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# And run LaTex again, this time with correct page numbers
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
pdfunite covers/ScreenFront.pdf build/latex/SupportingPython3.pdf covers/ScreenBack.pdf build/SupportingPython3-screen-1.0-$(TODAY).pdf
pdf-phones:
BOOK_SIZE=phones_form $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
# Copy in some custom files
cp source/_templates/sphinxcustom.cls $(BUILDDIR)/latex/sphinxcustom.cls
cp source/_templates/sphinx.sty $(BUILDDIR)/latex/sphinx.sty
cp source/_static/by-nc-sa.pdf $(BUILDDIR)/latex/by-nc-sa.pdf
# Run LaTeX three times, the first time generates the text:
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Create the indexes
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# Re run LaTex with indexes. Now we get a content listing and an index.
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Recreate the index since all the page numbers changed when the content listing appeared.
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# And run LaTex again, this time with correct page numbers
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
pdfunite covers/PhoneFront.pdf build/latex/SupportingPython3.pdf covers/PhoneBack.pdf build/SupportingPython3-phone-1.0-$(TODAY).pdf
pdf-tablets:
BOOK_SIZE=tablets_form $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
# Copy in some custom files
cp source/_templates/sphinxcustom.cls $(BUILDDIR)/latex/sphinxcustom.cls
cp source/_templates/sphinx.sty $(BUILDDIR)/latex/sphinx.sty
cp source/_static/by-nc-sa.pdf $(BUILDDIR)/latex/by-nc-sa.pdf
# Run LaTeX three times, the first time generates the text:
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Create the indexes
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# Re run LaTex with indexes. Now we get a content listing and an index.
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
# Recreate the index since all the page numbers changed when the content listing appeared.
-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
# And run LaTex again, this time with correct page numbers
cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
pdfunite covers/TabletFront.pdf build/latex/SupportingPython3.pdf covers/TabletBack.pdf build/SupportingPython3-tablet-1.0-$(TODAY).pdf
# No support for book printing PDF's here. Talk to the author if you want to print books
#pdf-print:
#BOOK_SIZE=print_form $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
## Copy in some custom files
#cp source/_templates/sphinxcustom.cls $(BUILDDIR)/latex/sphinxcustom.cls
#cp source/_templates/sphinx.sty $(BUILDDIR)/latex/sphinx.sty
#cp source/_static/by-nc-sa.pdf $(BUILDDIR)/latex/by-nc-sa.pdf
## Run LaTeX three times, the first time generates the text:
#cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
## Create the indexes
#-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
## Re run LaTex with indexes. Now we get a content listing and an index.
#cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
## Recreate the index since all the page numbers changed when the content listing appeared.
#-cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) makeindex -s python.ist $(OUTPUTNAME).idx
## And run LaTex again, this time with correct page numbers
#cd $(BUILDDIR)/latex; PATH=$(LATEXPATH) $(LATEXEXE) $(LATEXOPTS) $(OUTPUTNAME).tex
#pdfunite covers/PrintFront.pdf build/latex/SupportingPython3.pdf covers/PrintBack.pdf build/SupportingPython3-print-1.0-$(TODAY).pdf
pdf-all: pdf-screen pdf-tablets pdf-phones
spell:
for f in source/*.rst; do $(SPELL) -c $$f; done
stats:
wc source/*.rst
test:
./runtests.sh
check: spell test stats