Makefile 12.7 KB
Newer Older
Guido van Rossum's avatar
Guido van Rossum committed
1 2 3
# Makefile for Python documentation
# ---------------------------------
#
4 5
# See also the README file.
#
Guido van Rossum's avatar
Guido van Rossum committed
6
# This is a bit of a mess.  The main documents are:
Fred Drake's avatar
Fred Drake committed
7 8 9
#   api -- Python/C API Reference Manual
#   ext -- Extending and Embedding the Python Interpreter
#   lib -- Library Reference Manual
10
#   mac -- Macintosh Library Modules
Fred Drake's avatar
Fred Drake committed
11
#   ref -- Python Reference Manual
Fred Drake's avatar
Fred Drake committed
12
#   tut -- Python Tutorial
Guido van Rossum's avatar
Guido van Rossum committed
13
#
Fred Drake's avatar
Fred Drake committed
14 15
# The latex sources for each of these documents are in subdirectories
# with the three-letter designations above as the directory names.
16
#
Fred Drake's avatar
Fred Drake committed
17
# The main target creates DVI and PostScript for the main each of the
Fred Drake's avatar
Fred Drake committed
18 19
# documents.  You can also do "make lib" (etc.) to create the DVI and
# PostScript versions of individual documents.
Guido van Rossum's avatar
Guido van Rossum committed
20
#
Fred Drake's avatar
Fred Drake committed
21 22 23
# 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
Fred Drake's avatar
Fred Drake committed
24
# number of environments for formatting function and data definitions.
Guido van Rossum's avatar
Guido van Rossum committed
25
#
Fred Drake's avatar
Fred Drake committed
26 27
# Everything is processed by LaTeX.  See the file `README' for more
# information on the tools needed for processing.
Guido van Rossum's avatar
Guido van Rossum committed
28 29 30 31 32 33 34 35
#
# 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:
36 37
#
#   html -- convert all documents from LaTeX to HTML
Fred Drake's avatar
Fred Drake committed
38 39
#   pdf  -- convert all documents from LaTeX to the
#		Portable Document Format
40
#
Fred Drake's avatar
Fred Drake committed
41
# See the README file for more information on these targets.
Fred Drake's avatar
Fred Drake committed
42 43 44
#
# The formatted output is located in subdirectories.  For PDF and
# PostScript, look in the paper-$(PAPER)/ directory.  For HTML, look in
45 46
# the html/ directory.  If you want to fix the GNU info process, look
# in the info/ directory.
47 48 49

# Customizations -- you *may* have to edit these

Fred Drake's avatar
Fred Drake committed
50 51 52
# you could set this to a4
PAPER=letter

53
# Where are the various programs?
54 55
LATEX=		latex
PDFLATEX=	pdflatex
56
DVIPS=		dvips -N0
57
KPSEWHICH=	TEXINPUTS=$(TEXINPUTS) kpsewhich tex
58
MAKEINDEX=	makeindex -s $(srcdir)/texinputs/myindex.ist
Fred Drake's avatar
Fred Drake committed
59
ACROREAD=	acroread
60
L2HARGS=
Fred Drake's avatar
Fred Drake committed
61 62
# HTMLDIR should not be '.'!
HTMLDIR=	html
Fred Drake's avatar
Fred Drake committed
63
PYTHON=		python
64
WEBCHECKER=	$(PYTHON) $(srcdir)/../Tools/webchecker/webchecker.py
Guido van Rossum's avatar
Guido van Rossum committed
65

66 67 68
# Install destination -- not used now but might be useful some time...
DESTDIR=	/usr/local
LIBDESTDIR=	$DESTDIR/lib
69
LIBDEST=	$LIBDESTDIR/python$(VERSION)
70
DOCDESTDIR=	$LIBDEST/doc
Guido van Rossum's avatar
Guido van Rossum committed
71

Fred Drake's avatar
Fred Drake committed
72
INFODIR=	info
73 74 75

srcdir=.
VPATH=.
76

77
# Ideally, you shouldn't need to edit beyond this point
78

79
RELEASE=1.5.1
Fred Drake's avatar
Fred Drake committed
80 81
VERSION=1.5

82 83 84 85 86 87 88 89 90 91 92 93
MANDVIFILES=	api.dvi ext.dvi lib.dvi ref.dvi tut.dvi
HOWTODVIFILES=	mac.dvi

MANPDFFILES=	api.pdf ext.pdf lib.pdf ref.pdf tut.pdf
HOWTOPDFFILES=	mac.pdf

