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