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