Makefile 13.2 KB
Newer Older
1 2 3
# Makefile for Python documentation
# ---------------------------------
#
4 5
# See also the README file.
#
6
# This is a bit of a mess.  The documents are identified by short names:
7
#   api -- Python/C API Reference Manual
8
#   doc -- Documenting Python
9 10
#   ext -- Extending and Embedding the Python Interpreter
#   lib -- Library Reference Manual
11
#   mac -- Macintosh Library Modules
12
#   ref -- Python Reference Manual
13
#   tut -- Python Tutorial
14 15
#   inst -- Installing Python Modules
#   dist -- Distributing Python Modules
16
#
17
# The LaTeX sources for each of these documents are in subdirectories
18
# with the three-letter designations above as the directory names.
19
#
20 21 22
# The main target creates HTML for each of the documents.  You can
# also do "make lib" (etc.) to create the HTML versions of individual
# documents.
23
#
24 25 26
# The document classes and styles are in the texinputs/ directory.
# These define a number of macros that are similar in name and intent
# as macros in Texinfo (e.g. \code{...} and \emph{...}), as well as a
27
# number of environments for formatting function and data definitions.
28 29 30
# Documentation for the macros is included in "Documenting Python"; see
# http://www.python.org/doc/current/doc/doc.html, or the sources for
# this document in the doc/ directory.
31
#
32 33
# Everything is processed by LaTeX.  See the file `README' for more
# information on the tools needed for processing.
34 35 36 37 38 39 40 41
#
# There's a problem with generating the index which has been solved by
# a sed command applied to the index file.  The shell script fix_hack
# does this (the Makefile takes care of calling it).
#
# Additional targets attempt to convert selected LaTeX sources to
# various other formats.  These are generally site specific because
# the tools used are all but universal.  These targets are:
42
#
43 44
#   ps  -- convert all documents from LaTeX to PostScript
#   pdf -- convert all documents from LaTeX to the
45
#		Portable Document Format
46
#
47
# See the README file for more information on these targets.
48 49 50
#
# The formatted output is located in subdirectories.  For PDF and
# PostScript, look in the paper-$(PAPER)/ directory.  For HTML, look in
51
# the html/ directory.  If you want to fix the GNU info process, look
52
# in the info/ directory; please send patches to python-docs@python.org.
53

54 55 56
# This Makefile only includes information on how to perform builds; for
# dependency information, see Makefile.deps.

57
# Customization -- you *may* have to edit this
58

59
# You could set this to a4:
60 61
PAPER=letter

62
# Ideally, you shouldn't need to edit beyond this point
63

64
HTMLDIR=	html
Fred Drake's avatar
Fred Drake committed
65
INFODIR=	info
66
TOOLSDIR=	tools
67

68 69
# This is the *documentation* release, and is used to construct the file
# names of the downloadable tarballs.
70
RELEASE=2.1b1
71

72 73 74
PYTHON=	   python
DVIPS=	   dvips -N0 -t $(PAPER)

75 76
MKDVI=	   ../tools/mkhowto --paper=$(PAPER) --dvi
MKHTML=	   tools/mkhowto --html --about html/stdabout.dat \
77 78 79
		--address $(PYTHONDOCS) --up-link ../index.html \
		--up-title "Python Documentation Index" \
		--global-module-index "../modindex.html"
80 81
MKPDF=	   ../tools/mkhowto --paper=$(PAPER) --pdf
MKPS=	   ../tools/mkhowto --paper=$(PAPER) --ps
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

BUILDINDEX=$(TOOLSDIR)/buildindex.py

PYTHONDOCS='See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.'
HTMLBASE=  file:`pwd`

# what's what
MANDVIFILES=	paper-$(PAPER)/api.dvi paper-$(PAPER)/ext.dvi \
		paper-$(PAPER)/lib.dvi paper-$(PAPER)/mac.dvi \
		paper-$(PAPER)/ref.dvi paper-$(PAPER)/tut.dvi
HOWTODVIFILES=	paper-$(PAPER)/doc.dvi paper-$(PAPER)/inst.dvi \
		paper-$(PAPER)/dist.dvi

