* Makefile.in (GDBvn.texi): Update atomically.
[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., 675 Mass Ave, Cambridge, MA 02139, 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 DOC_CONFIG = all
51
52 # Don Knuth's TeX formatter
53 TEX = tex
54
55 # auxiliary program for sorting Texinfo indices
56 TEXINDEX = texindex
57
58 # Main GDB manual's source files
59 SFILES_INCLUDED = gdb-config.texi $(srcdir)/gdbinv-s.texi
60
61 SFILES_LOCAL = $(srcdir)/gdb.texinfo GDBvn.texi $(SFILES_INCLUDED)
62
63 SFILES_DOC = $(SFILES_LOCAL) \
64                 $(READLINE_DIR)/rluser.texinfo $(READLINE_DIR)/inc-hist.texi
65
66 #### Host, target, and site specific Makefile fragments come in here.
67 ###
68
69 all install:
70
71 info: gdb.info gdbint.info stabs.info
72 dvi: gdb.dvi refcard.dvi gdbint.dvi
73 all-doc: gdb.info gdb.dvi refcard.dvi gdb-internals gdbint.dvi
74
75 install-info: info
76         -parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
77         if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
78         -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
79         for i in *.info* ; do \
80                 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
81         done
82
83 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi
84
85 # Copy the object files from a particular stage into a subdirectory.
86 stage1: force
87         -mkdir stage1
88         -mv $(STAGESTUFF) stage1
89
90 stage2: force
91         -mkdir stage2
92         -mv $(STAGESTUFF) stage2
93
94 stage3: force
95         -mkdir stage3
96         -mv $(STAGESTUFF) stage3
97
98 against=stage2
99
100 comparison: force
101         for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
102
103 de-stage1: force
104         -(cd stage1 ; mv -f * ..)
105         -rmdir stage1
106
107 de-stage2: force
108         -(cd stage2 ; mv -f * ..)
109         -rmdir stage2
110
111 de-stage3: force
112         -(cd stage3 ; mv -f * ..)
113         -rmdir stage3
114
115 clean-info:
116         rm -f gdb.info* gdbint.info* stabs.info*
117
118 clean-dvi:
119         rm -f gdb.dvi refcard.dvi gdbint.dvi stabs.dvi psref.dvi
120         
121 mostlyclean: clean-info clean-dvi
122         rm -f gdb.?? gdb.??? gdb.mm gdb.ms gdb.me
123         rm -f links2roff
124         rm -f refcard.ps lrefcard.ps refcard.log psref.* *~
125         rm -f gdbint.?? gdbint.??? stabs.?? stabs.???
126
127 clean: mostlyclean
128         rm -f GDBvn.texi rluser.texinfo inc-hist.texi
129
130 distclean: clean
131         rm -f Makefile config.status
132
133 realclean: distclean
134
135
136 # GDB QUICK REFERENCE (TeX dvi file, CM fonts)
137 refcard.dvi : $(srcdir)/refcard.tex
138         $(SET_TEXINPUTS) $(TEX) refcard.tex; rm -f refcard.log 
139         rm -f rcfonts.tex
140
141 # GDB QUICK REFERENCE (PostScript output, common PS fonts)
142 refcard.ps : $(srcdir)/refcard.tex $(srcdir)/psrc.sed
143         sed -f $(srcdir)/psrc.sed $(srcdir)/refcard.tex >psref.tex
144         $(SET_TEXINPUTS) $(TEX) psref.tex
145         dvips -t landscape psref -o; mv psref.ps refcard.ps
146         rm -f psref.dvi psref.log psref.tex
147
148 # GDB QUICK REFERENCE (PostScript output, common PS fonts w/long names)
149 lrefcard.ps : $(srcdir)/refcard.tex $(srcdir)/lpsrc.sed
150         sed -f $(srcdir)/lpsrc.sed $(srcdir)/refcard.tex >psref.tex
151         $(SET_TEXINPUTS) $(TEX) psref.tex
152         dvips -t landscape psref -o; mv psref.ps lrefcard.ps
153         rm -f psref.dvi psref.log psref.tex
154
155 # File to record current GDB version number (copied from main dir Makefile.in)
156 GDBvn.texi : ${gdbdir}/Makefile.in
157         echo "@set GDBVN `sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`" > ./GDBvn.new
158         mv GDBvn.new GDBvn.texi
159
160 # Updated atomically
161 .PRECIOUS: GDBvn.texi
162
163 # Choose configuration for GDB manual (normally `all'; normally not tied into
164 # `configure' script because most users prefer generic version of manual,
165 # not one for their binary config---which may not be specifically
166 # defined anyways).
167 gdb-config.texi: ${srcdir}/${DOC_CONFIG}-config.texi
168         ln -s ${srcdir}/${DOC_CONFIG}-config.texi gdb-config.texi || \
169         ln ${srcdir}/${DOC_CONFIG}-config.texi gdb-config.texi || \
170         cp ${srcdir}/${DOC_CONFIG}-config.texi gdb-config.texi
171
172 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
173 # If your texinfo or makeinfo don't support these, get a new texinfo release
174 #
175 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
176 #   Note that we can *generate* GDBvn.texi, but since we distribute one in the
177 #   source directory for the benefit of people who *don't* use this makefile,
178 #   VPATH will often tell make not to bother building it, because the one
179 #   in the srcdir is up to date.  (if not, then make should build one here).
180
181 # GDB MANUAL: TeX dvi file
182 gdb.dvi: ${SFILES_DOC}
183         if [ ! -f ./GDBvn.texi ]; then \
184                 ln -s $(srcdir)/GDBvn.texi . || \
185                 ln $(srcdir)/GDBvn.texi . || \
186                 cp $(srcdir)/GDBvn.texi . ; else true; fi
187         $(SET_TEXINPUTS) $(TEX) gdb.texinfo
188         $(SET_TEXINPUTS) $(TEX) gdb.texinfo
189         $(TEXINDEX) gdb.??
190         $(SET_TEXINPUTS) $(TEX) gdb.texinfo
191         rm -f gdb.?? gdb.log gdb.aux gdb.toc gdb.??s
192
193 # GDB MANUAL: info file
194 # We're using texinfo2, and older makeinfo's may not be able to
195 # cope with all the markup.  
196 gdb.info: ${SFILES_DOC}
197         $(MAKEINFO) -I ${READLINE_DIR} -I $(srcdir) -o ./gdb.info gdb.texinfo
198
199 # GDB MANUAL: roff translations
200 # Try to use a recent texi2roff.  v2 was put on prep in jan91.
201 # If you want an index, see texi2roff doc for postprocessing 
202 # and add -i to texi2roff invocations below.
203 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
204 #    corresponding -e lines when later texi2roff's are current)
205 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
206 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
207 # + @   (that's at-BLANK) not recognized by texi2roff, turned into blank
208 # + @alphaenumerate is ridiculously new, turned into @enumerate
209
210 # texi2roff doesn't have a notion of include dirs, so we have to fake 
211 # it out for gdb manual's include files---but only if not configured
212 # in main sourcedir.
213 links2roff: $(SFILES_INCLUDED)
214         if [ ! -f gdb.texinfo ]; then \
215                 ln -s $(SFILES_INCLUDED) . || \
216                 ln $(SFILES_INCLUDED)    . || \
217                 cp $(SFILES_INCLUDED)    . ; \
218         fi
219         touch links2roff
220
221 #  "Readline" appendices.  Get them also due to lack of includes, 
222 # regardless of whether or not configuring in main sourcedir.
223 # @ftable removed due to bug in texi2roff-2; if your texi2roff
224 # is newer, try just ln or cp
225 rluser.texinfo: ${READLINE_DIR}/rluser.texinfo
226                 sed -e 's/^@ftable/@table/g' \
227                 -e 's/^@end ftable/@end table/g' \
228                 ${READLINE_DIR}/rluser.texinfo > ./rluser.texinfo
229
230 inc-hist.texi: ${READLINE_DIR}/inc-hist.texi
231         ln -s ${READLINE_DIR}/inc-hist.texi . || \
232         ln ${READLINE_DIR}/inc-hist.texi . || \
233         cp ${READLINE_DIR}/inc-hist.texi .
234
235 # gdb manual suitable for [gtn]roff -me
236 gdb.me: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
237         sed -e '/\\input texinfo/d' \
238                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
239                 -e '/^@ifinfo/,/^@end ifinfo/d' \
240                 -e '/^@c /d' \
241                 -e 's/{.*,,/{/' \
242                 -e 's/@ / /g' \
243                 -e 's/^@alphaenumerate/@enumerate/g' \
244                 -e 's/^@end alphaenumerate/@end enumerate/g' \
245                 $(srcdir)/gdb.texinfo | \
246         $(TEXI2ROFF) -me | \
247         sed -e 's/---/\\(em/g' \
248         >gdb.me 
249
250 # gdb manual suitable for [gtn]roff -ms
251 gdb.ms: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
252         sed -e '/\\input texinfo/d' \
253                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
254                 -e '/^@ifinfo/,/^@end ifinfo/d' \
255                 -e '/^@c /d' \
256                 -e 's/{.*,,/{/' \
257                 -e 's/@ / /g' \
258                 -e 's/^@alphaenumerate/@enumerate/g' \
259                 -e 's/^@end alphaenumerate/@end enumerate/g' \
260                 $(srcdir)/gdb.texinfo | \
261         $(TEXI2ROFF) -ms | \
262         sed -e 's/---/\\(em/g' \
263         >gdb.ms 
264
265 # gdb manual suitable for [tn]roff -mm
266 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer, 
267 #   try leaving them in
268 gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
269         sed -e '/\\input texinfo/d' \
270                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
271                 -e '/^@ifinfo/,/^@end ifinfo/d' \
272                 -e '/^@c /d' \
273                 -e 's/{.*,,/{/' \
274                 -e '/@noindent/d' \
275                 -e 's/@ / /g' \
276                 -e 's/^@alphaenumerate/@enumerate/g' \
277                 -e 's/^@end alphaenumerate/@end enumerate/g' \
278                 $(srcdir)/gdb.texinfo | \
279         $(TEXI2ROFF) -mm | \
280         sed -e 's/---/\\(em/g' \
281         >gdb.mm 
282
283 # GDB INTERNALS MANUAL: TeX dvi file
284 gdbint.dvi : gdbint.texinfo
285         $(SET_TEXINPUTS) $(TEX) gdbint.texinfo
286         $(TEXINDEX) gdbint.??
287         $(SET_TEXINPUTS) $(TEX) gdbint.texinfo
288         rm -f gdbint.?? gdbint.aux gdbint.cps gdbint.fns gdbint.kys \
289                 gdbint.log gdbint.pgs gdbint.toc gdbint.tps gdbint.vrs
290
291 # GDB INTERNALS MANUAL: info file
292 gdb-internals: gdbint.info
293
294 gdbint.info: gdbint.texinfo
295         $(MAKEINFO) -o gdbint.info $(srcdir)/gdbint.texinfo
296
297 stabs.info: stabs.texinfo
298         $(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
299
300 # STABS DOCUMENTATION: TeX dvi file
301 stabs.dvi : stabs.texinfo
302         $(SET_TEXINPUTS) $(TEX) stabs.texinfo
303         $(TEXINDEX) stabs.??
304         $(SET_TEXINPUTS) $(TEX) stabs.texinfo
305         rm -f stabs.?? stabs.aux stabs.cps stabs.fns stabs.kys \
306                 stabs.log stabs.pgs stabs.toc stabs.tps stabs.vrs
307
308 stabs.ps: stabs.dvi
309         dvips -o stabs.ps stabs
310
311 force:
312
313 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
314         $(SHELL) ./config.status