blob: 9a27a53c86aa0717112ed4e1a7db76ed6e14612b [file] [log] [blame]
Guido van Rossume83e3801995-03-17 16:01:35 +00001# Makefile for Python documentation
2# ---------------------------------
3#
Guido van Rossum73827c61995-03-20 13:00:32 +00004# See also the README file.
5#
Guido van Rossume83e3801995-03-17 16:01:35 +00006# This is a bit of a mess. The main documents are:
7# tut -- Tutorial (file tut.tex)
8# lib -- Library Reference (file lib.tex, inputs lib*.tex)
Guido van Rossume83e3801995-03-17 16:01:35 +00009# ext -- Extending and Embedding (file ext.tex)
Guido van Rossum9231c8f1997-05-15 21:43:21 +000010# api -- Python-C API Reference
Guido van Rossume83e3801995-03-17 16:01:35 +000011#
Guido van Rossum1f175431996-10-22 20:00:02 +000012# The Reference Manual is now maintained as a FrameMaker document.
13# See the subdirectory ref; PostScript is included as ref/ref.ps.
14# (In the future, the Tutorial will also be converted to FrameMaker;
15# the other documents will be maintained in a text format such
16# as LaTeX or perhaps TIM.)
17#
Guido van Rossume83e3801995-03-17 16:01:35 +000018# The main target "make all" creates DVI and PostScript for these
19# four. You can also do "make lib" (etc.) to process individual
20# documents.
21#
Guido van Rossume83e3801995-03-17 16:01:35 +000022# There's one local style file: myformat.sty. This defines a number
23# of macros that are similar in name and intent as macros in Texinfo
24# (e.g. \code{...} and \emph{...}), as well as a number of
25# environments for formatting function and data definitions, also in
26# the style of Texinfo.
27#
28# Everything is processed by LaTeX. The following tools are used:
29# latex
30# makeindex
31# dvips
Guido van Rossume83e3801995-03-17 16:01:35 +000032#
33# There's a problem with generating the index which has been solved by
34# a sed command applied to the index file. The shell script fix_hack
35# does this (the Makefile takes care of calling it).
36#
37# To preview the dvi files produced by LaTeX it would be useful to
38# have xdvi as well.
39#
40# Additional targets attempt to convert selected LaTeX sources to
41# various other formats. These are generally site specific because
42# the tools used are all but universal. These targets are:
Guido van Rossum9231c8f1997-05-15 21:43:21 +000043# l2h -- convert tut, lib, ext, api from LaTeX to HTML
Guido van Rossum73827c61995-03-20 13:00:32 +000044# See the README file for more info on these targets.
Guido van Rossume83e3801995-03-17 16:01:35 +000045
Guido van Rossum73827c61995-03-20 13:00:32 +000046# Customizations -- you *may* have to edit these
Guido van Rossume83e3801995-03-17 16:01:35 +000047
Guido van Rossum73827c61995-03-20 13:00:32 +000048# Where are the various programs?
49LATEX= latex
50BIBTEX= bibtex
Guido van Rossum5344d4f1997-10-05 18:51:02 +000051DVIPS= dvips -f -N0
Fred Drake126d8401998-02-04 19:54:40 +000052DISTILL= distill
Guido van Rossum73827c61995-03-20 13:00:32 +000053MAKEINDEX= makeindex
Fred Drakef93f1011996-10-29 16:07:46 +000054L2H= latex2html
Guido van Rossum0f280b61997-12-01 18:50:09 +000055L2HARGS= -address $$LOGNAME@`domainname`
Guido van Rossum73827c61995-03-20 13:00:32 +000056
57# Install destination -- not used now but might be useful some time...
58DESTDIR= /usr/local
59LIBDESTDIR= $DESTDIR/lib
60LIBDEST= $LIBDESTDIR/python
61DOCDESTDIR= $LIBDEST/doc
62
Fred Drake05dd3c01997-12-29 17:17:54 +000063# This is only used for .info generation:
64EMACS= emacs
65PYTHON= python
66MAKEINFO= makeinfo
Fred Drake6eab2fb1998-02-13 03:23:33 +000067PARTPARSEOBJ= partparse.pyc
68PARTPARSE= $(PYTHON) $(PARTPARSEOBJ)
Fred Drake05dd3c01997-12-29 17:17:54 +000069
Guido van Rossum73827c61995-03-20 13:00:32 +000070# Ideally, you shouldn't need to edit beyond this point
Guido van Rossum5b343731992-07-07 09:06:34 +000071
Fred Drake33d05b91998-01-13 16:33:09 +000072VERSION=1.5
73
Fred Drake04cf4dc1998-02-12 22:33:50 +000074DVIFILES= api.dvi ext.dvi lib.dvi tut.dvi
75PDFFILES= api.pdf ext.pdf lib.pdf tut.pdf
76PSFILES= api.ps ext.ps lib.ps tut.ps
77
Guido van Rossume83e3801995-03-17 16:01:35 +000078# Main target
Guido van Rossumeb8d5031996-08-09 21:46:05 +000079all: all-ps
80
Fred Drake04cf4dc1998-02-12 22:33:50 +000081all-dvi: $(DVIFILES)
82all-pdf: $(PDFFILES)
83all-ps: $(PSFILES)
Guido van Rossum20aca5a1991-01-25 13:29:04 +000084
Guido van Rossume83e3801995-03-17 16:01:35 +000085# Individual document fake targets
Guido van Rossumeb8d5031996-08-09 21:46:05 +000086tut: tut.ps
87lib: lib.ps
Guido van Rossumeb8d5031996-08-09 21:46:05 +000088ext: ext.ps
Guido van Rossum9231c8f1997-05-15 21:43:21 +000089api: api.ps
Guido van Rossume83e3801995-03-17 16:01:35 +000090
Fred Drake126d8401998-02-04 19:54:40 +000091# Rules to build PostScript and PDF formats
92.SUFFIXES: .dvi .ps .pdf
93
94.dvi.ps:
95 $(DVIPS) $< >$@
96
97.ps.pdf:
98 $(DISTILL) $<
99
Guido van Rossume83e3801995-03-17 16:01:35 +0000100# Dependencies
Fred Drake5d8f0ed1998-02-11 14:43:38 +0000101COMMONTEX=myformat.sty copyright.tex boilerplate.tex
102
103tut.dvi lib.dvi ext.dvi api.dvi: fix_hack $(COMMONTEX)
Guido van Rossum16d6e711994-08-08 12:30:22 +0000104
Guido van Rossume83e3801995-03-17 16:01:35 +0000105# Tutorial document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000106tut.dvi: tut.tex
Guido van Rossum73827c61995-03-20 13:00:32 +0000107 $(LATEX) tut
108 $(LATEX) tut
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000109
Guido van Rossum16d6e711994-08-08 12:30:22 +0000110# LaTeX source files for the Python Library Reference
111LIBFILES = lib.tex \
Guido van Rossum40006cf1996-08-19 22:58:03 +0000112 libintro.tex libobjs.tex libtypes.tex libexcs.tex libfuncs.tex \
113 libpython.tex libsys.tex libtypes2.tex libtraceback.tex libpickle.tex \
114 libshelve.tex libcopy.tex libmarshal.tex libimp.tex libparser.tex \
115 libbltin.tex libmain.tex libstrings.tex libstring.tex libregex.tex \
116 libregsub.tex libstruct.tex libmisc.tex libmath.tex librand.tex \
117 libwhrandom.tex libarray.tex liballos.tex libos.tex libtime.tex \
118 libgetopt.tex libtempfile.tex liberrno.tex libsomeos.tex libsignal.tex \
119 libsocket.tex libselect.tex libthread.tex libunix.tex libposix.tex \
120 libppath.tex libpwd.tex libgrp.tex libcrypt.tex libdbm.tex libgdbm.tex \
121 libtermios.tex libfcntl.tex libposixfile.tex libsyslog.tex libpdb.tex \
122 libprofile.tex libwww.tex libcgi.tex liburllib.tex libhttplib.tex \
123 libftplib.tex libgopherlib.tex libnntplib.tex liburlparse.tex \
124 libhtmllib.tex libsgmllib.tex librfc822.tex libmimetools.tex \
125 libbinascii.tex libmm.tex libaudioop.tex libimageop.tex libaifc.tex \
126 libjpeg.tex librgbimg.tex libcrypto.tex libmd5.tex libmpz.tex \
127 librotor.tex libmac.tex libctb.tex libmacconsole.tex libmacdnr.tex \
128 libmacfs.tex libmacos.tex libmacostools.tex libmactcp.tex \
129 libmacspeech.tex libmacui.tex libstdwin.tex libsgi.tex libal.tex \
130 libcd.tex libfl.tex libfm.tex libgl.tex libimgfile.tex libsun.tex \
Guido van Rossuma80c3981996-10-22 01:12:13 +0000131 libxdrlib.tex libimghdr.tex \
132 librestricted.tex librexec.tex libbastion.tex \
Guido van Rossum3dd68d31996-12-31 02:24:54 +0000133 libformatter.tex liboperator.tex libsoundex.tex libresource.tex \
Guido van Rossum7f3b0421997-03-27 14:56:18 +0000134 libstat.tex libstrio.tex libundoc.tex libmailcap.tex libglob.tex \
Guido van Rossume76b7a81997-04-27 21:25:52 +0000135 libuser.tex libanydbm.tex librandom.tex libsite.tex libwhichdb.tex \
Guido van Rossum41c302f1997-06-02 17:36:12 +0000136 libbase64.tex libfnmatch.tex libquopri.tex libzlib.tex libsocksvr.tex \
Fred Drake18600a41997-07-18 20:43:27 +0000137 libmailbox.tex libcommands.tex libcmath.tex libni.tex libgzip.tex \
Guido van Rossum36764b81997-08-30 20:02:25 +0000138 libpprint.tex libcode.tex libmimify.tex libre.tex libmacic.tex \
Guido van Rossum9cb64801997-12-29 20:01:55 +0000139 libuserdict.tex libdis.tex libxmllib.tex libqueue.tex \
Fred Drake251fed31998-01-21 04:59:44 +0000140 liblocale.tex libbasehttp.tex libcopyreg.tex
Guido van Rossum16d6e711994-08-08 12:30:22 +0000141
Guido van Rossume83e3801995-03-17 16:01:35 +0000142# Library document
Fred Drake4be00711998-02-09 22:18:42 +0000143lib.dvi: modindex.py indfix.py $(LIBFILES)
Guido van Rossumb83241c1992-03-06 10:56:42 +0000144 touch lib.ind
Fred Drake34252f91998-01-02 03:01:47 +0000145 touch modules.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000146 $(LATEX) lib
Fred Drake34252f91998-01-02 03:01:47 +0000147 ./modindex.py modules.idx
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000148 ./fix_hack lib.idx
Fred Drakeb4d4e251996-11-11 21:03:01 +0000149 $(MAKEINDEX) lib.idx
Fred Drake4be00711998-02-09 22:18:42 +0000150 ./indfix.py lib.ind
Fred Drake34252f91998-01-02 03:01:47 +0000151 ./modindex.py modules.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000152 $(LATEX) lib
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000153
Guido van Rossume83e3801995-03-17 16:01:35 +0000154# Extensions document
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000155ext.dvi: ext.tex
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000156 touch ext.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000157 $(LATEX) ext
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000158 ./fix_hack ext.idx
Fred Drakeb4d4e251996-11-11 21:03:01 +0000159 $(MAKEINDEX) ext.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000160 $(LATEX) ext
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000161
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000162# Python-C API document
163api.dvi: api.tex
164 touch api.ind
165 $(LATEX) api
166 ./fix_hack api.idx
167 $(MAKEINDEX) api.idx
168 $(LATEX) api
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000169
Guido van Rossume83e3801995-03-17 16:01:35 +0000170
171# The remaining part of the Makefile is concerned with various
Guido van Rossum73827c61995-03-20 13:00:32 +0000172# conversions, as described above. See also the README file.
Guido van Rossume83e3801995-03-17 16:01:35 +0000173
Fred Drake6eab2fb1998-02-13 03:23:33 +0000174.SUFFIXES: .py .pyc .pyo
175
176.py.pyo:
177 $(PYTHON) -O -c "import $*"
Fred Drake05dd3c01997-12-29 17:17:54 +0000178
179.py.pyc:
180 $(PYTHON) -c "import $*"
181
182.PRECIOUS: lib.texi
183
Fred Drake3d913ad1997-12-29 21:31:23 +0000184# The sed script in this target fixes a really nasty little condition in
185# libcgi.tex where \e has to be used in a group to get the right behavior,
186# and makeinfo can't handle a group with a leading @command. But at least
187# the info file gets generated.
188
Fred Drake6eab2fb1998-02-13 03:23:33 +0000189lib1.texi: lib*.tex texipre.dat texipost.dat $(PARTPARSEOBJ)
Fred Drake05dd3c01997-12-29 17:17:54 +0000190 $(PARTPARSE) -o lib1.texi `./whichlibs`
Fred Drake3d913ad1997-12-29 21:31:23 +0000191 sed 's/"{\\}n{\\}n/"\\n\\n/' lib1.texi >lib2.texi
192 mv lib2.texi lib1.texi
Fred Drake05dd3c01997-12-29 17:17:54 +0000193
194lib.texi: lib1.texi fix.el
195 $(EMACS) -batch -l fix.el -f save-buffer -kill
196 cp lib1.texi lib.texi
197
198python-lib.info: lib.texi
199 -$(MAKEINFO) --footnote-style end --fill-column 72 \
200 --paragraph-indent 0 lib.texi
201
Fred Drake13704a81997-12-29 22:04:44 +0000202# this is needed to prevent a second set of info files from being generated,
203# at least when using GNU make
204.PHONY: lib.info
205
Fred Drake05dd3c01997-12-29 17:17:54 +0000206lib.info: python-lib.info
207
Guido van Rossum73827c61995-03-20 13:00:32 +0000208# Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
209# HTML converter. For more info on this program, see
Guido van Rossume83e3801995-03-17 16:01:35 +0000210# <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
Guido van Rossume83e3801995-03-17 16:01:35 +0000211
Guido van Rossum9cb64801997-12-29 20:01:55 +0000212# Note that LaTeX2HTML inserts references to an icons directory in
213# each page that it generates. I have placed a copy of this directory
214# in the distribution to simplify the process of creating a
215# self-contained HTML distribution; for this purpose I have also added
216# a (trivial) index.html. Change the definition of $ICONSERVER in
217# .latex2html-init to use a different location for the icons directory.
Guido van Rossume83e3801995-03-17 16:01:35 +0000218
Guido van Rossum9cb64801997-12-29 20:01:55 +0000219# The sed hack rips out a superfluous comma which I haven't found the
220# source of. The prominent location makes it worth the extra step;
221# this affects the title pages!
Fred Drakefc8f6f31996-12-06 18:45:30 +0000222
Fred Drakebc0cd371997-07-30 15:59:25 +0000223l2h: l2htut l2hext l2hlib l2hapi
Guido van Rossum6938f061994-08-01 12:22:53 +0000224
Fred Drakeb4d4e251996-11-11 21:03:01 +0000225l2htut: tut.dvi myformat.perl
Guido van Rossum6938f061994-08-01 12:22:53 +0000226 $(L2H) $(L2HARGS) tut.tex
Fred Drakefc8f6f31996-12-06 18:45:30 +0000227 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
228 <tut/tut.html >tut/xxx
229 mv tut/xxx tut/tut.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000230 ln -s tut.html tut/index.html || true
Guido van Rossum6938f061994-08-01 12:22:53 +0000231
Fred Drakeb4d4e251996-11-11 21:03:01 +0000232l2hext: ext.dvi myformat.perl
Guido van Rossum6938f061994-08-01 12:22:53 +0000233 $(L2H) $(L2HARGS) ext.tex
Fred Drakefc8f6f31996-12-06 18:45:30 +0000234 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
235 <ext/ext.html >ext/xxx
236 mv ext/xxx ext/ext.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000237 ln -s ext.html ext/index.html || true
Guido van Rossum970871f1993-02-21 20:10:26 +0000238
Fred Drakeb4d4e251996-11-11 21:03:01 +0000239l2hlib: lib.dvi myformat.perl
Fred Drake03ff6f71997-08-22 18:18:54 +0000240 ./fix_libaux.sed <lib.aux >lib1.aux
241 mv lib1.aux lib.aux
Guido van Rossume83e3801995-03-17 16:01:35 +0000242 $(L2H) $(L2HARGS) lib.tex
Fred Drakef1e67071996-12-06 15:11:34 +0000243 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
244 <lib/lib.html >lib/xxx
245 mv lib/xxx lib/lib.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000246 ln -s lib.html lib/index.html || true
Guido van Rossume83e3801995-03-17 16:01:35 +0000247
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000248l2hapi: api.dvi myformat.perl
249 $(L2H) $(L2HARGS) api.tex
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000250 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
251 <api/api.html >api/xxx
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000252 mv api/xxx api/api.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000253 ln -s api.html api/index.html || true
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000254
Fred Drake04cf4dc1998-02-12 22:33:50 +0000255pdf-$(VERSION).tar.gz: $(PDFFILES)
256 tar cf - ???.pdf | gzip -9 >pdf-$(VERSION).tar.gz
257
258postscript-$(VERSION).tar.gz: $(PSFILES) ref/ref.ps
259 cp ref/ref.ps .
260 tar cf - ???.ps | gzip -9 >postscript-$(VERSION).tar.gz
261 rm ref.ps
262
Guido van Rossum330c6601997-11-26 15:31:32 +0000263tarhtml:
Guido van Rossum84cca441997-11-25 20:49:09 +0000264 @echo "Did you remember to run makeMIFs.py in the ref subdirectory...?"
Fred Drake33d05b91998-01-13 16:33:09 +0000265 tar cf - index.html ???/???.css ???/*.html lib/*.gif icons/*.* \
Fred Drake95810e41998-01-13 17:18:57 +0000266 | gzip -9 >html-$(VERSION).tar.gz
Fred Drake33d05b91998-01-13 16:33:09 +0000267
Fred Drake04cf4dc1998-02-12 22:33:50 +0000268tarps: postscript-$(VERSION).tar.gz
Fred Drake33d05b91998-01-13 16:33:09 +0000269
Fred Drake04cf4dc1998-02-12 22:33:50 +0000270tarpdf: pdf-$(VERSION).tar.gz
271
272tarballs: tarpdf tarps tarhtml
Guido van Rossum84cca441997-11-25 20:49:09 +0000273
Guido van Rossume83e3801995-03-17 16:01:35 +0000274
275# Housekeeping targets
276
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000277# Remove temporary files; all except the following:
278# - sources: .tex, .bib, .sty
Fred Drake04cf4dc1998-02-12 22:33:50 +0000279# - useful results: .dvi, .pdf, .ps, .texi, .info
Fred Drake03ff6f71997-08-22 18:18:54 +0000280clean: l2hclean
Fred Drake6eab2fb1998-02-13 03:23:33 +0000281 rm -f @* *~ *.aux *.idx *.ilg *.ind *.log *.toc *.blg *.bbl *.py[co]
Fred Drake04cf4dc1998-02-12 22:33:50 +0000282 rm -f *.bak *.orig lib1.texi
Fred Drake95810e41998-01-13 17:18:57 +0000283 rm -f html-$(VERSION).tar.gz postscript-$(VERSION).tar.gz
Fred Drake04cf4dc1998-02-12 22:33:50 +0000284 rm -f pdf-$(VERSION).tar.gz
Guido van Rossum5b343731992-07-07 09:06:34 +0000285
Fred Drake03ff6f71997-08-22 18:18:54 +0000286l2hclean:
Fred Drake5de31fc1997-08-22 18:20:33 +0000287 rm -rf api ext lib tut
Fred Drake03ff6f71997-08-22 18:18:54 +0000288
Guido van Rossume83e3801995-03-17 16:01:35 +0000289# Remove temporaries as well as final products
Guido van Rossum5b343731992-07-07 09:06:34 +0000290clobber: clean
Fred Drake6b7fc6f1998-02-04 20:33:13 +0000291 rm -f *.dvi *.pdf *.ps *.texi *.info *.info-[0-9]*