MANPDFFILES=	paper-$(PAPER)/api.pdf paper-$(PAPER)/ext.pdf \
		paper-$(PAPER)/lib.pdf paper-$(PAPER)/mac.pdf \
		paper-$(PAPER)/ref.pdf paper-$(PAPER)/tut.pdf
HOWTOPDFFILES=	paper-$(PAPER)/doc.pdf paper-$(PAPER)/inst.pdf \
		paper-$(PAPER)/dist.pdf

MANPSFILES=	paper-$(PAPER)/api.ps paper-$(PAPER)/ext.ps \
		paper-$(PAPER)/lib.ps paper-$(PAPER)/mac.ps \
		paper-$(PAPER)/ref.ps paper-$(PAPER)/tut.ps
HOWTOPSFILES=	paper-$(PAPER)/doc.ps paper-$(PAPER)/inst.ps \
		paper-$(PAPER)/dist.ps

DVIFILES=	$(MANDVIFILES) $(HOWTODVIFILES)
PDFFILES=	$(MANPDFFILES) $(HOWTOPDFFILES)
PSFILES=	$(MANPSFILES) $(HOWTOPSFILES)

INDEXFILES=html/api/api.html \
	html/doc/doc.html \
	html/ext/ext.html \
	html/lib/lib.html \
	html/mac/mac.html \
	html/ref/ref.html \
	html/tut/tut.html \
	html/inst/inst.html \
	html/dist/dist.html

COMMONPERL= perl/manual.perl perl/python.perl perl/l2hinit.perl

include Makefile.deps
Fred Drake's avatar
Fred Drake committed
124

125 126
# These must be declared phony since there
# are directories with matching names:
127
.PHONY: api doc ext lib mac ref tut inst dist
128
.PHONY: html info
129 130


131
# Main target
132
all:	html
133

134 135 136
dvi:	$(DVIFILES)
pdf:	$(PDFFILES)
ps:	$(PSFILES)
137

138
world:	ps pdf html distfiles
139

140

141 142
# Rules to build PostScript and PDF formats
.SUFFIXES: .dvi .ps
143

144 145
.dvi.ps:
	$(DVIPS) -o $@ $<
146

147

148 149 150 151
# Targets for each document:
# Python/C API Reference Manual
paper-$(PAPER)/api.dvi: paper-$(PAPER)/api.tex $(APIFILES)
	(cd paper-$(PAPER); $(MKDVI) api.tex)
152

153 154
paper-$(PAPER)/api.pdf: paper-$(PAPER)/api.tex $(APIFILES)
	(cd paper-$(PAPER); $(MKPDF) api.tex)
155

156 157
paper-$(PAPER)/api.tex: api/api.tex api/refcounts.dat tools/anno-api.py
	$(PYTHON) $(TOOLSDIR)/anno-api.py -o $@ api/api.tex
158

159 160 161
# Distributing Python Modules
paper-$(PAPER)/dist.dvi: $(DISTFILES)
	(cd paper-$(PAPER); $(MKDVI) ../dist/dist.tex)
162

163
paper-$(PAPER)/dist.pdf: $(DISTFILES)
164
	(cd paper-$(PAPER); $(MKPDF) ../dist/dist.tex)
165

166 167
# Documenting Python
paper-$(PAPER)/doc.dvi: $(DOCFILES)
168
	(cd paper-$(PAPER); $(MKDVI) ../doc/doc.tex)
169

170
paper-$(PAPER)/doc.pdf: $(DOCFILES)
171
	(cd paper-$(PAPER); $(MKPDF) ../doc/doc.tex)
172

173 174 175
# Extending and Embedding the Python Interpreter
paper-$(PAPER)/ext.dvi: $(EXTFILES)
	(cd paper-$(PAPER); $(MKDVI) ../ext/ext.tex)
176

177 178
paper-$(PAPER)/ext.pdf: $(EXTFILES)
	(cd paper-$(PAPER); $(MKPDF) ../ext/ext.tex)
179

180 181 182
# Installing Python Modules
paper-$(PAPER)/inst.dvi: $(INSTFILES)
	(cd paper-$(PAPER); $(MKDVI) ../inst/inst.tex)
183

