Apparently the code to forestall Tk eating events was too aggressive (Tk user input...
[python/dscho.git] / Doc / Makefile
blobc9045ce83baa348d701c18013b9794b2912f5de3
1 # Makefile for Python documentation
2 # ---------------------------------
4 # See also the README file.
6 # This is a bit of a mess. The documents are identified by short names:
7 # api -- Python/C API Reference Manual
8 # doc -- Documenting Python
9 # ext -- Extending and Embedding the Python Interpreter
10 # lib -- Library Reference Manual
11 # mac -- Macintosh Library Modules
12 # ref -- Python Reference Manual
13 # tut -- Python Tutorial
14 # inst -- Installing Python Modules
15 # dist -- Distributing Python Modules
17 # The LaTeX sources for each of these documents are in subdirectories
18 # with the three-letter designations above as the directory names.
20 # The main target creates HTML for each of the documents. You can
21 # also do "make lib" (etc.) to create the HTML versions of individual
22 # documents.
24 # The document classes and styles are in the texinputs/ directory.
25 # These define a number of macros that are similar in name and intent
26 # as macros in Texinfo (e.g. \code{...} and \emph{...}), as well as a
27 # number of environments for formatting function and data definitions.
28 # Documentation for the macros is included in "Documenting Python"; see
29 # http://www.python.org/doc/current/doc/doc.html, or the sources for
30 # this document in the doc/ directory.
32 # Everything is processed by LaTeX. See the file `README' for more
33 # information on the tools needed for processing.
35 # There's a problem with generating the index which has been solved by
36 # a sed command applied to the index file. The shell script fix_hack
37 # does this (the Makefile takes care of calling it).
39 # Additional targets attempt to convert selected LaTeX sources to
40 # various other formats. These are generally site specific because
41 # the tools used are all but universal. These targets are:
43 # ps -- convert all documents from LaTeX to PostScript
44 # pdf -- convert all documents from LaTeX to the
45 # Portable Document Format
47 # See the README file for more information on these targets.
49 # The formatted output is located in subdirectories. For PDF and
50 # PostScript, look in the paper-$(PAPER)/ directory. For HTML, look in
51 # the html/ directory. If you want to fix the GNU info process, look
52 # in the info/ directory; please send patches to python-docs@python.org.
54 # This Makefile only includes information on how to perform builds; for
55 # dependency information, see Makefile.deps.
57 # Customization -- you *may* have to edit this
59 # You could set this to a4:
60 PAPER=letter
62 # Ideally, you shouldn't need to edit beyond this point
64 HTMLDIR= html
65 INFODIR= info
66 TOOLSDIR= tools
68 # This is the *documentation* release, and is used to construct the file
69 # names of the downloadable tarballs.
70 RELEASE=2.2a0
72 PYTHON= python
73 DVIPS= dvips -N0 -t $(PAPER)
75 MKDVI= ../tools/mkhowto --paper=$(PAPER) --dvi
76 MKHTML= tools/mkhowto --html --about html/stdabout.dat \
77 --address $(PYTHONDOCS) --up-link ../index.html \
78 --up-title "Python Documentation Index" \
79 --global-module-index "../modindex.html"
80 MKPDF= ../tools/mkhowto --paper=$(PAPER) --pdf
81 MKPS= ../tools/mkhowto --paper=$(PAPER) --ps
83 BUILDINDEX=$(TOOLSDIR)/buildindex.py
85 PYTHONDOCS='See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.'
86 HTMLBASE= file:`pwd`
88 # what's what
89 MANDVIFILES= paper-$(PAPER)/api.dvi paper-$(PAPER)/ext.dvi \
90 paper-$(PAPER)/lib.dvi paper-$(PAPER)/mac.dvi \
91 paper-$(PAPER)/ref.dvi paper-$(PAPER)/tut.dvi
92 HOWTODVIFILES= paper-$(PAPER)/doc.dvi paper-$(PAPER)/inst.dvi \
93 paper-$(PAPER)/dist.dvi
95 MANPDFFILES= paper-$(PAPER)/api.pdf paper-$(PAPER)/ext.pdf \
96 paper-$(PAPER)/lib.pdf paper-$(PAPER)/mac.pdf \
97 paper-$(PAPER)/ref.pdf paper-$(PAPER)/tut.pdf
98 HOWTOPDFFILES= paper-$(PAPER)/doc.pdf paper-$(PAPER)/inst.pdf \
99 paper-$(PAPER)/dist.pdf
101 MANPSFILES= paper-$(PAPER)/api.ps paper-$(PAPER)/ext.ps \
102 paper-$(PAPER)/lib.ps paper-$(PAPER)/mac.ps \
103 paper-$(PAPER)/ref.ps paper-$(PAPER)/tut.ps
104 HOWTOPSFILES= paper-$(PAPER)/doc.ps paper-$(PAPER)/inst.ps \
105 paper-$(PAPER)/dist.ps
107 DVIFILES= $(MANDVIFILES) $(HOWTODVIFILES)
108 PDFFILES= $(MANPDFFILES) $(HOWTOPDFFILES)
109 PSFILES= $(MANPSFILES) $(HOWTOPSFILES)
111 INDEXFILES=html/api/api.html \
112 html/doc/doc.html \
113 html/ext/ext.html \
114 html/lib/lib.html \
115 html/mac/mac.html \
116 html/ref/ref.html \
117 html/tut/tut.html \
118 html/inst/inst.html \
119 html/dist/dist.html
121 COMMONPERL= perl/manual.perl perl/python.perl perl/l2hinit.perl
123 include Makefile.deps
125 # These must be declared phony since there
126 # are directories with matching names:
127 .PHONY: api doc ext lib mac ref tut inst dist
128 .PHONY: html info
131 # Main target
132 all: html
134 dvi: $(DVIFILES)
135 pdf: $(PDFFILES)
136 ps: $(PSFILES)
138 world: ps pdf html distfiles
141 # Rules to build PostScript and PDF formats
142 .SUFFIXES: .dvi .ps
144 .dvi.ps:
145 $(DVIPS) -o $@ $<
148 # Targets for each document:
149 # Python/C API Reference Manual
150 paper-$(PAPER)/api.dvi: paper-$(PAPER)/api.tex $(APIFILES)
151 (cd paper-$(PAPER); $(MKDVI) api.tex)
153 paper-$(PAPER)/api.pdf: paper-$(PAPER)/api.tex $(APIFILES)
154 (cd paper-$(PAPER); $(MKPDF) api.tex)
156 paper-$(PAPER)/api.tex: api/api.tex api/refcounts.dat tools/anno-api.py
157 $(PYTHON) $(TOOLSDIR)/anno-api.py -o $@ api/api.tex
159 # Distributing Python Modules
160 paper-$(PAPER)/dist.dvi: $(DISTFILES)
161 (cd paper-$(PAPER); $(MKDVI) ../dist/dist.tex)
163 paper-$(PAPER)/dist.pdf: $(DISTFILES)
164 (cd paper-$(PAPER); $(MKPDF) ../dist/dist.tex)
166 # Documenting Python
167 paper-$(PAPER)/doc.dvi: $(DOCFILES)
168 (cd paper-$(PAPER); $(MKDVI) ../doc/doc.tex)
170 paper-$(PAPER)/doc.pdf: $(DOCFILES)
171 (cd paper-$(PAPER); $(MKPDF) ../doc/doc.tex)
173 # Extending and Embedding the Python Interpreter
174 paper-$(PAPER)/ext.dvi: $(EXTFILES)
175 (cd paper-$(PAPER); $(MKDVI) ../ext/ext.tex)
177 paper-$(PAPER)/ext.pdf: $(EXTFILES)
178 (cd paper-$(PAPER); $(MKPDF) ../ext/ext.tex)
180 # Installing Python Modules
181 paper-$(PAPER)/inst.dvi: $(INSTFILES)
182 (cd paper-$(PAPER); $(MKDVI) ../inst/inst.tex)
184 paper-$(PAPER)/inst.pdf: $(INSTFILES)
185 (cd paper-$(PAPER); $(MKPDF) ../inst/inst.tex)
187 # Python Library Reference
188 paper-$(PAPER)/lib.dvi: $(LIBFILES)
189 (cd paper-$(PAPER); $(MKDVI) ../lib/lib.tex)
191 paper-$(PAPER)/lib.pdf: $(LIBFILES)
192 (cd paper-$(PAPER); $(MKPDF) ../lib/lib.tex)
194 # Macintosh Library Modules
195 paper-$(PAPER)/mac.dvi: $(MACFILES)
196 (cd paper-$(PAPER); $(MKDVI) ../mac/mac.tex)
198 paper-$(PAPER)/mac.pdf: $(MACFILES)
199 (cd paper-$(PAPER); $(MKPDF) ../mac/mac.tex)
201 # Python Reference Manual
202 paper-$(PAPER)/ref.dvi: $(REFFILES)
203 (cd paper-$(PAPER); $(MKDVI) ../ref/ref.tex)
205 paper-$(PAPER)/ref.pdf: $(REFFILES)
206 (cd paper-$(PAPER); $(MKPDF) ../ref/ref.tex)
208 # Python Tutorial
209 paper-$(PAPER)/tut.dvi: $(TUTFILES)
210 (cd paper-$(PAPER); $(MKDVI) ../tut/tut.tex)
212 paper-$(PAPER)/tut.pdf: $(TUTFILES)
213 (cd paper-$(PAPER); $(MKPDF) ../tut/tut.tex)
215 # The remaining part of the Makefile is concerned with various
216 # conversions, as described above. See also the README file.
218 info:
219 (cd $(INFODIR); $(MAKE))
221 # Targets to convert the manuals to HTML using Nikos Drakos' LaTeX to
222 # HTML converter. For more info on this program, see
223 # <URL:http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html>.
225 # Note that LaTeX2HTML inserts references to an icons directory in
226 # each page that it generates. I have placed a copy of this directory
227 # in the distribution to simplify the process of creating a
228 # self-contained HTML distribution; for this purpose I have also added
229 # a (trivial) index.html. Change the definition of $ICONSERVER in
230 # perl/l2hinit.perl to use a different location for the icons directory.
232 # If you have the standard LaTeX2HTML icons installed, the versions shipped
233 # with this documentation should be stored in a separate directory and used
234 # instead. The standard set does *not* include all the icons used in the
235 # Python documentation.
237 $(INDEXFILES): $(COMMONPERL) html/about.dat tools/node2label.pl
239 html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml
240 $(TOOLSDIR)/mkackshtml --address $(PYTHONDOCS) \
241 --output html/acks.html <ACKS
243 html/modindex.html: $(TOOLSDIR)/support.py $(TOOLSDIR)/mkmodindex
244 html/modindex.html: html/lib/lib.html html/mac/mac.html
245 (cd html; \
246 ../$(TOOLSDIR)/mkmodindex --columns 4 --output modindex.html \
247 --address $(PYTHONDOCS) \
248 lib/modindex.html mac/modindex.html)
250 html: $(INDEXFILES) html/index.html html/modindex.html html/acks.html
252 api html/api/api.html: $(APIFILES)
253 $(MKHTML) --dir html/api api/api.tex
255 doc html/doc/doc.html: $(DOCFILES)
256 $(MKHTML) --dir html/doc doc/doc.tex
258 ext html/ext/ext.html: $(EXTFILES)
259 $(MKHTML) --dir html/ext ext/ext.tex
261 lib html/lib/lib.html: $(LIBFILES)
262 $(MKHTML) --dir html/lib lib/lib.tex
264 mac html/mac/mac.html: $(MACFILES)
265 $(MKHTML) --dir html/mac mac/mac.tex
267 ref html/ref/ref.html: $(REFFILES)
268 $(MKHTML) --dir html/ref ref/ref.tex
270 tut html/tut/tut.html: $(TUTFILES)
271 $(MKHTML) --dir html/tut --numeric --split 3 tut/tut.tex
273 inst html/inst/inst.html: $(INSTFILES) perl/distutils.perl
274 $(MKHTML) --dir html/inst --split 4 inst/inst.tex
276 dist html/dist/dist.html: $(DISTFILES) perl/distutils.perl
277 $(MKHTML) --dir html/dist --split 4 dist/dist.tex
280 # webchecker needs an extra flag to process the huge index from the libref
281 WEBCHECKER=$(PYTHON) ../Tools/webchecker/webchecker.py
282 HTMLBASE= file:`pwd`/html
284 webcheck: html
285 $(WEBCHECKER) $(HTMLBASE)/api/
286 $(WEBCHECKER) $(HTMLBASE)/doc/
287 $(WEBCHECKER) $(HTMLBASE)/ext/
288 $(WEBCHECKER) -m290000 $(HTMLBASE)/lib/
289 $(WEBCHECKER) $(HTMLBASE)/mac/
290 $(WEBCHECKER) $(HTMLBASE)/ref/
291 $(WEBCHECKER) $(HTMLBASE)/tut/
292 $(WEBCHECKER) $(HTMLBASE)/dist/
293 $(WEBCHECKER) $(HTMLBASE)/inst/
295 fastwebcheck: html
296 $(WEBCHECKER) -x $(HTMLBASE)/api/
297 $(WEBCHECKER) -x $(HTMLBASE)/doc/
298 $(WEBCHECKER) -x $(HTMLBASE)/ext/
299 $(WEBCHECKER) -x -m290000 $(HTMLBASE)/lib/
300 $(WEBCHECKER) -x $(HTMLBASE)/mac/
301 $(WEBCHECKER) -x $(HTMLBASE)/ref/
302 $(WEBCHECKER) -x $(HTMLBASE)/tut/
303 $(WEBCHECKER) -x $(HTMLBASE)/dist/
304 $(WEBCHECKER) -x $(HTMLBASE)/inst/
307 # Release packaging targets:
309 paper-$(PAPER)/README: ps $(TOOLSDIR)/getpagecounts
310 (cd paper-$(PAPER); ../$(TOOLSDIR)/getpagecounts >../$@)
312 info-$(RELEASE).tgz: info
313 (cd $(INFODIR); tar cf - README python.dir python-???.info*) \
314 | gzip -9 >$@
316 info-$(RELEASE).tar.bz2: info
317 (cd $(INFODIR); tar cf - README python.dir python-???.info*) \
318 | bzip2 -9 >$@
320 latex-$(RELEASE).tgz:
321 $(TOOLSDIR)/mksourcepkg --gzip $(RELEASE)
323 latex-$(RELEASE).tar.bz2:
324 $(TOOLSDIR)/mksourcepkg --bzip2 $(RELEASE)
326 latex-$(RELEASE).zip:
327 rm -f $@
328 $(TOOLSDIR)/mksourcepkg --zip $(RELEASE)
330 pdf-$(PAPER)-$(RELEASE).tgz: pdf
331 (cd paper-$(PAPER); tar cf - *.pdf) | gzip -9 >$@
333 pdf-$(PAPER)-$(RELEASE).tar.bz2: pdf
334 (cd paper-$(PAPER); tar cf - *.pdf) | bzip2 -9 >$@
336 pdf-$(PAPER)-$(RELEASE).zip: pdf
337 rm -f $@
338 (cd paper-$(PAPER); zip -q -9 ../$@ *.pdf)
340 postscript-$(PAPER)-$(RELEASE).tar.bz2: ps paper-$(PAPER)/README
341 (cd paper-$(PAPER); tar cf - *.ps README) | bzip2 -9 >$@
343 postscript-$(PAPER)-$(RELEASE).tgz: ps paper-$(PAPER)/README
344 (cd paper-$(PAPER); tar cf - *.ps README) | gzip -9 >$@
346 postscript-$(PAPER)-$(RELEASE).zip: ps paper-$(PAPER)/README
347 rm -f $@
348 (cd paper-$(PAPER); zip -q -9 ../$@ *.ps README)
350 html-$(RELEASE).tgz: html
351 (cd $(HTMLDIR); \
352 tar cf - *.html */*.css */*.html */*.gif) \
353 | gzip -9 >$@
355 html-$(RELEASE).tar.bz2: html
356 (cd $(HTMLDIR); \
357 tar cf - *.html */*.css */*.html */*.gif) \
358 | bzip2 -9 >$@
360 html-$(RELEASE).zip: html
361 rm -f $@
362 (cd $(HTMLDIR); \
363 zip -q -9 ../$@ *.html */*.css */*.html */*.gif)
365 # convenience targets:
367 tarhtml: html-$(RELEASE).tgz
368 tarinfo: info-$(RELEASE).tgz
369 tarps: postscript-$(PAPER)-$(RELEASE).tgz
370 tarpdf: pdf-$(PAPER)-$(RELEASE).tgz
371 tarlatex: latex-$(RELEASE).tgz
373 tarballs: tarpdf tarps tarhtml
375 ziphtml: html-$(RELEASE).zip
376 zipps: postscript-$(PAPER)-$(RELEASE).zip
377 zippdf: pdf-$(PAPER)-$(RELEASE).zip
378 ziplatex: latex-$(RELEASE).zip
380 zips: zippdf zipps ziphtml
382 bziphtml: html-$(RELEASE).tar.bz2
383 bzipinfo: info-$(RELEASE).tar.bz2
384 bzipps: postscript-$(PAPER)-$(RELEASE).tar.bz2
385 bzippdf: pdf-$(PAPER)-$(RELEASE).tar.bz2
386 bziplatex: latex-$(RELEASE).tar.bz2
388 bzips: bzippdf bzipps bziphtml
390 disthtml: tarhtml bziphtml ziphtml
391 distinfo: tarinfo bzipinfo
392 distps: tarps bzipps zipps
393 distpdf: tarpdf bzippdf zippdf
394 distlatex: tarlatex bziplatex ziplatex
396 distfiles: tarballs zips bzips
397 $(TOOLSDIR)/mksourcepkg --all $(RELEASE)
400 # Housekeeping targets
402 # Remove temporary files; all except the following:
403 # - sources: .tex, .bib, .sty, *.cls
404 # - useful results: .dvi, .pdf, .ps, .texi, .info
405 clean:
406 (cd paper-$(PAPER); $(MAKE) clean)
407 (cd $(INFODIR); $(MAKE) clean)
409 # Remove temporaries as well as final products
410 clobber:
411 rm -f html-$(RELEASE).tgz info-$(RELEASE).tgz
412 rm -f pdf-$(RELEASE).tgz postscript-$(RELEASE).tgz
413 rm -f latex-$(RELEASE).tgz html-$(RELEASE).zip
414 rm -f pdf-$(RELEASE).zip postscript-$(RELEASE).zip
415 rm -f $(DVIFILES) $(PSFILES) $(PDFFILES)
416 (cd $(INFODIR); $(MAKE) clobber)
417 rm -rf html/index.html html/modindex.html html/acks.html
418 rm -rf html/api/ html/doc/ html/ext/ html/lib/ html/mac/
419 rm -rf html/ref/ html/tut/ html/inst/ html/dist/
421 realclean distclean: clobber
424 # html/index.html is dependent on $(INDEXFILES) since we want the date
425 # on the front index to be updated whenever any of the child documents
426 # are updated and boilerplate.tex uses \today as the date.
428 # It's at the end of the file since it wedges font-lock in XEmacs.
430 BOILERPLATE=texinputs/boilerplate.tex
431 html/index.html: html/index.html.in $(BOILERPLATE) $(INDEXFILES)
432 DATE=`grep '\\date{' $(BOILERPLATE) | sed 's/.*\\date{\(.*\)}.*$$/\1/'` ; \
433 if [ "$$DATE" = '\today' ] ; then DATE=`date '+%B %e, %Y'`;fi;\
434 sed -e "s/@DATE@/$$DATE/g" -e "s/@RELEASE@/$(RELEASE)/g" \
435 $< >$@