* gdbint.texinfo (Algorithms): Add new section describing the
[external/binutils.git] / gdb / doc / Makefile.in
1 ##Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002
2 ##Free Software Foundation, Inc.
3
4 # Makefile for GDB documentation.
5 # This file is part of GDB.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 srcdir = @srcdir@
22 VPATH = @srcdir@
23
24 prefix = @prefix@
25
26 infodir = @infodir@
27 htmldir = $(prefix)/html
28
29 SHELL = @SHELL@
30
31 LN_S = @LN_S@
32
33 INSTALL = @INSTALL@
34 INSTALL_PROGRAM = @INSTALL_PROGRAM@
35 INSTALL_DATA = @INSTALL_DATA@
36
37 # main GDB source directory
38 gdbdir = $(srcdir)/..
39
40 # where to find texinfo; GDB dist should include a recent one
41 TEXIDIR=${gdbdir}/../texinfo
42
43 # where to find makeinfo, preferably one designed for texinfo-2
44 MAKEINFO=makeinfo
45
46 # Note that texinfo 4.0's makeinfo --html can only generate a
47 # single file, which would be too large, so continue to use
48 # texi2html. -sts 2000-03-28
49
50 MAKEHTML = texi2html
51 MAKEHTMLFLAGS = -menu -split_chapter
52
53 # where to find texi2roff, ditto
54 TEXI2ROFF=texi2roff
55
56 # where to find texi2dvi, ditto
57 TEXI2DVI=texi2dvi
58
59 # Where is the source dir for the READLINE library doc?  
60 # Traditionally readline is in .. or .
61 READLINE_DIR = ${gdbdir}/../readline/doc
62
63 # The GDB/MI docs come from a sibling directory ../mi
64 GDBMI_DIR = ${gdbdir}/mi
65
66 SET_TEXINPUTS = \
67    TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$(GDBMI_DIR):$$TEXINPUTS
68
69 # Files which should be generated via 'info' and installed by 'install-info'
70 INFO_DEPS = gdb.info gdbint.info stabs.info
71
72 # There may be alternate predefined collections of switches to configure
73 # the GDB manual.  Normally this is not done in synch with the software
74 # config system, since this choice tends to be independent; most people
75 # want a doc config of `all' for a generic manual, regardless of sw config.
76 DOC_CONFIG = all
77
78 # This list of sed edits will edit the GDB reference card
79 # for what fonts and what papersize to use.
80 # By default (NO edits applied), the refcard uses:
81 #    - Computer Modern (CM) fonts
82 #    - US letter paper (8.5x11in)
83 # List some of the following files for alternative fonts and paper:
84 #  a4rc.sed     use A4 paper (297 x 210 mm)
85 #  psrc.sed     use PostScript fonts (Karl Berry short TeX names)
86 # lpsrc.sed     use PostScript fonts (full PostScript names in TeX)
87 # e.g. for A4, Postscript:  REFEDITS = a4rc.sed psrc.sed
88 #      for A4, CM fonts:    REFEDITS = a4rc.sed
89 #      for US, PS fonts:    REFEDITS = psrc.sed
90 #      for default:
91 REFEDITS =
92
93 # Don Knuth's TeX formatter
94 TEX = tex
95
96 # Program to generate Postscript files from DVI files.
97 DVIPS = dvips
98
99 # Main GDB manual
100 GDB_DOC_SOURCE_INCLUDES = \
101         $(srcdir)/annotate.texi \
102         $(srcdir)/fdl.texi \
103         $(srcdir)/gpl.texi \
104         $(GDBMI_DIR)/gdbmi.texinfo \
105         $(READLINE_DIR)/rluser.texinfo \
106         $(READLINE_DIR)/inc-hist.texinfo
107 GDB_DOC_BUILD_INCLUDES = \
108         gdb-cfg.texi \
109         GDBvn.texi
110 GDB_DOC_FILES = \
111         $(srcdir)/gdb.texinfo \
112         $(GDB_DOC_SOURCE_INCLUDES) \
113         $(GDB_DOC_BUILD_INCLUDES)
114
115 # Internals Manual
116 GDBINT_DOC_SOURCE_INCLUDES = \
117         $(srcdir)/fdl.texi \
118         $(srcdir)/observer.texi
119 GDBINT_DOC_BUILD_INCLUDES = \
120         gdb-cfg.texi \
121         GDBvn.texi
122 GDBINT_DOC_FILES = \
123         $(srcdir)/gdbint.texinfo \
124         $(GDBINT_DOC_SOURCE_INCLUDES) \
125         $(GDBINT_DOC_BUILD_INCLUDES)
126
127 # Stabs manual: All files
128 STABS_DOC_SOURCE_INCLUDES =
129 STABS_DOC_BUILD_INCLUDES =
130 STABS_DOC_FILES = \
131         $(srcdir)/stabs.texinfo \
132         $(STABS_DOC_SOURCE_INCLUDES) \
133         $(STABS_DOC_BUILD_INCLUDES)
134
135 #### Host, target, and site specific Makefile fragments come in here.
136 ###
137
138 all:
139
140 info: $(INFO_DEPS)
141 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi
142 ps: gdb.ps gdbint.ps stabs.ps refcard.ps
143 html: gdb_toc.html gdbint_toc.html stabs_toc.html
144 pdf: gdb.pdf gdbint.pdf stabs.pdf
145 all-doc: info dvi ps # pdf
146 diststuff: info
147
148 install-info: $(INFO_DEPS)
149         $(SHELL) $(srcdir)/../../mkinstalldirs $(infodir)
150         @list='$(INFO_DEPS)'; \
151         for file in $$list; do \
152           if test -f $$file; then d=.; else d=$(srcdir); fi; \
153           for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
154             if test -f $$d/$$ifile; then \
155               echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
156               $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
157             else : ; fi; \
158           done; \
159         done
160         $(POST_INSTALL)
161         @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
162           list='$(INFO_DEPS)'; \
163           for file in $$list; do \
164             echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
165             install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
166           done; \
167         else : ; fi
168
169 uninstall-info:
170         $(PRE_UNINSTALL)
171         @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
172           ii=yes; \
173         else ii=; fi; \
174         list='$(INFO_DEPS)'; \
175         for file in $$list; do \
176           test -z "$$ii" \
177             || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
178         done
179         $(NORMAL_UNINSTALL)
180         list='$(INFO_DEPS)'; \
181         for file in $$list; do \
182           (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
183         done
184
185 install-html: html
186         for i in *.html ; do \
187                 $(INSTALL_DATA) $$i $(htmldir)/$$i ; \
188         done
189
190 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
191
192 # Copy the object files from a particular stage into a subdirectory.
193 stage1: force
194         -mkdir stage1
195         -mv $(STAGESTUFF) stage1
196
197 stage2: force
198         -mkdir stage2
199         -mv $(STAGESTUFF) stage2
200
201 stage3: force
202         -mkdir stage3
203         -mv $(STAGESTUFF) stage3
204
205 against=stage2
206
207 comparison: force
208         for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
209
210 de-stage1: force
211         -(cd stage1 ; mv -f * ..)
212         -rmdir stage1
213
214 de-stage2: force
215         -(cd stage2 ; mv -f * ..)
216         -rmdir stage2
217
218 de-stage3: force
219         -(cd stage3 ; mv -f * ..)
220         -rmdir stage3
221
222 # GDB QUICK REFERENCE (dvi output)
223 refcard.dvi : refcard.tex $(REFEDITS)
224         echo > tmp.sed
225         for f in x $(REFEDITS) ; do \
226                 test x$$f = xx && continue ; \
227                 cat $(srcdir)/$$f >>tmp.sed ; \
228         done
229         sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
230         $(SET_TEXINPUTS) $(TEX) sedref.tex
231         mv sedref.dvi refcard.dvi
232         rm -f sedref.log sedref.tex tmp.sed
233
234 refcard.ps : refcard.dvi
235         $(DVIPS) -t landscape -o $@ $?
236
237 # File to record current GDB version number (copied from main dir version.in)
238 GDBvn.texi : ${gdbdir}/version.in
239         echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
240         mv GDBvn.new GDBvn.texi
241
242 # Updated atomically
243 .PRECIOUS: GDBvn.texi
244
245 # Choose configuration for GDB manual (normally `all'; normally not tied into
246 # `configure' script because most users prefer generic version of manual,
247 # not one for their binary config---which may not be specifically
248 # defined anyways).
249 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
250         (test "$$LN_S" = "ln -s" && \
251           ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi) || \
252         ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
253         cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
254
255 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
256 # If your texinfo or makeinfo don't support these, get a new texinfo release
257 #
258 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
259 #   Note that we can *generate* GDBvn.texi, but since we distribute one in the
260 #   source directory for the benefit of people who *don't* use this makefile,
261 #   VPATH will often tell make not to bother building it, because the one
262 #   in the srcdir is up to date.  (if not, then make should build one here).
263
264 # Clean these up before each run.  Avoids a catch 22 with not being
265 # able to re-generate these files (to fix a corruption) because these
266 # files contain a corruption.
267 GDB_TEX_TMPS = gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
268         gdb.tp* gdb.vr*
269
270 # GDB MANUAL: TeX dvi file
271 gdb.dvi: ${GDB_DOC_FILES}
272         if [ ! -f ./GDBvn.texi ]; then \
273                 (test "$$LN_S" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
274                 ln $(srcdir)/GDBvn.texi . || \
275                 cp $(srcdir)/GDBvn.texi . ; else true; fi
276         rm -f $(GDB_TEX_TMPS)
277         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdb.texinfo
278
279 gdb.ps: gdb.dvi
280         $(DVIPS) -o $@ $?
281
282 gdb.pdf: ${GDB_DOC_FILES}
283         if [ ! -f ./GDBvn.texi ]; then \
284                 (test "$$LN_S" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
285                 ln $(srcdir)/GDBvn.texi . || \
286                 cp $(srcdir)/GDBvn.texi . ; else true; fi
287         rm -f $(GDB_TEX_TMPS)
288         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdb.texinfo
289
290 # GDB MANUAL: info file
291 gdb.info: ${GDB_DOC_FILES}
292         $(MAKEINFO) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
293                 -o gdb.info $(srcdir)/gdb.texinfo
294
295 # GDB MANUAL: roff translations
296 # Try to use a recent texi2roff.  v2 was put on prep in jan91.
297 # If you want an index, see texi2roff doc for postprocessing 
298 # and add -i to texi2roff invocations below.
299 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
300 #    corresponding -e lines when later texi2roff's are current)
301 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
302 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
303 # + @   (that's at-BLANK) not recognized by texi2roff, turned into blank
304 # + @alphaenumerate is ridiculously new, turned into @enumerate
305
306 # texi2roff doesn't have a notion of include dirs, so we have to fake 
307 # it out for gdb manual's include files---but only if not configured
308 # in main sourcedir.
309 links2roff: $(GDB_DOC_SOURCE_INCLUDES)
310         if [ ! -f gdb.texinfo ]; then \
311                 (test "$$LN_S" = "ln -s" && ln -s $(GDB_DOC_SOURCE_INCLUDES) .) || \
312                 ln $(GDB_DOC_SOURCE_INCLUDES)    . || \
313                 cp $(GDB_DOC_SOURCE_INCLUDES)    . ; \
314         fi
315         touch links2roff
316
317 # gdb manual suitable for [gtn]roff -me
318 gdb.me: $(GDB_DOC_FILES) links2roff
319         sed -e '/\\input texinfo/d' \
320                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
321                 -e '/^@ifinfo/,/^@end ifinfo/d' \
322                 -e '/^@c /d' \
323                 -e 's/{.*,,/{/' \
324                 -e 's/@ / /g' \
325                 -e 's/^@alphaenumerate/@enumerate/g' \
326                 -e 's/^@end alphaenumerate/@end enumerate/g' \
327                 $(srcdir)/gdb.texinfo | \
328         $(TEXI2ROFF) -me | \
329         sed -e 's/---/\\(em/g' \
330         >gdb.me 
331
332 # gdb manual suitable for [gtn]roff -ms
333 gdb.ms: $(GDB_DOC_FILES) links2roff
334         sed -e '/\\input texinfo/d' \
335                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
336                 -e '/^@ifinfo/,/^@end ifinfo/d' \
337                 -e '/^@c /d' \
338                 -e 's/{.*,,/{/' \
339                 -e 's/@ / /g' \
340                 -e 's/^@alphaenumerate/@enumerate/g' \
341                 -e 's/^@end alphaenumerate/@end enumerate/g' \
342                 $(srcdir)/gdb.texinfo | \
343         $(TEXI2ROFF) -ms | \
344         sed -e 's/---/\\(em/g' \
345         >gdb.ms 
346
347 # gdb manual suitable for [tn]roff -mm
348 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer, 
349 #   try leaving them in
350 gdb.mm: $(GDB_DOC_FILES) links2roff
351         sed -e '/\\input texinfo/d' \
352                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
353                 -e '/^@ifinfo/,/^@end ifinfo/d' \
354                 -e '/^@c /d' \
355                 -e 's/{.*,,/{/' \
356                 -e '/@noindent/d' \
357                 -e 's/@ / /g' \
358                 -e 's/^@alphaenumerate/@enumerate/g' \
359                 -e 's/^@end alphaenumerate/@end enumerate/g' \
360                 $(srcdir)/gdb.texinfo | \
361         $(TEXI2ROFF) -mm | \
362         sed -e 's/---/\\(em/g' \
363         >gdb.mm 
364
365 # GDB MANUAL: HTML file
366
367 gdb_toc.html: ${GDB_DOC_FILES}
368         $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo
369
370 # Clean these up before each run.  Avoids a catch 22 with not being
371 # able to re-generate these files (to fix a corruption) because these
372 # files contain a corruption.
373 GDBINT_TEX_TMPS = gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
374         gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
375
376 # GDB INTERNALS MANUAL: TeX dvi file
377 gdbint.dvi: $(GDBINT_DOC_FILES)
378         rm -f $(GDBINT_TEX_TMPS)
379         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdbint.texinfo
380
381 gdbint.ps : gdbint.dvi
382         $(DVIPS) -o $@ $?
383
384 gdbint.pdf: $(GDBINT_DOC_FILES)
385         rm -f $(GDBINT_TEX_TMPS)
386         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdbint.texinfo
387
388 # GDB INTERNALS MANUAL: info file
389
390 gdbint.info: $(GDBINT_DOC_FILES)
391         $(MAKEINFO) -I $(srcdir) -o gdbint.info $(srcdir)/gdbint.texinfo
392
393 # GDB INTERNALS MANUAL: HTML file
394
395 gdbint_toc.html: $(GDBINT_DOC_FILES)
396         $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/gdbint.texinfo
397
398 stabs.info: $(STABS_DOC_FILES)
399         $(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
400
401 # STABS DOCUMENTATION: HTML file
402
403 stabs_toc.html: $(STABS_DOC_FILES)
404         $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/stabs.texinfo
405
406 # Clean these up before each run.  Avoids a catch 22 with not being
407 # able to re-generate these files (to fix a corruption) because these
408 # files contain a corruption.
409 STABS_TEX_TMPS = stabs.aux stabs.cp* stabs.fn* stabs.ky* \
410         stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
411
412 # STABS DOCUMENTATION: TeX dvi file
413 stabs.dvi : $(STABS_DOC_FILES)
414         rm -f $(STABS_TEX_TMPS)
415         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/stabs.texinfo
416
417 stabs.ps: stabs.dvi
418         $(DVIPS) -o $@ $?
419
420 stabs.pdf: $(STABS_DOC_FILES)
421         rm -f $(STABS_TEX_TMPS)
422         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/stabs.texinfo
423
424 force:
425
426 Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag) config.status
427         $(SHELL) ./config.status
428
429
430 # The "least clean" level of cleaning.  Get rid of files which are
431 # automatically generated files that are just intermediate files,
432
433 mostlyclean:
434         rm -f gdb.mm gdb.ms gdb.me links2roff
435         rm -f $(GDB_TEX_TMPS)
436         rm -f $(GDBINT_TEX_TMPS)
437         rm -f $(STABS_TEX_TMPS)
438         rm -f sedref.dvi sedref.tex tmp.sed
439
440 clean: mostlyclean
441         rm -f gdb-cfg.texi
442
443 distclean: clean
444         rm -f Makefile config.status config.log
445
446 # GDBvn.texi, the dvi files, the info files, and the postscript files, 
447 # are all part of the distribution, so it should not be removed by
448 # "clean" or "distclean".  Use maintainer-clean to remove them.
449
450 maintainer-clean realclean: distclean
451         rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
452
453 install: install-info
454
455 uninstall: uninstall-info