184 185
paper-$(PAPER)/inst.pdf: $(INSTFILES)
	(cd paper-$(PAPER); $(MKPDF) ../inst/inst.tex)
186

187 188 189
# Python Library Reference
paper-$(PAPER)/lib.dvi: $(LIBFILES)
	(cd paper-$(PAPER); $(MKDVI) ../lib/lib.tex)
190

191 192
paper-$(PAPER)/lib.pdf: $(LIBFILES)
	(cd paper-$(PAPER); $(MKPDF) ../lib/lib.tex)
193

194 195 196
# Macintosh Library Modules
paper-$(PAPER)/mac.dvi: $(MACFILES)
	(cd paper-$(PAPER); $(MKDVI) ../mac/mac.tex)
197

198 199
paper-$(PAPER)/mac.pdf: $(MACFILES)
	(cd paper-$(PAPER); $(MKPDF) ../mac/mac.tex)
200

201 202 203
# Python Reference Manual
paper-$(PAPER)/ref.dvi: $(REFFILES)
	(cd paper-$(PAPER); $(MKDVI) ../ref/ref.tex)
204

205 206
paper-$(PAPER)/ref.pdf: $(REFFILES)
	(cd paper-$(PAPER); $(MKPDF) ../ref/ref.tex)
207

208 209 210
# Python Tutorial
paper-$(PAPER)/tut.dvi: $(TUTFILES)
	(cd paper-$(PAPER); $(MKDVI) ../tut/tut.tex)
211

212 213
paper-$(PAPER)/tut.pdf: $(TUTFILES)
	(cd paper-$(PAPER); $(MKPDF) ../tut/tut.tex)
214 215

# The remaining part of the Makefile is concerned with various
216
# conversions, as described above.  See also the README file.
217

Fred Drake's avatar
Fred Drake committed
218 219
info:
	(cd $(INFODIR); $(MAKE))
220

221 222
# Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
# HTML converter.  For more info on this program, see
223
# <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
224

225 226 227 228 229
# Note that LaTeX2HTML inserts references to an icons directory in
# each page that it generates.  I have placed a copy of this directory
# in the distribution to simplify the process of creating a
# self-contained HTML distribution; for this purpose I have also added
# a (trivial) index.html.  Change the definition of $ICONSERVER in
230
# perl/l2hinit.perl to use a different location for the icons directory.
231

232 233 234 235
# If you have the standard LaTeX2HTML icons installed, the versions shipped
# with this documentation should be stored in a separate directory and used
# instead.  The standard set does *not* include all the icons used in the
# Python documentation.
236

237
$(INDEXFILES): $(COMMONPERL) html/about.dat tools/node2label.pl
238

239 240
html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml
	$(TOOLSDIR)/mkackshtml --address $(PYTHONDOCS) \
241
		--output html/acks.html <ACKS
242

243 244
html/modindex.html: $(TOOLSDIR)/support.py $(TOOLSDIR)/mkmodindex
html/modindex.html: html/lib/lib.html html/mac/mac.html
245 246
	(cd html; \
	 ../$(TOOLSDIR)/mkmodindex --columns 4 --output modindex.html \
247
		--address $(PYTHONDOCS) \
248
		lib/modindex.html mac/modindex.html)
249

250
html:	$(INDEXFILES) html/index.html html/modindex.html html/acks.html
251

252 253
api html/api/api.html: $(APIFILES)
	$(MKHTML) --dir html/api api/api.tex
254

255 256
doc html/doc/doc.html: $(DOCFILES)
	$(MKHTML) --dir html/doc doc/doc.tex
257

258 259
ext html/ext/ext.html: $(EXTFILES)
	$(MKHTML) --dir html/ext ext/ext.tex
260

261 262
lib html/lib/lib.html: $(LIBFILES)
	$(MKHTML) --dir html/lib lib/lib.tex
263

264 265
mac html/mac/mac.html: $(MACFILES)
	$(MKHTML) --dir html/mac mac/mac.tex
266

267 268
ref html/ref/ref.html: $(REFFILES)
	$(MKHTML) --dir html/ref ref/ref.tex
269

270 271 272 273
tut html/tut/tut.html: $(TUTFILES)
	$(MKHTML) --dir html/tut --numeric --split 3 tut/tut.tex