MANPSFILES=	api.ps ext.ps lib.ps ref.ps tut.ps
HOWTOPSFILES=	mac.ps

DVIFILES=	$(MANDVIFILES) $(HOWTODVIFILES)
PDFFILES=	$(MANPDFFILES) $(HOWTOPDFFILES)
PSFILES=	$(MANPSFILES) $(HOWTOPSFILES)
Fred Drake's avatar
Fred Drake committed
94

95
# Be careful when messing with this one!
Fred Drake's avatar
Fred Drake committed
96
TEXINPUTS=	.:../texinputs:
97 98

MKDVI=		TEXINPUTS=$(TEXINPUTS) $(srcdir)/tools/mkdvi.sh
99 100
MKHOWTO=	$(srcdir)/tools/mkhowto.sh --keep
MKHTML=		PAPER=$(PAPER) $(srcdir)/tools/mkhtml.sh
Fred Drake's avatar
Fred Drake committed
101
MKPDF=		TEXINPUTS=$(TEXINPUTS) $(srcdir)/tools/mkdvi.sh --pdf
102

Guido van Rossum's avatar
Guido van Rossum committed
103
# Main target
104
all:	ps
Fred Drake's avatar
Fred Drake committed
105

106
dvi:
Fred Drake's avatar
Fred Drake committed
107 108 109
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile do-dvi)
110

111
pdf:
Fred Drake's avatar
Fred Drake committed
112 113 114
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile do-pdf)
115

116
ps:
Fred Drake's avatar
Fred Drake committed
117 118 119
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile do-ps)
120

121
world:	ps pdf html tarballs
Fred Drake's avatar
Fred Drake committed
122 123 124


# Targets for each document:
125
.PHONY: api ext lib mac ref tut
Fred Drake's avatar
Fred Drake committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141

api:
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile api.ps)

ext:
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile ext.ps)

lib:
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile lib.ps)

142 143 144 145 146
mac:
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile mac.ps)

Fred Drake's avatar
Fred Drake committed
147 148 149 150 151 152 153 154 155 156 157 158
ref:
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile ref.ps)

tut:
	(cd paper-$(PAPER); \
		$(MAKE) srcdir=.. VPATH=.. TEXINPUTS=$(TEXINPUTS) \
		-f ../Makefile tut.ps)


# Internal targets:
Fred Drake's avatar
Fred Drake committed
159 160 161

do-dvi: $(DVIFILES)
do-pdf: $(PDFFILES)
162
do-ps:	$(PSFILES)
Fred Drake's avatar
Fred Drake committed
163 164

# This target gets both the PDF and PS files updated.
165 166 167
#
all-formats:  $(PSFILES) $(PDFFILES)

168

169
# Rules to build PostScript and PDF formats
Fred Drake's avatar
Fred Drake committed
170
.SUFFIXES: .dvi .ps .pdf
171 172

.dvi.ps:
173
	$(DVIPS) -o $@ $<
174

Fred Drake's avatar
Fred Drake committed
175 176
#.pdf.ps:
#	$(ACROREAD) -toPostScript $<
177

178

Guido van Rossum's avatar
Guido van Rossum committed
179
# Dependencies
Fred Drake's avatar
Fred Drake committed
180 181
# We really need some support of dependency generator for this...

182 183 184 185 186 187 188 189 190 191 192 193
COMMONSTYLES=texinputs/python.sty texinputs/pypaper.sty texinputs/myindex.ist
COMMONTEX=texinputs/copyright.tex texinputs/boilerplate.tex

MANSTYLES=texinputs/fncychap.sty texinputs/manual.cls $(COMMONSTYLES)
HOWTOSTYLES=texinputs/howto.cls $(COMMONSTYLES)


$(DVIFILES):	  tools/fix_hack tools/mkdvi.sh $(COMMONTEX)
$(PDFFILES):	  tools/fix_hack tools/mkdvi.sh $(COMMONTEX)

$(MANDVIFILES):	  $(MANSTYLES)
$(MANPDFFILES):	  $(MANSTYLES)
Fred Drake's avatar
Fred Drake committed
194

195 196
$(HOWTODVIFILES): tools/mkhowto.sh $(HOWTOSTYLES)
$(HOWTOPDFFILES): tools/mkhowto.sh $(HOWTOSTYLES)
197

198

Fred Drake's avatar
Fred Drake committed
199
REFFILES = ref/ref1.tex ref/ref2.tex ref/ref3.tex ref/ref4.tex \
Fred Drake's avatar
Fred Drake committed
200 201
	   ref/ref5.tex ref/ref6.tex ref/ref7.tex ref/ref8.tex \
	   ref/ref.tex
