blob: b7f247c71d04b7f9ca3c739418da7235b29593e8 [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)
10#
Guido van Rossum1f175431996-10-22 20:00:02 +000011# The Reference Manual is now maintained as a FrameMaker document.
12# See the subdirectory ref; PostScript is included as ref/ref.ps.
13# (In the future, the Tutorial will also be converted to FrameMaker;
14# the other documents will be maintained in a text format such
15# as LaTeX or perhaps TIM.)
16#
Guido van Rossume83e3801995-03-17 16:01:35 +000017# The main target "make all" creates DVI and PostScript for these
18# four. You can also do "make lib" (etc.) to process individual
19# documents.
20#
21# There's also:
22# qua -- Paper published in the CWI Quarterly (file qua.tex)
23#
24# There's one local style file: myformat.sty. This defines a number
25# of macros that are similar in name and intent as macros in Texinfo
26# (e.g. \code{...} and \emph{...}), as well as a number of
27# environments for formatting function and data definitions, also in
28# the style of Texinfo.
29#
30# Everything is processed by LaTeX. The following tools are used:
31# latex
32# makeindex
33# dvips
34# bibtex (only for formatting qua.tex)
35#
36# There's a problem with generating the index which has been solved by
37# a sed command applied to the index file. The shell script fix_hack
38# does this (the Makefile takes care of calling it).
39#
40# To preview the dvi files produced by LaTeX it would be useful to
41# have xdvi as well.
42#
43# Additional targets attempt to convert selected LaTeX sources to
44# various other formats. These are generally site specific because
45# the tools used are all but universal. These targets are:
46# l2h -- convert tut, ref, ext (but not lib!) from LaTeX to HTML
47# lib.texi -- convert lib from LaTeX to Texinfo
48# lib.info -- convert lib from Texinfo to Emacs INFO
49# libwww -- convert lib from Texinfo to HTML
Guido van Rossum73827c61995-03-20 13:00:32 +000050# See the README file for more info on these targets.
Guido van Rossume83e3801995-03-17 16:01:35 +000051
Guido van Rossum73827c61995-03-20 13:00:32 +000052# Customizations -- you *may* have to edit these
Guido van Rossume83e3801995-03-17 16:01:35 +000053
Guido van Rossum73827c61995-03-20 13:00:32 +000054# Where are the various programs?
55LATEX= latex
56BIBTEX= bibtex
57EMACS= emacs
58DVIPS= dvips -f
59MAKEINDEX= makeindex
60PYTHON= python
61MAKEINFO= makeinfo
Fred Drakef93f1011996-10-29 16:07:46 +000062L2H= latex2html
63L2HARGS= -address $$USER@`domainname` -info ""
Guido van Rossum73827c61995-03-20 13:00:32 +000064
Guido van Rossumeb8d5031996-08-09 21:46:05 +000065# Destination directory for output of libwww target.
Fred Drakea39a25e1996-09-13 14:44:34 +000066PARTPARSE= $(PYTHON) ./partparse.pyc
Fred Drake5f2aa711996-10-09 19:33:17 +000067TEXI2HTMLFLAGS= -d
Fred Drakea39a25e1996-09-13 14:44:34 +000068TEXI2HTML= $(PYTHON) ./texi2html.pyc
Guido van Rossumeb8d5031996-08-09 21:46:05 +000069LIBHTMLDIR= ./python-lib
70
Guido van Rossum73827c61995-03-20 13:00:32 +000071# Install destination -- not used now but might be useful some time...
72DESTDIR= /usr/local
73LIBDESTDIR= $DESTDIR/lib
74LIBDEST= $LIBDESTDIR/python
75DOCDESTDIR= $LIBDEST/doc
76
77# Ideally, you shouldn't need to edit beyond this point
Guido van Rossum5b343731992-07-07 09:06:34 +000078
Guido van Rossume83e3801995-03-17 16:01:35 +000079# Main target
Guido van Rossumeb8d5031996-08-09 21:46:05 +000080all: all-ps
81
Guido van Rossum1f175431996-10-22 20:00:02 +000082all-dvi: tut.dvi lib.dvi ext.dvi
83all-ps: tut.ps lib.ps ext.ps
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 Rossum16d6e711994-08-08 12:30:22 +000089
Guido van Rossume83e3801995-03-17 16:01:35 +000090# CWI Quarterly document fake target
Guido van Rossumeb8d5031996-08-09 21:46:05 +000091qua: qua.ps
Guido van Rossume83e3801995-03-17 16:01:35 +000092
93# Dependencies
Guido van Rossum1f175431996-10-22 20:00:02 +000094tut.dvi lib.dvi ext.dvi: myformat.sty fix_hack
Guido van Rossum16d6e711994-08-08 12:30:22 +000095
Guido van Rossume83e3801995-03-17 16:01:35 +000096# Tutorial document
Guido van Rossum16d6e711994-08-08 12:30:22 +000097tut.dvi: tut.tex
Guido van Rossum73827c61995-03-20 13:00:32 +000098 $(LATEX) tut
99 $(LATEX) tut
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000100
101tut.ps: tut.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000102 $(DVIPS) tut >tut.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +0000103
Guido van Rossum16d6e711994-08-08 12:30:22 +0000104# LaTeX source files for the Python Library Reference
105LIBFILES = lib.tex \
Guido van Rossum40006cf1996-08-19 22:58:03 +0000106 libintro.tex libobjs.tex libtypes.tex libexcs.tex libfuncs.tex \
107 libpython.tex libsys.tex libtypes2.tex libtraceback.tex libpickle.tex \
108 libshelve.tex libcopy.tex libmarshal.tex libimp.tex libparser.tex \
109 libbltin.tex libmain.tex libstrings.tex libstring.tex libregex.tex \
110 libregsub.tex libstruct.tex libmisc.tex libmath.tex librand.tex \
111 libwhrandom.tex libarray.tex liballos.tex libos.tex libtime.tex \
112 libgetopt.tex libtempfile.tex liberrno.tex libsomeos.tex libsignal.tex \
113 libsocket.tex libselect.tex libthread.tex libunix.tex libposix.tex \
114 libppath.tex libpwd.tex libgrp.tex libcrypt.tex libdbm.tex libgdbm.tex \
115 libtermios.tex libfcntl.tex libposixfile.tex libsyslog.tex libpdb.tex \
116 libprofile.tex libwww.tex libcgi.tex liburllib.tex libhttplib.tex \
117 libftplib.tex libgopherlib.tex libnntplib.tex liburlparse.tex \
118 libhtmllib.tex libsgmllib.tex librfc822.tex libmimetools.tex \
119 libbinascii.tex libmm.tex libaudioop.tex libimageop.tex libaifc.tex \
120 libjpeg.tex librgbimg.tex libcrypto.tex libmd5.tex libmpz.tex \
121 librotor.tex libmac.tex libctb.tex libmacconsole.tex libmacdnr.tex \
122 libmacfs.tex libmacos.tex libmacostools.tex libmactcp.tex \
123 libmacspeech.tex libmacui.tex libstdwin.tex libsgi.tex libal.tex \
124 libcd.tex libfl.tex libfm.tex libgl.tex libimgfile.tex libsun.tex \
Guido van Rossuma80c3981996-10-22 01:12:13 +0000125 libxdrlib.tex libimghdr.tex \
126 librestricted.tex librexec.tex libbastion.tex \
127 libformatter.tex
Guido van Rossum16d6e711994-08-08 12:30:22 +0000128
Guido van Rossume83e3801995-03-17 16:01:35 +0000129# Library document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000130lib.dvi: $(LIBFILES)
Guido van Rossumb83241c1992-03-06 10:56:42 +0000131 touch lib.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000132 $(LATEX) lib
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000133 ./fix_hack lib.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000134 $(MAKEINDEX) lib
135 $(LATEX) lib
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000136
137lib.ps: lib.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000138 $(DVIPS) lib >lib.ps
Guido van Rossuma52117e1991-11-21 13:54:36 +0000139
Guido van Rossume83e3801995-03-17 16:01:35 +0000140# Extensions document
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000141ext.dvi: ext.tex extref.tex
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000142 touch ext.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000143 $(LATEX) ext
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000144 ./fix_hack ext.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000145 $(MAKEINDEX) ext
146 $(LATEX) ext
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000147
148ext.ps: ext.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000149 $(DVIPS) ext >ext.ps
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000150
Guido van Rossume83e3801995-03-17 16:01:35 +0000151# Quarterly document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000152qua.dvi: qua.tex quabib.bib
Guido van Rossum73827c61995-03-20 13:00:32 +0000153 $(LATEX) qua
154 $(BIBTEX) qua
155 $(LATEX) qua
156 $(BIBTEX) qua
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000157
158qua.ps: qua.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000159 $(DVIPS) qua >qua.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +0000160
Guido van Rossume83e3801995-03-17 16:01:35 +0000161
162# The remaining part of the Makefile is concerned with various
Guido van Rossum73827c61995-03-20 13:00:32 +0000163# conversions, as described above. See also the README file.
Guido van Rossume83e3801995-03-17 16:01:35 +0000164
Fred Drakea39a25e1996-09-13 14:44:34 +0000165.SUFFIXES: .py .pyc
166
167.py.pyc:
168 $(PYTHON) -c "import $*"
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000169
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000170.PRECIOUS: lib.texi
171
Fred Drakea39a25e1996-09-13 14:44:34 +0000172lib.texi: lib*.tex texipre.dat texipost.dat partparse.pyc fix.el
173 $(PARTPARSE) -o @lib.texi `./whichlibs`
174 $(EMACS) -batch -l fix.el -f save-buffer -kill
175 mv @lib.texi lib.texi
176
Guido van Rossum6938f061994-08-01 12:22:53 +0000177python-lib.info: lib.texi
Guido van Rossum73827c61995-03-20 13:00:32 +0000178 -$(MAKEINFO) --footnote-style end --fill-column 72 \
179 --paragraph-indent 0 lib.texi
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000180
181lib.info: python-lib.info
182
Fred Drakea39a25e1996-09-13 14:44:34 +0000183libwww: lib.texi texi2html.pyc
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000184 if test ! -d $(LIBHTMLDIR); then mkdir $(LIBHTMLDIR); else true; fi
Fred Drake5f2aa711996-10-09 19:33:17 +0000185 $(TEXI2HTML) $(TEXI2HTMLFLAGS) lib.texi $(LIBHTMLDIR)
Guido van Rossum6938f061994-08-01 12:22:53 +0000186
Guido van Rossum73827c61995-03-20 13:00:32 +0000187# Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
188# HTML converter. For more info on this program, see
Guido van Rossume83e3801995-03-17 16:01:35 +0000189# <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
190# (I've had some trouble getting this to work with the netpbm version
191# of the pbmplus library; ppmtogif dumped core because giftopnm
192# outputs bitmap (pbm) files. I've fixed this by changing the source
193# of LaTeX2HTML to insert a call to pnmtoppm, which I wrote myself.
194# You can probably also use "pbmtopgm | pgmtoppm"...
195
196# In order to use these targets, you must edit the definition of L2H
Guido van Rossum73827c61995-03-20 13:00:32 +0000197# earlier in the Makefile to point to the latex2html program. Note
198# that LaTeX2HTML inserts references to an "icons" directory in each
199# page that it generates. You can customize where these icons are to
200# be found; I generally make it point to "../icons" and then create a
Guido van Rossume83e3801995-03-17 16:01:35 +0000201# symbolic link to the icons directory in the LaTeX2HTML source at the
202# appropriate place.
203
Guido van Rossum6938f061994-08-01 12:22:53 +0000204l2h: l2htut l2href l2hext
205
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000206l2htut: tut.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000207 $(L2H) $(L2HARGS) tut.tex
208 @rm -rf python-tut
209 mv tut python-tut
210
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000211l2hext: ext.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000212 $(L2H) $(L2HARGS) ext.tex
213 @rm -rf python-ext
214 mv ext python-ext
Guido van Rossum970871f1993-02-21 20:10:26 +0000215
Guido van Rossume83e3801995-03-17 16:01:35 +0000216# This target doesn't quite work, since l2h doesn't understand the
217# funcdesc and similar environments, and turns them into GIF images.
218# Use the "libwww" target above instead.
Guido van Rossumf8daa4f1996-08-23 15:33:51 +0000219l2hlib: lib.dvi
Guido van Rossume83e3801995-03-17 16:01:35 +0000220 $(L2H) $(L2HARGS) lib.tex
221 @rm -rf python-lib
222 mv lib python-lib
223
224
225# Housekeeping targets
226
227# Remove temporary files
Guido van Rossum7f777ed1990-08-09 14:25:15 +0000228clean:
Guido van Rossum4ac605e1992-12-17 15:31:02 +0000229 rm -f @* *~ *.aux *.idx *.ilg *.ind *.log *.toc *.blg *.bbl *.pyc
Guido van Rossume83e3801995-03-17 16:01:35 +0000230 rm -f *.bak *.orig
Guido van Rossum5b343731992-07-07 09:06:34 +0000231 # Sources: .tex, .bib, .sty
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000232 # Useful results: .dvi, .ps, .texi, .info
Guido van Rossum5b343731992-07-07 09:06:34 +0000233
Guido van Rossume83e3801995-03-17 16:01:35 +0000234# Remove temporaries as well as final products
Guido van Rossum5b343731992-07-07 09:06:34 +0000235clobber: clean
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000236 rm -f *.dvi *.ps *.texi *.info *.info-[0-9]*