2003-07-28 Andrew Cagney <cagney@redhat.com>
[platform/upstream/binutils.git] / gdb / doc / Makefile.in
1 ##Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003
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 annotate.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)/fdl.texi \
102         $(srcdir)/gpl.texi \
103         $(srcdir)/agentexpr.texi \
104         $(READLINE_DIR)/rluser.texinfo \
105         $(READLINE_DIR)/inc-hist.texinfo
106 GDB_DOC_BUILD_INCLUDES = \
107         gdb-cfg.texi \
108         GDBvn.texi
109 GDB_DOC_FILES = \
110         $(srcdir)/gdb.texinfo \
111         $(GDB_DOC_SOURCE_INCLUDES) \
112         $(GDB_DOC_BUILD_INCLUDES)
113
114 # Internals Manual
115 GDBINT_DOC_SOURCE_INCLUDES = \
116         $(srcdir)/fdl.texi \
117         $(srcdir)/observer.texi
118 GDBINT_DOC_BUILD_INCLUDES = \
119         gdb-cfg.texi \
120         GDBvn.texi
121 GDBINT_DOC_FILES = \
122         $(srcdir)/gdbint.texinfo \
123         $(GDBINT_DOC_SOURCE_INCLUDES) \
124         $(GDBINT_DOC_BUILD_INCLUDES)
125
126 # Stabs manual: All files
127 STABS_DOC_SOURCE_INCLUDES =
128 STABS_DOC_BUILD_INCLUDES =
129 STABS_DOC_FILES = \
130         $(srcdir)/stabs.texinfo \
131         $(STABS_DOC_SOURCE_INCLUDES) \
132         $(STABS_DOC_BUILD_INCLUDES)
133
134 # Annotate migration document
135 ANNOTATE_DOC_SOURCE_INCLUDES = \
136         $(srcdir)/fdl.texi
137 ANNOTATE_DOC_BUILD_INCLUDES = \
138         gdb-cfg.texi
139 ANNOTATE_DOC_FILES = \
140         $(srcdir)/annotate.texinfo \
141         $(ANNOTATE_DOC_SOURCE_INCLUDES) \
142         $(ANNOTATE_DOC_BUILD_INCLUDES)
143
144 #### Host, target, and site specific Makefile fragments come in here.
145 ###
146
147 all:
148
149 info: $(INFO_DEPS)
150 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi annotate.dvi
151 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
152 html: gdb_toc.html gdbint_toc.html stabs_toc.html annotate.html
153 pdf: gdb.pdf gdbint.pdf stabs.pdf annotate.pdf
154 all-doc: info dvi ps # pdf
155 diststuff: info
156
157 install-info: $(INFO_DEPS)
158         $(SHELL) $(srcdir)/../../mkinstalldirs $(infodir)
159         @list='$(INFO_DEPS)'; \
160         for file in $$list; do \
161           if test -f $$file; then d=.; else d=$(srcdir); fi; \
162           for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
163             if test -f $$d/$$ifile; then \
164               echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
165               $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
166             else : ; fi; \
167           done; \
168         done
169         $(POST_INSTALL)
170         @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
171           list='$(INFO_DEPS)'; \
172           for file in $$list; do \
173             echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
174             install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
175           done; \
176         else : ; fi
177
178 uninstall-info:
179         $(PRE_UNINSTALL)
180         @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
181           ii=yes; \
182         else ii=; fi; \
183         list='$(INFO_DEPS)'; \
184         for file in $$list; do \
185           test -z "$$ii" \
186             || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
187         done
188         $(NORMAL_UNINSTALL)
189         list='$(INFO_DEPS)'; \
190         for file in $$list; do \
191           (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
192         done
193
194 install-html: html
195         for i in *.html ; do \
196                 $(INSTALL_DATA) $$i $(htmldir)/$$i ; \
197         done
198
199 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
200
201 # Copy the object files from a particular stage into a subdirectory.
202 stage1: force
203         -mkdir stage1
204         -mv $(STAGESTUFF) stage1
205
206 stage2: force
207         -mkdir stage2
208         -mv $(STAGESTUFF) stage2
209
210 stage3: force
211         -mkdir stage3
212         -mv $(STAGESTUFF) stage3
213
214 against=stage2
215
216 comparison: force
217         for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
218
219 de-stage1: force
220         -(cd stage1 ; mv -f * ..)
221         -rmdir stage1
222
223 de-stage2: force
224         -(cd stage2 ; mv -f * ..)
225         -rmdir stage2
226
227 de-stage3: force
228         -(cd stage3 ; mv -f * ..)
229         -rmdir stage3
230
231 # GDB QUICK REFERENCE (dvi output)
232 refcard.dvi : refcard.tex $(REFEDITS)
233         echo > tmp.sed
234         for f in x $(REFEDITS) ; do \
235                 test x$$f = xx && continue ; \
236                 cat $(srcdir)/$$f >>tmp.sed ; \
237         done
238         sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
239         $(SET_TEXINPUTS) $(TEX) sedref.tex
240         mv sedref.dvi refcard.dvi
241         rm -f sedref.log sedref.tex tmp.sed
242
243 refcard.ps : refcard.dvi
244         $(DVIPS) -t landscape -o $@ $?
245
246 # File to record current GDB version number (copied from main dir version.in)
247 GDBvn.texi : ${gdbdir}/version.in
248         echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
249         mv GDBvn.new GDBvn.texi
250
251 # Updated atomically
252 .PRECIOUS: GDBvn.texi
253
254 # Choose configuration for GDB manual (normally `all'; normally not tied into
255 # `configure' script because most users prefer generic version of manual,
256 # not one for their binary config---which may not be specifically
257 # defined anyways).
258 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
259         (test "$(LN_S)" = "ln -s" && \
260           ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi) || \
261         ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
262         cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
263
264 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
265 # If your texinfo or makeinfo don't support these, get a new texinfo release
266 #
267 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
268 #   Note that we can *generate* GDBvn.texi, but since we distribute one in the
269 #   source directory for the benefit of people who *don't* use this makefile,
270 #   VPATH will often tell make not to bother building it, because the one
271 #   in the srcdir is up to date.  (if not, then make should build one here).
272
273 # Clean these up before each run.  Avoids a catch 22 with not being
274 # able to re-generate these files (to fix a corruption) because these
275 # files contain a corruption.
276 GDB_TEX_TMPS = gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
277         gdb.tp* gdb.vr*
278
279 # GDB MANUAL: TeX dvi file
280 gdb.dvi: ${GDB_DOC_FILES}
281         if [ ! -f ./GDBvn.texi ]; then \
282                 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
283                 ln $(srcdir)/GDBvn.texi . || \
284                 cp $(srcdir)/GDBvn.texi . ; else true; fi
285         rm -f $(GDB_TEX_TMPS)
286         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdb.texinfo
287
288 gdb.ps: gdb.dvi
289         $(DVIPS) -o $@ $?
290
291 gdb.pdf: ${GDB_DOC_FILES}
292         if [ ! -f ./GDBvn.texi ]; then \
293                 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
294                 ln $(srcdir)/GDBvn.texi . || \
295                 cp $(srcdir)/GDBvn.texi . ; else true; fi
296         rm -f $(GDB_TEX_TMPS)
297         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdb.texinfo
298
299 # GDB MANUAL: info file
300 gdb.info: ${GDB_DOC_FILES}
301         $(MAKEINFO) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
302                 -o gdb.info $(srcdir)/gdb.texinfo
303
304 # GDB MANUAL: roff translations
305 # Try to use a recent texi2roff.  v2 was put on prep in jan91.
306 # If you want an index, see texi2roff doc for postprocessing 
307 # and add -i to texi2roff invocations below.
308 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
309 #    corresponding -e lines when later texi2roff's are current)
310 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
311 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
312 # + @   (that's at-BLANK) not recognized by texi2roff, turned into blank
313 # + @alphaenumerate is ridiculously new, turned into @enumerate
314
315 # texi2roff doesn't have a notion of include dirs, so we have to fake 
316 # it out for gdb manual's include files---but only if not configured
317 # in main sourcedir.
318 links2roff: $(GDB_DOC_SOURCE_INCLUDES)
319         if [ ! -f gdb.texinfo ]; then \
320                 (test "$(LN_S)" = "ln -s" && ln -s $(GDB_DOC_SOURCE_INCLUDES) .) || \
321                 ln $(GDB_DOC_SOURCE_INCLUDES)    . || \
322                 cp $(GDB_DOC_SOURCE_INCLUDES)    . ; \
323         fi
324         touch links2roff
325
326 # gdb manual suitable for [gtn]roff -me
327 gdb.me: $(GDB_DOC_FILES) links2roff
328         sed -e '/\\input texinfo/d' \
329                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
330                 -e '/^@ifinfo/,/^@end ifinfo/d' \
331                 -e '/^@c /d' \
332                 -e 's/{.*,,/{/' \
333                 -e 's/@ / /g' \
334                 -e 's/^@alphaenumerate/@enumerate/g' \
335                 -e 's/^@end alphaenumerate/@end enumerate/g' \
336                 $(srcdir)/gdb.texinfo | \
337         $(TEXI2ROFF) -me | \
338         sed -e 's/---/\\(em/g' \
339         >gdb.me 
340
341 # gdb manual suitable for [gtn]roff -ms
342 gdb.ms: $(GDB_DOC_FILES) links2roff
343         sed -e '/\\input texinfo/d' \
344                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
345                 -e '/^@ifinfo/,/^@end ifinfo/d' \
346                 -e '/^@c /d' \
347                 -e 's/{.*,,/{/' \
348                 -e 's/@ / /g' \
349                 -e 's/^@alphaenumerate/@enumerate/g' \
350                 -e 's/^@end alphaenumerate/@end enumerate/g' \
351                 $(srcdir)/gdb.texinfo | \
352         $(TEXI2ROFF) -ms | \
353         sed -e 's/---/\\(em/g' \
354         >gdb.ms 
355
356 # gdb manual suitable for [tn]roff -mm
357 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer, 
358 #   try leaving them in
359 gdb.mm: $(GDB_DOC_FILES) links2roff
360         sed -e '/\\input texinfo/d' \
361                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
362                 -e '/^@ifinfo/,/^@end ifinfo/d' \
363                 -e '/^@c /d' \
364                 -e 's/{.*,,/{/' \
365                 -e '/@noindent/d' \
366                 -e 's/@ / /g' \
367                 -e 's/^@alphaenumerate/@enumerate/g' \
368                 -e 's/^@end alphaenumerate/@end enumerate/g' \
369                 $(srcdir)/gdb.texinfo | \
370         $(TEXI2ROFF) -mm | \
371         sed -e 's/---/\\(em/g' \
372         >gdb.mm 
373
374 # GDB MANUAL: HTML file
375
376 gdb_toc.html: ${GDB_DOC_FILES}
377         $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo
378
379 # Clean these up before each run.  Avoids a catch 22 with not being
380 # able to re-generate these files (to fix a corruption) because these
381 # files contain a corruption.
382 GDBINT_TEX_TMPS = gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
383         gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
384
385 # GDB INTERNALS MANUAL: TeX dvi file
386 gdbint.dvi: $(GDBINT_DOC_FILES)
387         rm -f $(GDBINT_TEX_TMPS)
388         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdbint.texinfo
389
390 gdbint.ps : gdbint.dvi
391         $(DVIPS) -o $@ $?
392
393 gdbint.pdf: $(GDBINT_DOC_FILES)
394         rm -f $(GDBINT_TEX_TMPS)
395         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdbint.texinfo
396
397 # GDB INTERNALS MANUAL: info file
398
399 gdbint.info: $(GDBINT_DOC_FILES)
400         $(MAKEINFO) -I $(srcdir) -o gdbint.info $(srcdir)/gdbint.texinfo
401
402 # GDB INTERNALS MANUAL: HTML file
403
404 gdbint_toc.html: $(GDBINT_DOC_FILES)
405         $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/gdbint.texinfo
406
407 stabs.info: $(STABS_DOC_FILES)
408         $(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
409
410 # STABS DOCUMENTATION: HTML file
411
412 stabs_toc.html: $(STABS_DOC_FILES)
413         $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/stabs.texinfo
414
415 # Clean these up before each run.  Avoids a catch 22 with not being
416 # able to re-generate these files (to fix a corruption) because these
417 # files contain a corruption.
418 STABS_TEX_TMPS = stabs.aux stabs.cp* stabs.fn* stabs.ky* \
419         stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
420
421 # STABS DOCUMENTATION: TeX dvi file
422 stabs.dvi : $(STABS_DOC_FILES)
423         rm -f $(STABS_TEX_TMPS)
424         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/stabs.texinfo
425
426 stabs.ps: stabs.dvi
427         $(DVIPS) -o $@ $?
428
429 stabs.pdf: $(STABS_DOC_FILES)
430         rm -f $(STABS_TEX_TMPS)
431         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/stabs.texinfo
432
433 # Clean these up before each run.  Avoids a catch 22 with not being
434 # able to re-generate these files (to fix a corruption) because these
435 # files contain a corruption.
436 ANNOTATE_TEX_TMPS = annotate.aux annotate.cp* annotate.fn* annotate.ky* \
437         annotate.log annotate.pg* annotate.toc annotate.tp* annotate.vr*
438
439 # ANNOTATE DOCUMENTATION: TeX dvi file
440 annotate.dvi : $(ANNOTATE_DOC_FILES)
441         rm -f $(ANNOTATE_TEX_TMPS)
442         $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/annotate.texinfo
443
444 annotate.ps: annotate.dvi
445         $(DVIPS) -o $@ $?
446
447 annotate.pdf: $(ANNOTATE_DOC_FILES)
448         rm -f $(ANNOTATE_TEX_TMPS)
449         $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/annotate.texinfo
450
451 annotate.info: $(ANNOTATE_DOC_FILES)
452         $(MAKEINFO)  -I $(srcdir) -o annotate.info $(srcdir)/annotate.texinfo
453
454 annotate_toc.html: $(ANNOTATE_DOC_FILES)
455         $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/annotate.texinfo
456
457 force:
458
459 Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag) config.status
460         $(SHELL) ./config.status
461
462
463 # The "least clean" level of cleaning.  Get rid of files which are
464 # automatically generated files that are just intermediate files,
465
466 mostlyclean:
467         rm -f gdb.mm gdb.ms gdb.me links2roff
468         rm -f $(GDB_TEX_TMPS)
469         rm -f $(GDBINT_TEX_TMPS)
470         rm -f $(STABS_TEX_TMPS)
471         rm -f $(ANNOTATE_TEX_TMPS)
472         rm -f sedref.dvi sedref.tex tmp.sed
473
474 clean: mostlyclean
475         rm -f gdb-cfg.texi
476
477 distclean: clean
478         rm -f Makefile config.status config.log
479
480 # GDBvn.texi, the dvi files, the info files, and the postscript files, 
481 # are all part of the distribution, so it should not be removed by
482 # "clean" or "distclean".  Use maintainer-clean to remove them.
483
484 maintainer-clean realclean: distclean
485         rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
486
487 install: install-info
488
489 uninstall: uninstall-info