inst html/inst/inst.html: $(INSTFILES) perl/distutils.perl
274
	$(MKHTML) --dir html/inst --split 4 inst/inst.tex
275 276

dist html/dist/dist.html: $(DISTFILES) perl/distutils.perl
277
	$(MKHTML) --dir html/dist --split 4 dist/dist.tex
278

279 280

# webchecker needs an extra flag to process the huge index from the libref
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
WEBCHECKER=$(PYTHON) ../Tools/webchecker/webchecker.py
HTMLBASE=  file:`pwd`/html

webcheck: html
	$(WEBCHECKER) $(HTMLBASE)/api/
	$(WEBCHECKER) $(HTMLBASE)/doc/
	$(WEBCHECKER) $(HTMLBASE)/ext/
	$(WEBCHECKER) -m290000 $(HTMLBASE)/lib/
	$(WEBCHECKER) $(HTMLBASE)/mac/
	$(WEBCHECKER) $(HTMLBASE)/ref/
	$(WEBCHECKER) $(HTMLBASE)/tut/
	$(WEBCHECKER) $(HTMLBASE)/dist/
	$(WEBCHECKER) $(HTMLBASE)/inst/

fastwebcheck: html
	$(WEBCHECKER) -x $(HTMLBASE)/api/
	$(WEBCHECKER) -x $(HTMLBASE)/doc/
	$(WEBCHECKER) -x $(HTMLBASE)/ext/
	$(WEBCHECKER) -x -m290000 $(HTMLBASE)/lib/
	$(WEBCHECKER) -x $(HTMLBASE)/mac/
	$(WEBCHECKER) -x $(HTMLBASE)/ref/
	$(WEBCHECKER) -x $(HTMLBASE)/tut/
	$(WEBCHECKER) -x $(HTMLBASE)/dist/
	$(WEBCHECKER) -x $(HTMLBASE)/inst/
305 306 307


# Release packaging targets:
308

309
paper-$(PAPER)/README: ps $(TOOLSDIR)/getpagecounts
310
	(cd paper-$(PAPER); ../$(TOOLSDIR)/getpagecounts >../$@)
311

312
info-$(RELEASE).tgz: info
313 314
	(cd $(INFODIR); tar cf - README python.dir python-???.info*) \
		| gzip -9 >$@
315

316 317 318 319
info-$(RELEASE).tar.bz2: info
	(cd $(INFODIR); tar cf - README python.dir python-???.info*) \
		| bzip2 -9 >$@

320
latex-$(RELEASE).tgz:
321
	$(TOOLSDIR)/mksourcepkg --gzip $(RELEASE)
322

323
latex-$(RELEASE).tar.bz2:
324
	$(TOOLSDIR)/mksourcepkg --bzip2 $(RELEASE)
325

326
latex-$(RELEASE).zip:
327
	rm -f $@
328
	$(TOOLSDIR)/mksourcepkg --zip $(RELEASE)
329

330
pdf-$(PAPER)-$(RELEASE).tgz: pdf
331
	(cd paper-$(PAPER); tar cf - *.pdf) | gzip -9 >$@
Fred Drake's avatar
Fred Drake committed
332

333 334 335
pdf-$(PAPER)-$(RELEASE).tar.bz2: pdf
	(cd paper-$(PAPER); tar cf - *.pdf) | bzip2 -9 >$@

336
pdf-$(PAPER)-$(RELEASE).zip: pdf
337 338
	rm -f $@
	(cd paper-$(PAPER); zip -q -9 ../$@ *.pdf)
339

340
postscript-$(PAPER)-$(RELEASE).tar.bz2: ps paper-$(PAPER)/README
341
	(cd paper-$(PAPER); tar cf - *.ps README) | bzip2 -9 >$@
Fred Drake's avatar
Fred Drake committed
342

343
postscript-$(PAPER)-$(RELEASE).tgz: ps paper-$(PAPER)/README
344
	(cd paper-$(PAPER); tar cf - *.ps README) | gzip -9 >$@
345

346
postscript-$(PAPER)-$(RELEASE).zip: ps paper-$(PAPER)/README
347 348
	rm -f $@
	(cd paper-$(PAPER); zip -q -9 ../$@ *.ps README)
