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