blob: 72f580257128d8caca4986c0491fb24c5f10a821 [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
Guido van Rossum73827c61995-03-20 13:00:32 +000052MAKEINDEX= makeindex
Fred Drakef93f1011996-10-29 16:07:46 +000053L2H= latex2html
Guido van Rossum0f280b61997-12-01 18:50:09 +000054L2HARGS= -address $$LOGNAME@`domainname`
Guido van Rossum73827c61995-03-20 13:00:32 +000055
56# Install destination -- not used now but might be useful some time...
57DESTDIR= /usr/local
58LIBDESTDIR= $DESTDIR/lib
59LIBDEST= $LIBDESTDIR/python
60DOCDESTDIR= $LIBDEST/doc
61
Fred Drake05dd3c01997-12-29 17:17:54 +000062# This is only used for .info generation:
63EMACS= emacs
64PYTHON= python
65MAKEINFO= makeinfo
66PARTPARSE= $(PYTHON) ./partparse.pyc
67
Guido van Rossum73827c61995-03-20 13:00:32 +000068# Ideally, you shouldn't need to edit beyond this point
Guido van Rossum5b343731992-07-07 09:06:34 +000069
Guido van Rossume83e3801995-03-17 16:01:35 +000070# Main target
Guido van Rossumeb8d5031996-08-09 21:46:05 +000071all: all-ps
72
Guido van Rossum9231c8f1997-05-15 21:43:21 +000073all-dvi: tut.dvi lib.dvi ext.dvi api.dvi
74all-ps: tut.ps lib.ps ext.ps api.ps
Guido van Rossum20aca5a1991-01-25 13:29:04 +000075
Guido van Rossume83e3801995-03-17 16:01:35 +000076# Individual document fake targets
Guido van Rossumeb8d5031996-08-09 21:46:05 +000077tut: tut.ps
78lib: lib.ps
Guido van Rossumeb8d5031996-08-09 21:46:05 +000079ext: ext.ps
Guido van Rossum9231c8f1997-05-15 21:43:21 +000080api: api.ps
Guido van Rossume83e3801995-03-17 16:01:35 +000081
82# Dependencies
Guido van Rossum9231c8f1997-05-15 21:43:21 +000083tut.dvi lib.dvi ext.dvi api.dvi: myformat.sty fix_hack
Guido van Rossum16d6e711994-08-08 12:30:22 +000084
Guido van Rossume83e3801995-03-17 16:01:35 +000085# Tutorial document
Guido van Rossum16d6e711994-08-08 12:30:22 +000086tut.dvi: tut.tex
Guido van Rossum73827c61995-03-20 13:00:32 +000087 $(LATEX) tut
88 $(LATEX) tut
Guido van Rossumeb8d5031996-08-09 21:46:05 +000089
90tut.ps: tut.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +000091 $(DVIPS) tut >tut.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +000092
Guido van Rossum16d6e711994-08-08 12:30:22 +000093# LaTeX source files for the Python Library Reference
94LIBFILES = lib.tex \
Guido van Rossum40006cf1996-08-19 22:58:03 +000095 libintro.tex libobjs.tex libtypes.tex libexcs.tex libfuncs.tex \
96 libpython.tex libsys.tex libtypes2.tex libtraceback.tex libpickle.tex \
97 libshelve.tex libcopy.tex libmarshal.tex libimp.tex libparser.tex \
98 libbltin.tex libmain.tex libstrings.tex libstring.tex libregex.tex \
99 libregsub.tex libstruct.tex libmisc.tex libmath.tex librand.tex \
100 libwhrandom.tex libarray.tex liballos.tex libos.tex libtime.tex \
101 libgetopt.tex libtempfile.tex liberrno.tex libsomeos.tex libsignal.tex \
102 libsocket.tex libselect.tex libthread.tex libunix.tex libposix.tex \
103 libppath.tex libpwd.tex libgrp.tex libcrypt.tex libdbm.tex libgdbm.tex \
104 libtermios.tex libfcntl.tex libposixfile.tex libsyslog.tex libpdb.tex \
105 libprofile.tex libwww.tex libcgi.tex liburllib.tex libhttplib.tex \
106 libftplib.tex libgopherlib.tex libnntplib.tex liburlparse.tex \
107 libhtmllib.tex libsgmllib.tex librfc822.tex libmimetools.tex \
108 libbinascii.tex libmm.tex libaudioop.tex libimageop.tex libaifc.tex \
109 libjpeg.tex librgbimg.tex libcrypto.tex libmd5.tex libmpz.tex \
110 librotor.tex libmac.tex libctb.tex libmacconsole.tex libmacdnr.tex \
111 libmacfs.tex libmacos.tex libmacostools.tex libmactcp.tex \
112 libmacspeech.tex libmacui.tex libstdwin.tex libsgi.tex libal.tex \
113 libcd.tex libfl.tex libfm.tex libgl.tex libimgfile.tex libsun.tex \
Guido van Rossuma80c3981996-10-22 01:12:13 +0000114 libxdrlib.tex libimghdr.tex \
115 librestricted.tex librexec.tex libbastion.tex \
Guido van Rossum3dd68d31996-12-31 02:24:54 +0000116 libformatter.tex liboperator.tex libsoundex.tex libresource.tex \
Guido van Rossum7f3b0421997-03-27 14:56:18 +0000117 libstat.tex libstrio.tex libundoc.tex libmailcap.tex libglob.tex \
Guido van Rossume76b7a81997-04-27 21:25:52 +0000118 libuser.tex libanydbm.tex librandom.tex libsite.tex libwhichdb.tex \
Guido van Rossum41c302f1997-06-02 17:36:12 +0000119 libbase64.tex libfnmatch.tex libquopri.tex libzlib.tex libsocksvr.tex \
Fred Drake18600a41997-07-18 20:43:27 +0000120 libmailbox.tex libcommands.tex libcmath.tex libni.tex libgzip.tex \
Guido van Rossum36764b81997-08-30 20:02:25 +0000121 libpprint.tex libcode.tex libmimify.tex libre.tex libmacic.tex \
Guido van Rossumbc12f781997-11-20 21:04:27 +0000122 libuserdict.tex libdis.tex libxmllib.tex libqueue.tex liblocale.tex
Guido van Rossum16d6e711994-08-08 12:30:22 +0000123
Guido van Rossume83e3801995-03-17 16:01:35 +0000124# Library document
Guido van Rossum16d6e711994-08-08 12:30:22 +0000125lib.dvi: $(LIBFILES)
Guido van Rossumb83241c1992-03-06 10:56:42 +0000126 touch lib.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000127 $(LATEX) lib
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000128 ./fix_hack lib.idx
Fred Drakeb4d4e251996-11-11 21:03:01 +0000129 $(MAKEINDEX) lib.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000130 $(LATEX) lib
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000131
132lib.ps: lib.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000133 $(DVIPS) lib >lib.ps
Guido van Rossuma52117e1991-11-21 13:54:36 +0000134
Guido van Rossume83e3801995-03-17 16:01:35 +0000135# Extensions document
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000136ext.dvi: ext.tex
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000137 touch ext.ind
Guido van Rossum73827c61995-03-20 13:00:32 +0000138 $(LATEX) ext
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000139 ./fix_hack ext.idx
Fred Drakeb4d4e251996-11-11 21:03:01 +0000140 $(MAKEINDEX) ext.idx
Guido van Rossum73827c61995-03-20 13:00:32 +0000141 $(LATEX) ext
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000142
143ext.ps: ext.dvi
Guido van Rossum6938f061994-08-01 12:22:53 +0000144 $(DVIPS) ext >ext.ps
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000145
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000146# Python-C API document
147api.dvi: api.tex
148 touch api.ind
149 $(LATEX) api
150 ./fix_hack api.idx
151 $(MAKEINDEX) api.idx
152 $(LATEX) api
Guido van Rossumeb8d5031996-08-09 21:46:05 +0000153
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000154api.ps: api.dvi
155 $(DVIPS) api >api.ps
Guido van Rossumb3fa13c1991-01-22 11:47:14 +0000156
Guido van Rossume83e3801995-03-17 16:01:35 +0000157
158# The remaining part of the Makefile is concerned with various
Guido van Rossum73827c61995-03-20 13:00:32 +0000159# conversions, as described above. See also the README file.
Guido van Rossume83e3801995-03-17 16:01:35 +0000160
Fred Drake05dd3c01997-12-29 17:17:54 +0000161.SUFFIXES: .py .pyc
162
163.py.pyc:
164 $(PYTHON) -c "import $*"
165
166.PRECIOUS: lib.texi
167
168lib1.texi: lib*.tex texipre.dat texipost.dat partparse.pyc
169 $(PARTPARSE) -o lib1.texi `./whichlibs`
170
171lib.texi: lib1.texi fix.el
172 $(EMACS) -batch -l fix.el -f save-buffer -kill
173 cp lib1.texi lib.texi
174
175python-lib.info: lib.texi
176 -$(MAKEINFO) --footnote-style end --fill-column 72 \
177 --paragraph-indent 0 lib.texi
178
179lib.info: python-lib.info
180
Guido van Rossum73827c61995-03-20 13:00:32 +0000181# Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
182# HTML converter. For more info on this program, see
Guido van Rossume83e3801995-03-17 16:01:35 +0000183# <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
Guido van Rossume83e3801995-03-17 16:01:35 +0000184
Fred Drakeb4d4e251996-11-11 21:03:01 +0000185# Note that LaTeX2HTML inserts references to an "icons" directory in
186# each page that it generates. You can customize where these icons
187# are to be found; I generally make it point to "../icons" and then
188# create a symbolic link to the icons directory in the LaTeX2HTML
189# source at the appropriate place. Change the definition of
190# $ICONSERVER in .latex2html-init to point to a different location.
Guido van Rossume83e3801995-03-17 16:01:35 +0000191
Fred Drakefc8f6f31996-12-06 18:45:30 +0000192# The sed hack rips out a superfluous comma which I haven't found the source
193# of; the prominent location makes it worth the extra step. This affects the
194# title pages!
195
Fred Drakebc0cd371997-07-30 15:59:25 +0000196l2h: l2htut l2hext l2hlib l2hapi
Guido van Rossum6938f061994-08-01 12:22:53 +0000197
Fred Drakeb4d4e251996-11-11 21:03:01 +0000198l2htut: tut.dvi myformat.perl
Guido van Rossum6938f061994-08-01 12:22:53 +0000199 $(L2H) $(L2HARGS) tut.tex
Fred Drakefc8f6f31996-12-06 18:45:30 +0000200 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
201 <tut/tut.html >tut/xxx
202 mv tut/xxx tut/tut.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000203 ln -s tut.html tut/index.html || true
Guido van Rossum6938f061994-08-01 12:22:53 +0000204
Fred Drakeb4d4e251996-11-11 21:03:01 +0000205l2hext: ext.dvi myformat.perl
Guido van Rossum6938f061994-08-01 12:22:53 +0000206 $(L2H) $(L2HARGS) ext.tex
Fred Drakefc8f6f31996-12-06 18:45:30 +0000207 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
208 <ext/ext.html >ext/xxx
209 mv ext/xxx ext/ext.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000210 ln -s ext.html ext/index.html || true
Guido van Rossum970871f1993-02-21 20:10:26 +0000211
Fred Drakeb4d4e251996-11-11 21:03:01 +0000212l2hlib: lib.dvi myformat.perl
Fred Drake03ff6f71997-08-22 18:18:54 +0000213 ./fix_libaux.sed <lib.aux >lib1.aux
214 mv lib1.aux lib.aux
Guido van Rossume83e3801995-03-17 16:01:35 +0000215 $(L2H) $(L2HARGS) lib.tex
Fred Drakef1e67071996-12-06 15:11:34 +0000216 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
217 <lib/lib.html >lib/xxx
218 mv lib/xxx lib/lib.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000219 ln -s lib.html lib/index.html || true
Guido van Rossume83e3801995-03-17 16:01:35 +0000220
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000221l2hapi: api.dvi myformat.perl
222 $(L2H) $(L2HARGS) api.tex
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000223 sed 's/^<P CLASS=ABSTRACT>,/<P CLASS=ABSTRACT>/' \
224 <api/api.html >api/xxx
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000225 mv api/xxx api/api.html
Fred Drake03ff6f71997-08-22 18:18:54 +0000226 ln -s api.html api/index.html || true
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000227
Guido van Rossum330c6601997-11-26 15:31:32 +0000228tarhtml:
Guido van Rossum84cca441997-11-25 20:49:09 +0000229 @echo "Did you remember to run makeMIFs.py in the ref subdirectory...?"
230 tar cf - index.html ???/???.css ???/*.html lib/*.gif icons/*.* | gzip >html.tar.gz
231
Guido van Rossume83e3801995-03-17 16:01:35 +0000232
233# Housekeeping targets
234
Guido van Rossum9231c8f1997-05-15 21:43:21 +0000235# Remove temporary files; all except the following:
236# - sources: .tex, .bib, .sty
237# - useful results: .dvi, .ps, .texi, .info
Fred Drake03ff6f71997-08-22 18:18:54 +0000238clean: l2hclean
Guido van Rossum4ac605e1992-12-17 15:31:02 +0000239 rm -f @* *~ *.aux *.idx *.ilg *.ind *.log *.toc *.blg *.bbl *.pyc
Guido van Rossume83e3801995-03-17 16:01:35 +0000240 rm -f *.bak *.orig
Guido van Rossum5b343731992-07-07 09:06:34 +0000241
Fred Drake03ff6f71997-08-22 18:18:54 +0000242l2hclean:
Fred Drake5de31fc1997-08-22 18:20:33 +0000243 rm -rf api ext lib tut
Fred Drake03ff6f71997-08-22 18:18:54 +0000244
Guido van Rossume83e3801995-03-17 16:01:35 +0000245# Remove temporaries as well as final products
Guido van Rossum5b343731992-07-07 09:06:34 +0000246clobber: clean
Guido van Rossum7a2dba21993-11-05 14:45:11 +0000247 rm -f *.dvi *.ps *.texi *.info *.info-[0-9]*