349

350
html-$(RELEASE).tgz:	html
351
	(cd $(HTMLDIR); \
352
		tar cf - *.html */*.css */*.html */*.gif) \
353
		| gzip -9 >$@
Fred Drake's avatar
Fred Drake committed
354

355
html-$(RELEASE).tar.bz2:	html
356
	(cd $(HTMLDIR); \
357
		tar cf - *.html */*.css */*.html */*.gif) \
358 359
		| bzip2 -9 >$@

360
html-$(RELEASE).zip:	html
361 362
	rm -f $@
	(cd $(HTMLDIR); \
363
		zip -q -9 ../$@ *.html */*.css */*.html */*.gif)
364

365 366
# convenience targets:

367
tarhtml:	html-$(RELEASE).tgz
368
tarinfo:	info-$(RELEASE).tgz
369 370 371
tarps:		postscript-$(PAPER)-$(RELEASE).tgz
tarpdf:		pdf-$(PAPER)-$(RELEASE).tgz
tarlatex:	latex-$(RELEASE).tgz
372

373
tarballs:	tarpdf tarps tarhtml
374

375 376 377 378 379
ziphtml:	html-$(RELEASE).zip
zipps:		postscript-$(PAPER)-$(RELEASE).zip
zippdf:		pdf-$(PAPER)-$(RELEASE).zip
ziplatex:	latex-$(RELEASE).zip

380
zips:		zippdf zipps ziphtml
381

382 383 384 385 386 387
bziphtml:	html-$(RELEASE).tar.bz2
bzipinfo:	info-$(RELEASE).tar.bz2
bzipps:		postscript-$(PAPER)-$(RELEASE).tar.bz2
bzippdf:	pdf-$(PAPER)-$(RELEASE).tar.bz2
bziplatex:	latex-$(RELEASE).tar.bz2

388
bzips:		bzippdf bzipps bziphtml
389

390 391
distfiles:	tarballs zips bzips
	$(TOOLSDIR)/mksourcepkg --all $(RELEASE)
392

393 394 395

# Housekeeping targets

396
# Remove temporary files; all except the following:
397
# - sources: .tex, .bib, .sty, *.cls
Fred Drake's avatar
Fred Drake committed
398
# - useful results: .dvi, .pdf, .ps, .texi, .info
399
clean:
400
	(cd paper-$(PAPER); $(MAKE) clean)
401
	(cd $(INFODIR); $(MAKE) clean)
402

403
# Remove temporaries as well as final products
404
clobber:
405 406
	rm -f html-$(RELEASE).tgz info-$(RELEASE).tgz
	rm -f pdf-$(RELEASE).tgz postscript-$(RELEASE).tgz
407 408
	rm -f latex-$(RELEASE).tgz html-$(RELEASE).zip
	rm -f pdf-$(RELEASE).zip postscript-$(RELEASE).zip
409
	rm -f $(DVIFILES) $(PSFILES) $(PDFFILES)
410
	(cd $(INFODIR); $(MAKE) clobber)
411 412 413 414 415 416 417 418 419 420 421 422
	rm -rf html/index.html html/modindex.html html/acks.html
	rm -rf html/api/ html/doc/ html/ext/ html/lib/ html/mac/
	rm -rf html/ref/ html/tut/ html/inst/ html/dist/

realclean distclean:  clobber


# html/index.html is dependent on $(INDEXFILES) since we want the date
# on the front index to be updated whenever any of the child documents
# are updated and boilerplate.tex uses \today as the date.

# It's at the end of the file since it wedges font-lock in XEmacs.
423

424 425 426 427 428 429
BOILERPLATE=texinputs/boilerplate.tex
html/index.html: html/index.html.in $(BOILERPLATE) $(INDEXFILES)
	DATE=`grep '\\date{' $(BOILERPLATE) | sed 's/.*\\date{\(.*\)}.*$$/\1/'` ; \
	if [ "$$DATE" = '\today' ] ; then DATE=`date '+%B %e, %Y'`;fi;\
	sed -e "s/@DATE@/$$DATE/g" -e "s/@RELEASE@/$(RELEASE)/g" \
		$< >$@