* Makefile.in (DVIPS): New define, set to dvips.
[external/binutils.git] / gdb / doc / Makefile.in
1 ##Copyright (C) 1991, 1992 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 = .
21
22 prefix = /usr/local
23
24 infodir = $(prefix)/info
25
26 SHELL = /bin/sh
27
28 INSTALL = install -c
29 INSTALL_PROGRAM = $(INSTALL)
30 INSTALL_DATA = $(INSTALL)
31
32 # main GDB source directory
33 gdbdir = $(srcdir)/..
34
35 # where to find texinfo; GDB dist should include a recent one
36 TEXIDIR=${gdbdir}/../texinfo
37
38 # where to find makeinfo, preferably one designed for texinfo-2
39 MAKEINFO=makeinfo
40
41 # where to find texi2roff, ditto
42 TEXI2ROFF=texi2roff
43
44 # Where is the source dir for the READLINE library doc?  
45 # Traditionally readline is in .. or .
46 READLINE_DIR = ${gdbdir}/../readline/doc
47
48 SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS
49
50 # There may be alternate predefined collections of switches to configure
51 # the GDB manual.  Normally this is not done in synch with the software
52 # config system, since this choice tends to be independent; most people
53 # want a doc config of `all' for a generic manual, regardless of sw config.
54 DOC_CONFIG = all
55
56 # This list of sed edits will edit the GDB reference card
57 # for what fonts and what papersize to use.
58 # By default (NO edits applied), the refcard uses:
59 #    - Computer Modern (CM) fonts
60 #    - US letter paper (8.5x11in)
61 # List some of the following files for alternative fonts and paper:
62 #  a4rc.sed     use A4 paper (297 x 210 mm)
63 #  psrc.sed     use PostScript fonts (Karl Berry short TeX names)
64 # lpsrc.sed     use PostScript fonts (full PostScript names in TeX)
65 # e.g. for A4, Postscript:  REFEDITS = a4rc.sed psrc.sed
66 #      for A4, CM fonts:    REFEDITS = a4rc.sed
67 #      for US, PS fonts:    REFEDITS = psrc.sed
68 #      for default:
69 REFEDITS =
70
71 # Don Knuth's TeX formatter
72 TEX = tex
73
74 # auxiliary program for sorting Texinfo indices
75 TEXINDEX = texindex
76
77 # Program to generate Postscript files from DVI files.
78 DVIPS = dvips
79
80 # Main GDB manual's source files
81 SFILES_INCLUDED = gdb-cfg.texi $(srcdir)/remote.texi
82
83 SFILES_LOCAL = $(srcdir)/gdb.texinfo GDBvn.texi $(SFILES_INCLUDED)
84
85 SFILES_DOC = $(SFILES_LOCAL) \
86                 $(READLINE_DIR)/rluser.texinfo $(READLINE_DIR)/inc-hist.texi
87
88 #### Host, target, and site specific Makefile fragments come in here.
89 ###
90
91 all install:
92
93 info: gdb.info gdbint.info stabs.info
94 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi
95 ps: gdb.ps gdbint.ps stabs.ps refcard.ps
96 all-doc: info dvi ps
97
98 install-info: info
99         for i in *.info* ; do \
100                 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
101         done
102
103 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi
104
105 # Copy the object files from a particular stage into a subdirectory.
106 stage1: force
107         -mkdir stage1
108         -mv $(STAGESTUFF) stage1
109
110 stage2: force
111         -mkdir stage2
112         -mv $(STAGESTUFF) stage2
113
114 stage3: force
115         -mkdir stage3
116         -mv $(STAGESTUFF) stage3
117
118 against=stage2
119
120 comparison: force
121         for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
122
123 de-stage1: force
124         -(cd stage1 ; mv -f * ..)
125         -rmdir stage1
126
127 de-stage2: force
128         -(cd stage2 ; mv -f * ..)
129         -rmdir stage2
130
131 de-stage3: force
132         -(cd stage3 ; mv -f * ..)
133         -rmdir stage3
134
135 # The "least clean" level of cleaning.  Get rid of files which are
136 # automatically generated files that are just intermediate files,
137
138 mostlyclean:
139         rm -f gdb.mm gdb.ms gdb.me links2roff
140         rm -f *.aux *.cp* *.fn* *.ky* *.log *.pg* *.toc *.tp* *.vr*
141         rm -f sedref.dvi sedref.tex tmp.sed
142
143 clean: mostlyclean
144         rm -f rluser.texinfo inc-hist.texi gdb-cfg.texi
145
146 distclean: clean
147         rm -f Makefile config.status
148
149 # GDBvn.texi, the dvi files, the info files, and the postscript files, 
150 # are all part of the distribution, so it should not be removed by
151 # "clean" or "distclean".  Use maintainer-clean to remove them.
152
153 maintainer-clean realclean: distclean
154         rm -f GDBvn.texi *.info* *.dvi *.ps
155
156 # GDB QUICK REFERENCE (dvi output)
157 refcard.dvi : refcard.tex $(REFEDITS)
158         if [ -z "$(REFEDITS)" ]; then \
159                 cp $(srcdir)/refcard.tex sedref.tex ; \
160         else \
161                 echo > tmp.sed ; \
162                 for f in "$(REFEDITS)" ; do \
163                         cat $(srcdir)/$$f >>tmp.sed ; done ; \
164                 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex ; \
165         fi
166         $(SET_TEXINPUTS) $(TEX) sedref.tex
167         mv sedref.dvi refcard.dvi
168         rm -f sedref.log sedref.tex tmp.sed
169
170 refcard.ps : refcard.dvi
171         $(DVIPS) -t landscape -o $@ $?
172
173 # File to record current GDB version number (copied from main dir Makefile.in)
174 GDBvn.texi : ${gdbdir}/Makefile.in
175         echo "@set GDBVN `sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`" > ./GDBvn.new
176         mv GDBvn.new GDBvn.texi
177
178 # Updated atomically
179 .PRECIOUS: GDBvn.texi
180
181 # Choose configuration for GDB manual (normally `all'; normally not tied into
182 # `configure' script because most users prefer generic version of manual,
183 # not one for their binary config---which may not be specifically
184 # defined anyways).
185 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
186         ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
187         ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
188         cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
189
190 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
191 # If your texinfo or makeinfo don't support these, get a new texinfo release
192 #
193 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
194 #   Note that we can *generate* GDBvn.texi, but since we distribute one in the
195 #   source directory for the benefit of people who *don't* use this makefile,
196 #   VPATH will often tell make not to bother building it, because the one
197 #   in the srcdir is up to date.  (if not, then make should build one here).
198
199 # GDB MANUAL: TeX dvi file
200 gdb.dvi: ${SFILES_DOC}
201         if [ ! -f ./GDBvn.texi ]; then \
202                 ln -s $(srcdir)/GDBvn.texi . || \
203                 ln $(srcdir)/GDBvn.texi . || \
204                 cp $(srcdir)/GDBvn.texi . ; else true; fi
205         $(SET_TEXINPUTS) $(TEX) gdb.texinfo
206         $(SET_TEXINPUTS) $(TEX) gdb.texinfo
207         $(TEXINDEX) gdb.??
208         $(SET_TEXINPUTS) $(TEX) gdb.texinfo
209         rm -f gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
210                 gdb.tp* gdb.vr*
211
212 gdb.ps: gdb.dvi
213         $(DVIPS) -o $@ $?
214
215 # GDB MANUAL: info file
216 # We're using texinfo2, and older makeinfo's may not be able to
217 # cope with all the markup.  
218 gdb.info: ${SFILES_DOC}
219         $(MAKEINFO) -I ${READLINE_DIR} -I $(srcdir) -o ./gdb.info gdb.texinfo
220
221 # GDB MANUAL: roff translations
222 # Try to use a recent texi2roff.  v2 was put on prep in jan91.
223 # If you want an index, see texi2roff doc for postprocessing 
224 # and add -i to texi2roff invocations below.
225 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
226 #    corresponding -e lines when later texi2roff's are current)
227 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
228 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
229 # + @   (that's at-BLANK) not recognized by texi2roff, turned into blank
230 # + @alphaenumerate is ridiculously new, turned into @enumerate
231
232 # texi2roff doesn't have a notion of include dirs, so we have to fake 
233 # it out for gdb manual's include files---but only if not configured
234 # in main sourcedir.
235 links2roff: $(SFILES_INCLUDED)
236         if [ ! -f gdb.texinfo ]; then \
237                 ln -s $(SFILES_INCLUDED) . || \
238                 ln $(SFILES_INCLUDED)    . || \
239                 cp $(SFILES_INCLUDED)    . ; \
240         fi
241         touch links2roff
242
243 #  "Readline" appendices.  Get them also due to lack of includes, 
244 # regardless of whether or not configuring in main sourcedir.
245 # @ftable removed due to bug in texi2roff-2; if your texi2roff
246 # is newer, try just ln or cp
247 rluser.texinfo: ${READLINE_DIR}/rluser.texinfo
248                 sed -e 's/^@ftable/@table/g' \
249                 -e 's/^@end ftable/@end table/g' \
250                 ${READLINE_DIR}/rluser.texinfo > ./rluser.texinfo
251
252 inc-hist.texi: ${READLINE_DIR}/inc-hist.texi
253         ln -s ${READLINE_DIR}/inc-hist.texi . || \
254         ln ${READLINE_DIR}/inc-hist.texi . || \
255         cp ${READLINE_DIR}/inc-hist.texi .
256
257 # gdb manual suitable for [gtn]roff -me
258 gdb.me: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
259         sed -e '/\\input texinfo/d' \
260                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
261                 -e '/^@ifinfo/,/^@end ifinfo/d' \
262                 -e '/^@c /d' \
263                 -e 's/{.*,,/{/' \
264                 -e 's/@ / /g' \
265                 -e 's/^@alphaenumerate/@enumerate/g' \
266                 -e 's/^@end alphaenumerate/@end enumerate/g' \
267                 $(srcdir)/gdb.texinfo | \
268         $(TEXI2ROFF) -me | \
269         sed -e 's/---/\\(em/g' \
270         >gdb.me 
271
272 # gdb manual suitable for [gtn]roff -ms
273 gdb.ms: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
274         sed -e '/\\input texinfo/d' \
275                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
276                 -e '/^@ifinfo/,/^@end ifinfo/d' \
277                 -e '/^@c /d' \
278                 -e 's/{.*,,/{/' \
279                 -e 's/@ / /g' \
280                 -e 's/^@alphaenumerate/@enumerate/g' \
281                 -e 's/^@end alphaenumerate/@end enumerate/g' \
282                 $(srcdir)/gdb.texinfo | \
283         $(TEXI2ROFF) -ms | \
284         sed -e 's/---/\\(em/g' \
285         >gdb.ms 
286
287 # gdb manual suitable for [tn]roff -mm
288 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer, 
289 #   try leaving them in
290 gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
291         sed -e '/\\input texinfo/d' \
292                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
293                 -e '/^@ifinfo/,/^@end ifinfo/d' \
294                 -e '/^@c /d' \
295                 -e 's/{.*,,/{/' \
296                 -e '/@noindent/d' \
297                 -e 's/@ / /g' \
298                 -e 's/^@alphaenumerate/@enumerate/g' \
299                 -e 's/^@end alphaenumerate/@end enumerate/g' \
300                 $(srcdir)/gdb.texinfo | \
301         $(TEXI2ROFF) -mm | \
302         sed -e 's/---/\\(em/g' \
303         >gdb.mm 
304
305 # start-sanitize-gdbtk
306 # GDB GUI MANUAL: TeX dvi file
307 gdbgui.dvi : gdbgui.texinfo ${SFILES_DOC}
308         $(SET_TEXINPUTS) $(TEX) gdbgui.texinfo
309         $(TEXINDEX) gdbgui.??
310         $(SET_TEXINPUTS) $(TEX) gdbgui.texinfo
311         rm -f gdbgui.aux gdbgui.cp* gdbgui.fn* gdbgui.ky* \
312                 gdbgui.log gdbgui.pg* gdbgui.toc gdbgui.tp* gdbgui.vr*
313
314 # GDB GUI MANUAL: info file
315 gdb-gui: gdbgui.info
316
317 gdbgui.info: gdbgui.texinfo ${SFILES_DOC}
318         $(MAKEINFO) -o gdbgui.info $(srcdir)/gdbgui.texinfo
319 # end-sanitize-gdbtk
320
321 # GDB INTERNALS MANUAL: TeX dvi file
322 gdbint.dvi : gdbint.texinfo
323         $(SET_TEXINPUTS) $(TEX) gdbint.texinfo
324         $(TEXINDEX) gdbint.??
325         $(SET_TEXINPUTS) $(TEX) gdbint.texinfo
326         rm -f gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
327                 gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
328
329 gdbint.ps : gdbint.dvi
330         $(DVIPS) -o $@ $?
331
332 # GDB INTERNALS MANUAL: info file
333
334 gdbint.info: gdbint.texinfo
335         $(MAKEINFO) -o gdbint.info $(srcdir)/gdbint.texinfo
336
337 stabs.info: stabs.texinfo
338         $(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
339
340 # STABS DOCUMENTATION: TeX dvi file
341 stabs.dvi : stabs.texinfo
342         $(SET_TEXINPUTS) $(TEX) stabs.texinfo
343         $(TEXINDEX) stabs.??
344         $(SET_TEXINPUTS) $(TEX) stabs.texinfo
345         rm -f stabs.aux stabs.cp* stabs.fn* stabs.ky* \
346                 stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
347
348 stabs.ps: stabs.dvi
349         $(DVIPS) -o $@ $?
350
351 force:
352
353 Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag) config.status
354         $(SHELL) ./config.status