202

203
# LaTeX source files for the Python Library Reference
204
LIBFILES = lib/lib.tex \
205 206
    lib/libintro.tex lib/libobjs.tex lib/libstdtypes.tex lib/libexcs.tex \
    lib/libfuncs.tex lib/libpython.tex lib/libsys.tex lib/libtypes.tex \
207 208 209 210 211 212 213 214
    lib/libtraceback.tex lib/libpickle.tex lib/libshelve.tex \
    lib/libcopy.tex lib/libmarshal.tex lib/libimp.tex lib/libparser.tex \
    lib/libbltin.tex lib/libmain.tex lib/libstrings.tex lib/libstring.tex \
    lib/libregex.tex lib/libregsub.tex lib/libstruct.tex lib/libmisc.tex \
    lib/libmath.tex lib/librand.tex lib/libwhrandom.tex lib/libarray.tex \
    lib/liballos.tex lib/libos.tex lib/libtime.tex lib/libgetopt.tex \
    lib/libtempfile.tex lib/liberrno.tex lib/libsomeos.tex lib/libsignal.tex \
    lib/libsocket.tex lib/libselect.tex lib/libthread.tex lib/libunix.tex \
215
    lib/libposix.tex lib/libposixpath.tex lib/libpwd.tex lib/libgrp.tex \
216 217 218 219 220 221 222 223 224 225 226 227 228
    lib/libcrypt.tex lib/libdbm.tex lib/libgdbm.tex lib/libtermios.tex \
    lib/libfcntl.tex lib/libposixfile.tex lib/libsyslog.tex lib/libpdb.tex \
    lib/libprofile.tex lib/libwww.tex lib/libcgi.tex lib/liburllib.tex \
    lib/libhttplib.tex lib/libftplib.tex lib/libgopherlib.tex \
    lib/libnntplib.tex lib/liburlparse.tex lib/libhtmllib.tex \
    lib/libsgmllib.tex lib/librfc822.tex lib/libmimetools.tex \
    lib/libbinascii.tex lib/libmm.tex lib/libaudioop.tex lib/libimageop.tex \
    lib/libaifc.tex lib/libjpeg.tex lib/librgbimg.tex lib/libcrypto.tex \
    lib/libmd5.tex lib/libmpz.tex lib/librotor.tex lib/libstdwin.tex \
    lib/libsgi.tex lib/libal.tex lib/libcd.tex lib/libfl.tex lib/libfm.tex \
    lib/libgl.tex lib/libimgfile.tex lib/libsun.tex lib/libxdrlib.tex \
    lib/libimghdr.tex lib/librestricted.tex lib/librexec.tex \
    lib/libbastion.tex lib/libformatter.tex lib/liboperator.tex \
229 230
    lib/libsoundex.tex lib/libresource.tex lib/libstat.tex \
    lib/libstringio.tex lib/libtoken.tex \
231 232 233 234 235 236 237
    lib/libundoc.tex lib/libmailcap.tex lib/libglob.tex lib/libuser.tex \
    lib/libanydbm.tex lib/librandom.tex lib/libsite.tex lib/libwhichdb.tex \
    lib/libbase64.tex lib/libfnmatch.tex lib/libquopri.tex lib/libzlib.tex \
    lib/libsocksvr.tex lib/libmailbox.tex lib/libcommands.tex \
    lib/libcmath.tex lib/libgzip.tex lib/libpprint.tex \
    lib/libcode.tex lib/libmimify.tex lib/libre.tex lib/libuserdict.tex \
    lib/libdis.tex lib/libxmllib.tex lib/libqueue.tex lib/liblocale.tex \
238
    lib/libbasehttp.tex lib/libcopyreg.tex lib/libsymbol.tex \
239 240
    lib/libbinhex.tex lib/libuu.tex \
    lib/libsunaudio.tex lib/libfileinput.tex lib/libimaplib.tex \
241
    lib/libpoplib.tex lib/libcalendar.tex lib/libpopen2.tex \
242
    lib/libbisect.tex lib/libmimetypes.tex lib/libsmtplib.tex lib/libcmd.tex \
Fred Drake's avatar
Fred Drake committed
243
    lib/libmultifile.tex lib/libthreading.tex
244 245 246 247 248 249

