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