blob: 9a3205800091b58808e9549378f06b5653ed6752 [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)
9# ref -- Language Reference (file ref.tex, inputs ref*.tex)
10# ext -- Extending and Embedding (file ext.tex)
11#
12# The main target "make all" creates DVI and PostScript for these
13# four. You can also do "make lib" (etc.) to process individual
14# documents.
15#
16# There's also:
17# qua -- Paper published in the CWI Quarterly (file qua.tex)
18#
19# There's one local style file: myformat.sty. This defines a number
20# of macros that are similar in name and intent as macros in Texinfo
21# (e.g. \code{...} and \emph{...}), as well as a number of
22# environments for formatting function and data definitions, also in
23# the style of Texinfo.
24#
25# Everything is processed by LaTeX. The following tools are used:
26# latex
27# makeindex
28# dvips
29# bibtex (only for formatting qua.tex)
30#
31# There's a problem with generating the index which has been solved by
32# a sed command applied to the index file. The shell script fix_hack
33# does this (the Makefile takes care of calling it).
34#
35# To preview the dvi files produced by LaTeX it would be useful to
36# have xdvi as well.
37#
38# Additional targets attempt to convert selected LaTeX sources to
39# various other formats. These are generally site specific because
40# the tools used are all but universal. These targets are:
41# l2h -- convert tut, ref, ext (but not lib!) from LaTeX to HTML
42# lib.texi -- convert lib from LaTeX to Texinfo
43# lib.info -- convert lib from Texinfo to Emacs INFO
44# libwww -- convert lib from Texinfo to HTML
Guido van Rossum73827c61995-03-20 13:00:32 +000045# See the README file for more info on these targets.
Guido van Rossume83e3801995-03-17 16:01:35 +000046
Guido van Rossum73827c61995-03-20 13:00:32 +000047# Customizations -- you *may* have to edit these
Guido van Rossume83e3801995-03-17 16:01:35 +000048
Guido van Rossum73827c61995-03-20 13:00:32 +000049# Where are the various programs?
50LATEX= latex
51BIBTEX= bibtex
52EMACS= emacs
53DVIPS= dvips -f
54MAKEINDEX= makeindex
55PYTHON= python
56MAKEINFO= makeinfo
57L2H= /ufs/guido/l2h/latex2html
58L2HARGS= -address $$USER@`domainname` -dont_include myformat
59
Guido van Rossumeb8d5031996-08-09 21:46:05 +000060# Destination directory for output of libwww target.
Fred Drakea39a25e1996-09-13 14:44:34 +000061PARTPARSE= $(PYTHON) ./partparse.pyc
Fred Drake5f2aa711996-10-09 19:33:17 +000062TEXI2HTMLFLAGS= -d
Fred Drakea39a25e1996-09-13 14:44:34 +000063TEXI2HTML= $(PYTHON) ./texi2html.pyc
Guido van Rossumeb8d5031996-08-09 21:46:05 +000064LIBHTMLDIR= ./python-lib
65
Guido van Rossum73827c61995-03-20 13:00:32 +000066# Install destination -- not used now but might be useful some time...
67DESTDIR= /usr/local
68LIBDESTDIR= $DESTDIR/lib
69LIBDEST= $LIBDESTDIR/python
70DOCDESTDIR= $LIBDEST/doc
71
72# Ideally, you shouldn't need to edit beyond this point
Guido van Rossum5b343731992-07-07 09:06:34 +000073
Guido van Rossume83e3801995-03-17 16:01:35 +000074# Main target
Guido van Rossumeb8d5031996-08-09 21:46:05 +000075all: all-ps
76
77all-dvi: tut.dvi lib.dvi ref.dvi ext.dvi
78all-ps: tut.ps lib.ps ref.ps ext.ps
Guido van Rossum20aca5a1991-01-25 13:29:04 +000079
Guido van Rossume83e3801995-03-17 16:01:35 +000080# Individual document fake targets
Guido van Rossumeb8d5031996-08-09 21:46:05 +000081tut: tut.ps
82lib: lib.ps
83ref: ref.ps
84ext: ext.ps
Guido van Rossum16d6e711994-08-08 12:30:22 +000085
Guido van Rossume83e3801995-03-17 16:01:35 +000086# CWI Quarterly document fake target
Guido van Rossumeb8d5031996-08-09 21:46:05 +000087qua: qua.ps
Guido van Rossume83e3801995-03-17 16:01:35 +000088
89# Dependencies
Guido van Rossum16d6e711994-08-08 12:30:22 +000090tut.dvi lib.dvi ref.dvi ext.dvi: myformat.sty fix_hack
91
Guido van Rossume83e3801995-03-17 16:01:35 +000092# Tutorial document
Guido van Rossum16d6e711994-08-08 12:30:22 +000093tut.dvi: tut.tex
Guido van Rossum73827c61995-03-20 13:00:32 +000094 $(LATEX) tut
95 $(LATEX) tut
Guido van Rossumeb8d5031996-08-09 21:46:05 +000096
97tut.ps: tut.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +000098 $(DVIPS) tut >tut.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +000099
Guido van Rossume83e3801995-03-17 16:01:35 +0000100# Reference document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000101ref.dvi: ref.tex ref1.tex ref2.tex ref3.tex ref4.tex ref5.tex ref6.tex \
102 ref7.tex ref8.tex
Guido van Rossumb83241c1992-03-06 10:56:42 +0000103 touch ref.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000104 $(LATEX) ref
Guido van Rossum4ac605e1992-12-17 15:31:02 +0000105 ./fix_hack ref.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000106 $(MAKEINDEX) ref
107 $(LATEX) ref
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000108
109ref.ps: ref.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000110 $(DVIPS) ref >ref.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +0000111
Guido van Rossum16d6e711994-08-08 12:30:22 +0000112# LaTeX source files for the Python Library Reference
113LIBFILES = lib.tex \
Guido van Rossum40006cf1996-08-19 22:58:03 +0000114 libintro.tex libobjs.tex libtypes.tex libexcs.tex libfuncs.tex \
115 libpython.tex libsys.tex libtypes2.tex libtraceback.tex libpickle.tex \
116 libshelve.tex libcopy.tex libmarshal.tex libimp.tex libparser.tex \
117 libbltin.tex libmain.tex libstrings.tex libstring.tex libregex.tex \
118 libregsub.tex libstruct.tex libmisc.tex libmath.tex librand.tex \
119 libwhrandom.tex libarray.tex liballos.tex libos.tex libtime.tex \
120 libgetopt.tex libtempfile.tex liberrno.tex libsomeos.tex libsignal.tex \
121 libsocket.tex libselect.tex libthread.tex libunix.tex libposix.tex \
122 libppath.tex libpwd.tex libgrp.tex libcrypt.tex libdbm.tex libgdbm.tex \
123 libtermios.tex libfcntl.tex libposixfile.tex libsyslog.tex libpdb.tex \
124 libprofile.tex libwww.tex libcgi.tex liburllib.tex libhttplib.tex \
125 libftplib.tex libgopherlib.tex libnntplib.tex liburlparse.tex \
126 libhtmllib.tex libsgmllib.tex librfc822.tex libmimetools.tex \
127 libbinascii.tex libmm.tex libaudioop.tex libimageop.tex libaifc.tex \
128 libjpeg.tex librgbimg.tex libcrypto.tex libmd5.tex libmpz.tex \
129 librotor.tex libmac.tex libctb.tex libmacconsole.tex libmacdnr.tex \
130 libmacfs.tex libmacos.tex libmacostools.tex libmactcp.tex \
131 libmacspeech.tex libmacui.tex libstdwin.tex libsgi.tex libal.tex \
132 libcd.tex libfl.tex libfm.tex libgl.tex libimgfile.tex libsun.tex \
Guido van Rossuma80c3981996-10-22 01:12:13 +0000133 libxdrlib.tex libimghdr.tex \
134 librestricted.tex librexec.tex libbastion.tex \
135 libformatter.tex
Guido van Rossum16d6e711994-08-08 12:30:22 +0000136
Guido van Rossume83e3801995-03-17 16:01:35 +0000137# Library document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000138lib.dvi: $(LIBFILES)
Guido van Rossumb83241c1992-03-06 10:56:42 +0000139 touch lib.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000140 $(LATEX) lib
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000141 ./fix_hack lib.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000142 $(MAKEINDEX) lib
143 $(LATEX) lib
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000144
145lib.ps: lib.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000146 $(DVIPS) lib >lib.ps
Guido van Rossuma52117e1991-11-21 13:54:36 +0000147
Guido van Rossume83e3801995-03-17 16:01:35 +0000148# Extensions document
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000149ext.dvi: ext.tex extref.tex
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000150 touch ext.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000151 $(LATEX) ext
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000152 ./fix_hack ext.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000153 $(MAKEINDEX) ext
154 $(LATEX) ext
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000155
156ext.ps: ext.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000157 $(DVIPS) ext >ext.ps
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000158
Guido van Rossume83e3801995-03-17 16:01:35 +0000159# Quarterly document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000160qua.dvi: qua.tex quabib.bib
Guido van Rossum73827c61995-03-20 13:00:32 +0000161 $(LATEX) qua
162 $(BIBTEX) qua
163 $(LATEX) qua
164 $(BIBTEX) qua
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000165
166qua.ps: qua.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000167 $(DVIPS) qua >qua.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +0000168
Guido van Rossume83e3801995-03-17 16:01:35 +0000169
170# The remaining part of the Makefile is concerned with various
Guido van Rossum73827c61995-03-20 13:00:32 +0000171# conversions, as described above. See also the README file.
Guido van Rossume83e3801995-03-17 16:01:35 +0000172
Fred Drakea39a25e1996-09-13 14:44:34 +0000173.SUFFIXES: .py .pyc
174
175.py.pyc:
176 $(PYTHON) -c "import $*"
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000177
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000178.PRECIOUS: lib.texi
179
Fred Drakea39a25e1996-09-13 14:44:34 +0000180lib.texi: lib*.tex texipre.dat texipost.dat partparse.pyc fix.el
181 $(PARTPARSE) -o @lib.texi `./whichlibs`
182 $(EMACS) -batch -l fix.el -f save-buffer -kill
183 mv @lib.texi lib.texi
184
Guido van Rossum6938f061994-08-01 12:22:53 +0000185python-lib.info: lib.texi
Guido van Rossum73827c61995-03-20 13:00:32 +0000186 -$(MAKEINFO) --footnote-style end --fill-column 72 \
187 --paragraph-indent 0 lib.texi
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000188
189lib.info: python-lib.info
190
Fred Drakea39a25e1996-09-13 14:44:34 +0000191libwww: lib.texi texi2html.pyc
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000192 if test ! -d $(LIBHTMLDIR); then mkdir $(LIBHTMLDIR); else true; fi
Fred Drake5f2aa711996-10-09 19:33:17 +0000193 $(TEXI2HTML) $(TEXI2HTMLFLAGS) lib.texi $(LIBHTMLDIR)
Guido van Rossum6938f061994-08-01 12:22:53 +0000194
Guido van Rossum73827c61995-03-20 13:00:32 +0000195# Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
196# HTML converter. For more info on this program, see
Guido van Rossume83e3801995-03-17 16:01:35 +0000197# <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
198# (I've had some trouble getting this to work with the netpbm version
199# of the pbmplus library; ppmtogif dumped core because giftopnm
200# outputs bitmap (pbm) files. I've fixed this by changing the source
201# of LaTeX2HTML to insert a call to pnmtoppm, which I wrote myself.
202# You can probably also use "pbmtopgm | pgmtoppm"...
203
204# In order to use these targets, you must edit the definition of L2H
Guido van Rossum73827c61995-03-20 13:00:32 +0000205# earlier in the Makefile to point to the latex2html program. Note
206# that LaTeX2HTML inserts references to an "icons" directory in each
207# page that it generates. You can customize where these icons are to
208# be found; I generally make it point to "../icons" and then create a
Guido van Rossume83e3801995-03-17 16:01:35 +0000209# symbolic link to the icons directory in the LaTeX2HTML source at the
210# appropriate place.
211
Guido van Rossum6938f061994-08-01 12:22:53 +0000212l2h: l2htut l2href l2hext
213
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000214l2htut: tut.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000215 $(L2H) $(L2HARGS) tut.tex
216 @rm -rf python-tut
217 mv tut python-tut
218
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000219l2href: ref.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000220 $(L2H) $(L2HARGS) ref.tex
221 @rm -rf python-ref
222 mv ref python-ref
223
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000224l2hext: ext.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000225 $(L2H) $(L2HARGS) ext.tex
226 @rm -rf python-ext
227 mv ext python-ext
Guido van Rossum970871f1993-02-21 20:10:26 +0000228
Guido van Rossume83e3801995-03-17 16:01:35 +0000229# This target doesn't quite work, since l2h doesn't understand the
230# funcdesc and similar environments, and turns them into GIF images.
231# Use the "libwww" target above instead.
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000232l2hlib: lib.dvi
Guido van Rossume83e3801995-03-17 16:01:35 +0000233 $(L2H) $(L2HARGS) lib.tex
234 @rm -rf python-lib
235 mv lib python-lib
236
237
238# Housekeeping targets
239
240# Remove temporary files
Guido van Rossum7f777ed1990-08-09 14:25:15 +0000241clean:
Guido van Rossum4ac605e1992-12-17 15:31:02 +0000242 rm -f @* *~ *.aux *.idx *.ilg *.ind *.log *.toc *.blg *.bbl *.pyc
Guido van Rossume83e3801995-03-17 16:01:35 +0000243 rm -f *.bak *.orig
Guido van Rossum5b343731992-07-07 09:06:34 +0000244 # Sources: .tex, .bib, .sty
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000245 # Useful results: .dvi, .ps, .texi, .info
Guido van Rossum5b343731992-07-07 09:06:34 +0000246
Guido van Rossume83e3801995-03-17 16:01:35 +0000247# Remove temporaries as well as final products
Guido van Rossum5b343731992-07-07 09:06:34 +0000248clobber: clean
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000249 rm -f *.dvi *.ps *.texi *.info *.info-[0-9]*