# LaTeX source files for Macintosh Library Modules.
MACLIBFILES = mac/mac.tex mac/libmac.tex mac/libctb.tex mac/libmacconsole.tex \
    mac/libmacdnr.tex mac/libmacfs.tex mac/libmacos.tex mac/libmacostools.tex \
    mac/libmactcp.tex mac/libmacspeech.tex mac/libmacui.tex mac/libmacic.tex \
    mac/libframework.tex mac/libminiae.tex
250

251
# Python Library Reference
252
lib.dvi: tools/indfix.py $(LIBFILES)
253 254
	$(srcdir)/tools/newind.py >$*.ind
	$(srcdir)/tools/newind.py modindex >mod$*.ind
255
	TEXINPUTS=$(srcdir)/lib:$(TEXINPUTS) $(LATEX) $*
256
	$(MAKEINDEX) mod$*.idx
257
	$(srcdir)/tools/fix_hack $*.idx
258
	$(MAKEINDEX) $*.idx
259
	$(srcdir)/tools/indfix.py $*.ind
260
	TEXINPUTS=$(srcdir)/lib:$(TEXINPUTS) $(LATEX) $*
261

Fred Drake's avatar
Fred Drake committed
262 263 264 265 266 267 268 269
lib.pdf: tools/indfix.py $(LIBFILES)
	$(srcdir)/tools/newind.py >$*.ind
	$(srcdir)/tools/newind.py modindex >mod$*.ind
	TEXINPUTS=$(srcdir)/lib:$(TEXINPUTS) $(PDFLATEX) $*
	$(MAKEINDEX) mod$*.idx
	$(srcdir)/tools/fix_hack $*.idx
	$(MAKEINDEX) $*.idx
	$(srcdir)/tools/indfix.py $*.ind
270
	$(srcdir)/tools/toc2bkm.py $*
Fred Drake's avatar
Fred Drake committed
271 272
	TEXINPUTS=$(srcdir)/lib:$(TEXINPUTS) $(PDFLATEX) $*

273 274 275
# Python/C API Reference Manual
api.dvi: api/api.tex
	$(MKDVI) api
276

Fred Drake's avatar
Fred Drake committed
277 278 279
api.pdf: api/api.tex
	$(MKPDF) api

280 281 282 283
# Extending and Embedding the Python Interpreter
ext.dvi: ext/ext.tex
	$(MKDVI) ext

Fred Drake's avatar
Fred Drake committed
284 285 286
ext.pdf: ext/ext.tex
	$(MKPDF) ext

287
# Macintosh Library Modules
288
mac.dvi: $(MACLIBFILES)
289 290
	$(MKHOWTO) --dvi $(srcdir)/$*/$*.tex

291
mac.pdf: $(MACLIBFILES)
292 293
	$(MKHOWTO) --pdf $(srcdir)/$*/$*.tex

294
# Python Reference Manual
Fred Drake's avatar
Fred Drake committed
295
ref.dvi: $(REFFILES)
296 297
	$(MKDVI) ref

Fred Drake's avatar
Fred Drake committed
298 299 300
ref.pdf: $(REFFILES)
	$(MKPDF) ref

301 302 303
# Python Tutorial
tut.dvi: tut/tut.tex
	$(MKDVI) tut
304

Fred Drake's avatar
Fred Drake committed
305 306 307
tut.pdf: tut/tut.tex
	$(MKPDF) tut

Guido van Rossum's avatar
Guido van Rossum committed
308 309

# The remaining part of the Makefile is concerned with various
310
# conversions, as described above.  See also the README file.
Guido van Rossum's avatar
Guido van Rossum committed
311

Fred Drake's avatar
Fred Drake committed
312
.PHONY: html l2h info
313

Fred Drake's avatar
Fred Drake committed
314 315
info:
	(cd $(INFODIR); $(MAKE))
316

317 318
# Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
# HTML converter.  For more info on this program, see
Guido van Rossum's avatar
Guido van Rossum committed
319
# <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
320

321 322 323 324 325
# 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
326
# perl/l2hinit.perl to use a different location for the icons directory.
327

Fred Drake's avatar
Fred Drake committed
328
COMMONPERL=perl/manual.perl perl/python.perl
329

330
l2h html:
331 332
	(cd $(HTMLDIR); $(MAKE) TEXINPUTS=../paper-$(PAPER):../texinputs: \
		-f ../html/Makefile)
333

334
l2hapi: $(COMMONPERL)
Fred Drake's avatar
Fred Drake committed
335
	$(MKHTML) api $(L2HARGS)
336

337
l2hext: $(COMMONPERL)
Fred Drake's avatar
Fred Drake committed
338
	$(MKHTML) ext $(L2HARGS)
339

