1 ##Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003,
2 ##2007 Free Software Foundation, Inc.
4 # Makefile for GDB documentation.
5 # This file is part of GDB.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 pdfdir = $(prefix)/share/doc/gdb
28 htmldir = $(prefix)/html
35 INSTALL_PROGRAM = @INSTALL_PROGRAM@
36 INSTALL_DATA = @INSTALL_DATA@
38 mkinstalldirs = $(SHELL) $(srcdir)/../../mkinstalldirs
40 # main GDB source directory
43 # where to find texinfo; GDB dist should include a recent one
44 TEXIDIR=${gdbdir}/../texinfo
46 # where to find makeinfo, preferably one designed for texinfo-2
49 # Note that texinfo 4.0's makeinfo --html can only generate a
50 # single file, which would be too large, so continue to use
51 # texi2html. -sts 2000-03-28
54 MAKEHTMLFLAGS = -menu -split_chapter
56 # where to find texi2roff, ditto
59 # where to find texi2dvi, ditto
62 # Where is the source dir for the READLINE library doc?
63 # Traditionally readline is in .. or .
64 READLINE_DIR = ${gdbdir}/../readline/doc
66 # The GDB/MI docs come from a sibling directory ../mi
67 GDBMI_DIR = ${gdbdir}/mi
70 TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$(GDBMI_DIR):$$TEXINPUTS
72 # Files which should be generated via 'info' and installed by 'install-info'
73 INFO_DEPS = gdb.info gdbint.info stabs.info annotate.info
75 # Files which should be generated via 'pdf' and installed by 'install-pdf'
76 PDFFILES = gdb.pdf gdbint.pdf stabs.pdf refcard.pdf annotate.pdf
78 # There may be alternate predefined collections of switches to configure
79 # the GDB manual. Normally this is not done in synch with the software
80 # config system, since this choice tends to be independent; most people
81 # want a doc config of `all' for a generic manual, regardless of sw config.
84 # This list of sed edits will edit the GDB reference card
85 # for what fonts and what papersize to use.
86 # By default (NO edits applied), the refcard uses:
87 # - Computer Modern (CM) fonts
88 # - US letter paper (8.5x11in)
89 # List some of the following files for alternative fonts and paper:
90 # a4rc.sed use A4 paper (297 x 210 mm)
91 # psrc.sed use PostScript fonts (Karl Berry short TeX names)
92 # lpsrc.sed use PostScript fonts (full PostScript names in TeX)
93 # e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
94 # for A4, CM fonts: REFEDITS = a4rc.sed
95 # for US, PS fonts: REFEDITS = psrc.sed
99 # Don Knuth's TeX formatter
103 # Program to generate Postscript files from DVI files.
107 GDB_DOC_SOURCE_INCLUDES = \
110 $(srcdir)/agentexpr.texi \
111 $(READLINE_DIR)/rluser.texi \
112 $(READLINE_DIR)/inc-hist.texinfo
113 GDB_DOC_BUILD_INCLUDES = \
117 $(srcdir)/gdb.texinfo \
118 $(GDB_DOC_SOURCE_INCLUDES) \
119 $(GDB_DOC_BUILD_INCLUDES)
122 GDBINT_DOC_SOURCE_INCLUDES = \
124 $(srcdir)/observer.texi
125 GDBINT_DOC_BUILD_INCLUDES = \
129 $(srcdir)/gdbint.texinfo \
130 $(GDBINT_DOC_SOURCE_INCLUDES) \
131 $(GDBINT_DOC_BUILD_INCLUDES)
133 # Stabs manual: All files
134 STABS_DOC_SOURCE_INCLUDES = \
136 STABS_DOC_BUILD_INCLUDES =
138 $(srcdir)/stabs.texinfo \
139 $(STABS_DOC_SOURCE_INCLUDES) \
140 $(STABS_DOC_BUILD_INCLUDES)
142 # Annotate migration document
143 ANNOTATE_DOC_SOURCE_INCLUDES = \
145 ANNOTATE_DOC_BUILD_INCLUDES = \
147 ANNOTATE_DOC_FILES = \
148 $(srcdir)/annotate.texinfo \
149 $(ANNOTATE_DOC_SOURCE_INCLUDES) \
150 $(ANNOTATE_DOC_BUILD_INCLUDES)
152 #### Host, target, and site specific Makefile fragments come in here.
158 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi annotate.dvi
159 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
160 html: gdb_toc.html gdbint_toc.html stabs_toc.html annotate_toc.html
162 all-doc: info dvi ps # pdf
165 install-info: $(INFO_DEPS)
166 $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(infodir)
167 @list='$(INFO_DEPS)'; \
168 for file in $$list; do \
169 if test -f $$file; then d=.; else d=$(srcdir); fi; \
170 for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
171 if test -f $$d/$$ifile; then \
172 echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
173 $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
178 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
179 list='$(INFO_DEPS)'; \
180 for file in $$list; do \
181 echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
182 install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
188 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
191 list='$(INFO_DEPS)'; \
192 for file in $$list; do \
194 || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
197 list='$(INFO_DEPS)'; \
198 for file in $$list; do \
199 (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
203 for i in *.html ; do \
204 $(INSTALL_DATA) $$i $(DESTDIR)$(htmldir)/$$i ; \
207 pdf__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
209 install-pdf: $(PDFFILES)
211 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)"
212 @list='$(PDFFILES)'; for p in $$list; do \
213 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
214 f=$(pdf__strip_dir) \
215 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
216 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
219 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
221 # Copy the object files from a particular stage into a subdirectory.
224 -mv $(STAGESTUFF) stage1
228 -mv $(STAGESTUFF) stage2
232 -mv $(STAGESTUFF) stage3
237 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
240 -(cd stage1 ; mv -f * ..)
244 -(cd stage2 ; mv -f * ..)
248 -(cd stage3 ; mv -f * ..)
251 # GDB QUICK REFERENCE (dvi output)
252 refcard.dvi : refcard.tex $(REFEDITS)
254 for f in x $(REFEDITS) ; do \
255 test x$$f = xx && continue ; \
256 cat $(srcdir)/$$f >>tmp.sed ; \
258 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
259 $(SET_TEXINPUTS) $(TEX) sedref.tex
260 mv sedref.dvi refcard.dvi
261 rm -f sedref.log sedref.tex tmp.sed
263 refcard.ps : refcard.dvi
264 $(DVIPS) -t landscape -o $@ $?
266 refcard.pdf : refcard.tex $(REFEDITS)
268 for f in x $(REFEDITS) ; do \
269 test x$$f = xx && continue ; \
270 cat $(srcdir)/$$f >>tmp.sed ; \
272 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
273 $(SET_TEXINPUTS) $(PDFTEX) sedref.tex
274 mv sedref.pdf refcard.pdf
275 rm -f sedref.log sedref.tex tmp.sed
277 # File to record current GDB version number (copied from main dir version.in)
278 GDBvn.texi : ${gdbdir}/version.in
279 echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
280 mv GDBvn.new GDBvn.texi
283 .PRECIOUS: GDBvn.texi
285 # Choose configuration for GDB manual (normally `all'; normally not tied into
286 # `configure' script because most users prefer generic version of manual,
287 # not one for their binary config---which may not be specifically
289 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
290 (test "$(LN_S)" = "ln -s" && \
291 ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi) || \
292 ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
293 cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
295 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
296 # If your texinfo or makeinfo don't support these, get a new texinfo release
298 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
299 # Note that we can *generate* GDBvn.texi, but since we distribute one in the
300 # source directory for the benefit of people who *don't* use this makefile,
301 # VPATH will often tell make not to bother building it, because the one
302 # in the srcdir is up to date. (if not, then make should build one here).
304 # Clean these up before each run. Avoids a catch 22 with not being
305 # able to re-generate these files (to fix a corruption) because these
306 # files contain a corruption.
307 GDB_TEX_TMPS = gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
310 # GDB MANUAL: TeX dvi file
311 gdb.dvi: ${GDB_DOC_FILES}
312 if [ ! -f ./GDBvn.texi ]; then \
313 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
314 ln $(srcdir)/GDBvn.texi . || \
315 cp $(srcdir)/GDBvn.texi . ; else true; fi
316 rm -f $(GDB_TEX_TMPS)
317 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdb.texinfo
322 gdb.pdf: ${GDB_DOC_FILES}
323 if [ ! -f ./GDBvn.texi ]; then \
324 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
325 ln $(srcdir)/GDBvn.texi . || \
326 cp $(srcdir)/GDBvn.texi . ; else true; fi
327 rm -f $(GDB_TEX_TMPS)
328 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdb.texinfo
330 # GDB MANUAL: info file
331 gdb.info: ${GDB_DOC_FILES}
332 $(MAKEINFO) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
333 -o gdb.info $(srcdir)/gdb.texinfo
335 # GDB MANUAL: roff translations
336 # Try to use a recent texi2roff. v2 was put on prep in jan91.
337 # If you want an index, see texi2roff doc for postprocessing
338 # and add -i to texi2roff invocations below.
339 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
340 # corresponding -e lines when later texi2roff's are current)
341 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
342 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
343 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
344 # + @alphaenumerate is ridiculously new, turned into @enumerate
346 # texi2roff doesn't have a notion of include dirs, so we have to fake
347 # it out for gdb manual's include files---but only if not configured
349 links2roff: $(GDB_DOC_SOURCE_INCLUDES)
350 if [ ! -f gdb.texinfo ]; then \
351 (test "$(LN_S)" = "ln -s" && ln -s $(GDB_DOC_SOURCE_INCLUDES) .) || \
352 ln $(GDB_DOC_SOURCE_INCLUDES) . || \
353 cp $(GDB_DOC_SOURCE_INCLUDES) . ; \
357 # gdb manual suitable for [gtn]roff -me
358 gdb.me: $(GDB_DOC_FILES) links2roff
359 sed -e '/\\input texinfo/d' \
360 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
361 -e '/^@ifinfo/,/^@end ifinfo/d' \
365 -e 's/^@alphaenumerate/@enumerate/g' \
366 -e 's/^@end alphaenumerate/@end enumerate/g' \
367 $(srcdir)/gdb.texinfo | \
369 sed -e 's/---/\\(em/g' \
372 # gdb manual suitable for [gtn]roff -ms
373 gdb.ms: $(GDB_DOC_FILES) links2roff
374 sed -e '/\\input texinfo/d' \
375 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
376 -e '/^@ifinfo/,/^@end ifinfo/d' \
380 -e 's/^@alphaenumerate/@enumerate/g' \
381 -e 's/^@end alphaenumerate/@end enumerate/g' \
382 $(srcdir)/gdb.texinfo | \
384 sed -e 's/---/\\(em/g' \
387 # gdb manual suitable for [tn]roff -mm
388 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
389 # try leaving them in
390 gdb.mm: $(GDB_DOC_FILES) links2roff
391 sed -e '/\\input texinfo/d' \
392 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
393 -e '/^@ifinfo/,/^@end ifinfo/d' \
398 -e 's/^@alphaenumerate/@enumerate/g' \
399 -e 's/^@end alphaenumerate/@end enumerate/g' \
400 $(srcdir)/gdb.texinfo | \
402 sed -e 's/---/\\(em/g' \
405 # GDB MANUAL: HTML file
407 gdb_toc.html: ${GDB_DOC_FILES}
408 $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo
410 # Clean these up before each run. Avoids a catch 22 with not being
411 # able to re-generate these files (to fix a corruption) because these
412 # files contain a corruption.
413 GDBINT_TEX_TMPS = gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
414 gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
416 # GDB INTERNALS MANUAL: TeX dvi file
417 gdbint.dvi: $(GDBINT_DOC_FILES)
418 rm -f $(GDBINT_TEX_TMPS)
419 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdbint.texinfo
421 gdbint.ps : gdbint.dvi
424 gdbint.pdf: $(GDBINT_DOC_FILES)
425 rm -f $(GDBINT_TEX_TMPS)
426 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdbint.texinfo
428 # GDB INTERNALS MANUAL: info file
430 gdbint.info: $(GDBINT_DOC_FILES)
431 $(MAKEINFO) -I $(srcdir) -o gdbint.info $(srcdir)/gdbint.texinfo
433 # GDB INTERNALS MANUAL: HTML file
435 gdbint_toc.html: $(GDBINT_DOC_FILES)
436 $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/gdbint.texinfo
438 stabs.info: $(STABS_DOC_FILES)
439 $(MAKEINFO) -I $(srcdir) -o stabs.info $(srcdir)/stabs.texinfo
441 # STABS DOCUMENTATION: HTML file
443 stabs_toc.html: $(STABS_DOC_FILES)
444 $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/stabs.texinfo
446 # Clean these up before each run. Avoids a catch 22 with not being
447 # able to re-generate these files (to fix a corruption) because these
448 # files contain a corruption.
449 STABS_TEX_TMPS = stabs.aux stabs.cp* stabs.fn* stabs.ky* \
450 stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
452 # STABS DOCUMENTATION: TeX dvi file
453 stabs.dvi : $(STABS_DOC_FILES)
454 rm -f $(STABS_TEX_TMPS)
455 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/stabs.texinfo
460 stabs.pdf: $(STABS_DOC_FILES)
461 rm -f $(STABS_TEX_TMPS)
462 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/stabs.texinfo
464 # Clean these up before each run. Avoids a catch 22 with not being
465 # able to re-generate these files (to fix a corruption) because these
466 # files contain a corruption.
467 ANNOTATE_TEX_TMPS = annotate.aux annotate.cp* annotate.fn* annotate.ky* \
468 annotate.log annotate.pg* annotate.toc annotate.tp* annotate.vr*
470 # ANNOTATE DOCUMENTATION: TeX dvi file
471 annotate.dvi : $(ANNOTATE_DOC_FILES)
472 rm -f $(ANNOTATE_TEX_TMPS)
473 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/annotate.texinfo
475 annotate.ps: annotate.dvi
478 annotate.pdf: $(ANNOTATE_DOC_FILES)
479 rm -f $(ANNOTATE_TEX_TMPS)
480 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/annotate.texinfo
482 annotate.info: $(ANNOTATE_DOC_FILES)
483 $(MAKEINFO) -I $(srcdir) -o annotate.info $(srcdir)/annotate.texinfo
485 annotate_toc.html: $(ANNOTATE_DOC_FILES)
486 $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/annotate.texinfo
490 Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag) config.status
491 $(SHELL) ./config.status
494 # The "least clean" level of cleaning. Get rid of files which are
495 # automatically generated files that are just intermediate files,
498 rm -f gdb.mm gdb.ms gdb.me links2roff
499 rm -f $(GDB_TEX_TMPS)
500 rm -f $(GDBINT_TEX_TMPS)
501 rm -f $(STABS_TEX_TMPS)
502 rm -f $(ANNOTATE_TEX_TMPS)
503 rm -f sedref.dvi sedref.tex tmp.sed
509 rm -f Makefile config.status config.log
511 # GDBvn.texi, the dvi files, the info files, and the postscript files,
512 # are all part of the distribution, so it should not be removed by
513 # "clean" or "distclean". Use maintainer-clean to remove them.
515 maintainer-clean realclean: distclean
516 rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
518 install: install-info
520 uninstall: uninstall-info