340
l2hlib: $(COMMONPERL) $(LIBFILES)
341 342
	$(srcdir)/tools/fix_libaux.sed <`$(KPSEWHICH) lib.aux` >lib1.aux
	mv lib1.aux `$(KPSEWHICH) lib.aux`
Fred Drake's avatar
Fred Drake committed
343
	$(MKHTML) lib $(L2HARGS)
344

345 346 347
l2hmac: $(COMMONPERL) $(MACLIBFILES)
	$(srcdir)/tools/mkhowto.sh --html $(srcdir)/mac/mac.tex

348
l2href: $(COMMONPERL)
Fred Drake's avatar
Fred Drake committed
349
	$(MKHTML) ref $(L2HARGS)
Guido van Rossum's avatar
Guido van Rossum committed
350

351
l2htut: $(COMMONPERL)
Fred Drake's avatar
Fred Drake committed
352
	$(MKHTML) tut $(L2HARGS)
353 354 355

# webchecker needs an extra flag to process the huge index from the libref
webcheck:
356 357 358 359 360 361
	$(WEBCHECKER) file:`pwd`/$(HTMLDIR)/api/
	$(WEBCHECKER) file:`pwd`/$(HTMLDIR)/ext/
	$(WEBCHECKER) -m290000 file:`pwd`/$(HTMLDIR)/lib/
	$(WEBCHECKER) file:`pwd`/$(HTMLDIR)/mac/
	$(WEBCHECKER) file:`pwd`/$(HTMLDIR)/ref/
	$(WEBCHECKER) file:`pwd`/$(HTMLDIR)/tut/
362

363
lib-info-$(RELEASE).tgz: info
Fred Drake's avatar
Fred Drake committed
364
	(cd $(INFODIR); tar cf - python-???.info*) | gzip -9 >$@
365

366
latex-$(RELEASE).tgz:
367
	$(srcdir)/tools/mktarball.sh $(RELEASE)
368

369
pdf-$(PAPER)-$(RELEASE).tgz: pdf
Fred Drake's avatar
Fred Drake committed
370
	(cd paper-$(PAPER); tar cf - $(PDFFILES)) | gzip -9 >$@
Fred Drake's avatar
Fred Drake committed
371

372
postscript-$(PAPER)-$(RELEASE).tgz: ps
Fred Drake's avatar
Fred Drake committed
373
	(cd paper-$(PAPER); tar cf - $(PSFILES)) | gzip -9 >$@
Fred Drake's avatar
Fred Drake committed
374

375 376
html-$(RELEASE).tgz:
	(cd $(HTMLDIR); tar cf - index.html ???/???.css ???/*.html */*.gif) \
377
		| gzip -9 >$@
Fred Drake's avatar
Fred Drake committed
378

379 380
# convenience targets:

381
tarhtml:  html-$(RELEASE).tgz
382

383
tarinfo:  lib-info-$(RELEASE).tgz
384

385
tarps:	postscript-$(PAPER)-$(RELEASE).tgz
Fred Drake's avatar
Fred Drake committed
386

387
tarpdf:	pdf-$(PAPER)-$(RELEASE).tgz
Fred Drake's avatar
Fred Drake committed
388

389
tarlatex: latex-$(RELEASE).tgz
390

Fred Drake's avatar
Fred Drake committed
391
tarballs:  tarpdf tarps tarhtml tarlatex
392

Guido van Rossum's avatar
Guido van Rossum committed
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); rm -f *~ *.aux *.idx *.ilg *.ind *.log *.toc *.bkm *.syn)
401
	(cd $(INFODIR); $(MAKE) clean)
Fred Drake's avatar
Fred Drake committed
402
	(cd $(HTMLDIR); rm -f @webchecker.pickle)
403 404 405
	rm -f html-$(RELEASE).tgz info-$(RELEASE).tgz
	rm -f pdf-$(RELEASE).tgz postscript-$(RELEASE).tgz
	rm -f latex-$(RELEASE).tgz
406

407
l2hclean:
Fred Drake's avatar
Fred Drake committed
408
	(cd $(HTMLDIR); rm -rf api ext lib ref tut)
409

Guido van Rossum's avatar
Guido van Rossum committed
410
# Remove temporaries as well as final products
411
clobber: clean l2hclean
Fred Drake's avatar
Fred Drake committed
412
	(cd paper-$(PAPER); rm -f $(DVIFILES) $(PSFILES) $(PDFFILES))
413
	(cd $(INFODIR); $(MAKE) clobber)
414 415 416

realclean:  clobber
distclean:  clobber