1 ##Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003,
2 ##2007, 2008, 2009 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.
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 MAKEHTML = $(MAKEINFO) --html
52 # where to find texi2roff, ditto
55 # where to find texi2dvi, ditto
58 # Package version and bug-reporting URL.
59 PKGVERSION = @PKGVERSION@
60 BUGURL_TEXI = @REPORT_BUGS_TEXI@
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
77 # Files which should be generated via 'html' and installed by 'install-html'
78 HTMLFILES = gdb/index.html gdbint/index.html stabs/index.html annotate/index.html
79 HTMLFILES_INSTALL = gdb gdbint stabs annotate
81 # There may be alternate predefined collections of switches to configure
82 # the GDB manual. Normally this is not done in synch with the software
83 # config system, since this choice tends to be independent; most people
84 # want a doc config of `all' for a generic manual, regardless of sw config.
87 # This list of sed edits will edit the GDB reference card
88 # for what fonts and what papersize to use.
89 # By default (NO edits applied), the refcard uses:
90 # - Computer Modern (CM) fonts
91 # - US letter paper (8.5x11in)
92 # List some of the following files for alternative fonts and paper:
93 # a4rc.sed use A4 paper (297 x 210 mm)
94 # psrc.sed use PostScript fonts (Karl Berry short TeX names)
95 # lpsrc.sed use PostScript fonts (full PostScript names in TeX)
96 # e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
97 # for A4, CM fonts: REFEDITS = a4rc.sed
98 # for US, PS fonts: REFEDITS = psrc.sed
102 # Don Knuth's TeX formatter
106 # Program to generate Postscript files from DVI files.
110 GDB_DOC_SOURCE_INCLUDES = \
113 $(srcdir)/agentexpr.texi \
114 $(READLINE_DIR)/rluser.texi \
115 $(READLINE_DIR)/inc-hist.texinfo
116 GDB_DOC_BUILD_INCLUDES = \
120 $(srcdir)/gdb.texinfo \
121 $(GDB_DOC_SOURCE_INCLUDES) \
122 $(GDB_DOC_BUILD_INCLUDES)
125 GDBINT_DOC_SOURCE_INCLUDES = \
127 $(srcdir)/observer.texi
128 GDBINT_DOC_BUILD_INCLUDES = \
132 $(srcdir)/gdbint.texinfo \
133 $(GDBINT_DOC_SOURCE_INCLUDES) \
134 $(GDBINT_DOC_BUILD_INCLUDES)
136 # Stabs manual: All files
137 STABS_DOC_SOURCE_INCLUDES = \
139 STABS_DOC_BUILD_INCLUDES =
141 $(srcdir)/stabs.texinfo \
142 $(STABS_DOC_SOURCE_INCLUDES) \
143 $(STABS_DOC_BUILD_INCLUDES)
145 # Annotate migration document
146 ANNOTATE_DOC_SOURCE_INCLUDES = \
148 ANNOTATE_DOC_BUILD_INCLUDES = \
150 ANNOTATE_DOC_FILES = \
151 $(srcdir)/annotate.texinfo \
152 $(ANNOTATE_DOC_SOURCE_INCLUDES) \
153 $(ANNOTATE_DOC_BUILD_INCLUDES)
155 #### Host, target, and site specific Makefile fragments come in here.
161 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi annotate.dvi
162 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
165 all-doc: info dvi ps # pdf
168 install-info: $(INFO_DEPS)
169 $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(infodir)
170 @list='$(INFO_DEPS)'; \
171 for file in $$list; do \
172 if test -f $$file; then d=.; else d=$(srcdir); fi; \
173 for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
174 if test -f $$d/$$ifile; then \
175 echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
176 $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
181 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
182 list='$(INFO_DEPS)'; \
183 for file in $$list; do \
184 echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
185 install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
191 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
194 list='$(INFO_DEPS)'; \
195 for file in $$list; do \
197 || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
200 list='$(INFO_DEPS)'; \
201 for file in $$list; do \
202 (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
205 html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
207 install-html: $(HTMLFILES)
209 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
210 @list='$(HTMLFILES_INSTALL)'; for p in $$list; do \
211 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
212 f=$(html__strip_dir) \
213 if test -d "$$d$$p"; then \
214 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
215 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
216 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
217 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
219 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
220 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
224 pdf__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
226 install-pdf: $(PDFFILES)
228 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)"
229 @list='$(PDFFILES)'; for p in $$list; do \
230 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
231 f=$(pdf__strip_dir) \
232 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
233 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
236 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
238 # Copy the object files from a particular stage into a subdirectory.
241 -mv $(STAGESTUFF) stage1
245 -mv $(STAGESTUFF) stage2
249 -mv $(STAGESTUFF) stage3
254 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
257 -(cd stage1 ; mv -f * ..)
261 -(cd stage2 ; mv -f * ..)
265 -(cd stage3 ; mv -f * ..)
268 # GDB QUICK REFERENCE (dvi output)
269 refcard.dvi : refcard.tex $(REFEDITS)
271 for f in x $(REFEDITS) ; do \
272 test x$$f = xx && continue ; \
273 cat $(srcdir)/$$f >>tmp.sed ; \
275 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
276 $(SET_TEXINPUTS) $(TEX) sedref.tex
277 mv sedref.dvi refcard.dvi
278 rm -f sedref.log sedref.tex tmp.sed
280 refcard.ps : refcard.dvi
281 $(DVIPS) -t landscape -o $@ $?
283 refcard.pdf : refcard.tex $(REFEDITS)
285 for f in x $(REFEDITS) ; do \
286 test x$$f = xx && continue ; \
287 cat $(srcdir)/$$f >>tmp.sed ; \
289 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
290 $(SET_TEXINPUTS) $(PDFTEX) sedref.tex
291 mv sedref.pdf refcard.pdf
292 rm -f sedref.log sedref.tex tmp.sed
294 # File to record current GDB version number (copied from main dir version.in)
295 GDBvn.texi : ${gdbdir}/version.in
296 echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
297 if [ -n "$(PKGVERSION)" ]; then \
298 echo "@set VERSION_PACKAGE $(PKGVERSION)" >> ./GDBvn.new; \
300 echo "@set BUGURL $(BUGURL_TEXI)" >> ./GDBvn.new
301 if [ "$(BUGURL_TEXI)" = "@uref{http://www.gnu.org/software/gdb/bugs/}" ]; then \
302 echo "@set BUGURL_DEFAULT" >> ./GDBvn.new; \
304 mv GDBvn.new GDBvn.texi
307 .PRECIOUS: GDBvn.texi
309 # Choose configuration for GDB manual (normally `all'; normally not tied into
310 # `configure' script because most users prefer generic version of manual,
311 # not one for their binary config---which may not be specifically
313 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
314 (test "$(LN_S)" = "ln -s" && \
315 ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi) || \
316 ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
317 cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
319 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
320 # If your texinfo or makeinfo don't support these, get a new texinfo release
322 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
323 # Note that we can *generate* GDBvn.texi, but since we distribute one in the
324 # source directory for the benefit of people who *don't* use this makefile,
325 # VPATH will often tell make not to bother building it, because the one
326 # in the srcdir is up to date. (if not, then make should build one here).
328 # Clean these up before each run. Avoids a catch 22 with not being
329 # able to re-generate these files (to fix a corruption) because these
330 # files contain a corruption.
331 GDB_TEX_TMPS = gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
334 # GDB MANUAL: TeX dvi file
335 gdb.dvi: ${GDB_DOC_FILES}
336 if [ ! -f ./GDBvn.texi ]; then \
337 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
338 ln $(srcdir)/GDBvn.texi . || \
339 cp $(srcdir)/GDBvn.texi . ; else true; fi
340 rm -f $(GDB_TEX_TMPS)
341 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdb.texinfo
346 gdb.pdf: ${GDB_DOC_FILES}
347 if [ ! -f ./GDBvn.texi ]; then \
348 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
349 ln $(srcdir)/GDBvn.texi . || \
350 cp $(srcdir)/GDBvn.texi . ; else true; fi
351 rm -f $(GDB_TEX_TMPS)
352 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdb.texinfo
354 # GDB MANUAL: info file
355 gdb.info: ${GDB_DOC_FILES}
356 $(MAKEINFO) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
357 -o gdb.info $(srcdir)/gdb.texinfo
359 # GDB MANUAL: roff translations
360 # Try to use a recent texi2roff. v2 was put on prep in jan91.
361 # If you want an index, see texi2roff doc for postprocessing
362 # and add -i to texi2roff invocations below.
363 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
364 # corresponding -e lines when later texi2roff's are current)
365 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
366 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
367 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
368 # + @alphaenumerate is ridiculously new, turned into @enumerate
370 # texi2roff doesn't have a notion of include dirs, so we have to fake
371 # it out for gdb manual's include files---but only if not configured
373 links2roff: $(GDB_DOC_SOURCE_INCLUDES)
374 if [ ! -f gdb.texinfo ]; then \
375 (test "$(LN_S)" = "ln -s" && ln -s $(GDB_DOC_SOURCE_INCLUDES) .) || \
376 ln $(GDB_DOC_SOURCE_INCLUDES) . || \
377 cp $(GDB_DOC_SOURCE_INCLUDES) . ; \
381 # gdb manual suitable for [gtn]roff -me
382 gdb.me: $(GDB_DOC_FILES) links2roff
383 sed -e '/\\input texinfo/d' \
384 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
385 -e '/^@ifinfo/,/^@end ifinfo/d' \
389 -e 's/^@alphaenumerate/@enumerate/g' \
390 -e 's/^@end alphaenumerate/@end enumerate/g' \
391 $(srcdir)/gdb.texinfo | \
393 sed -e 's/---/\\(em/g' \
396 # gdb manual suitable for [gtn]roff -ms
397 gdb.ms: $(GDB_DOC_FILES) links2roff
398 sed -e '/\\input texinfo/d' \
399 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
400 -e '/^@ifinfo/,/^@end ifinfo/d' \
404 -e 's/^@alphaenumerate/@enumerate/g' \
405 -e 's/^@end alphaenumerate/@end enumerate/g' \
406 $(srcdir)/gdb.texinfo | \
408 sed -e 's/---/\\(em/g' \
411 # gdb manual suitable for [tn]roff -mm
412 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
413 # try leaving them in
414 gdb.mm: $(GDB_DOC_FILES) links2roff
415 sed -e '/\\input texinfo/d' \
416 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
417 -e '/^@ifinfo/,/^@end ifinfo/d' \
422 -e 's/^@alphaenumerate/@enumerate/g' \
423 -e 's/^@end alphaenumerate/@end enumerate/g' \
424 $(srcdir)/gdb.texinfo | \
426 sed -e 's/---/\\(em/g' \
429 # GDB MANUAL: HTML file
431 gdb/index.html: ${GDB_DOC_FILES}
432 $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo
434 # Clean these up before each run. Avoids a catch 22 with not being
435 # able to re-generate these files (to fix a corruption) because these
436 # files contain a corruption.
437 GDBINT_TEX_TMPS = gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
438 gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
440 # GDB INTERNALS MANUAL: TeX dvi file
441 gdbint.dvi: $(GDBINT_DOC_FILES)
442 rm -f $(GDBINT_TEX_TMPS)
443 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/gdbint.texinfo
445 gdbint.ps : gdbint.dvi
448 gdbint.pdf: $(GDBINT_DOC_FILES)
449 rm -f $(GDBINT_TEX_TMPS)
450 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/gdbint.texinfo
452 # GDB INTERNALS MANUAL: info file
454 gdbint.info: $(GDBINT_DOC_FILES)
455 $(MAKEINFO) -I $(srcdir) -o gdbint.info $(srcdir)/gdbint.texinfo
457 # GDB INTERNALS MANUAL: HTML file
459 gdbint/index.html: $(GDBINT_DOC_FILES)
460 $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/gdbint.texinfo
462 stabs.info: $(STABS_DOC_FILES)
463 $(MAKEINFO) -I $(srcdir) -o stabs.info $(srcdir)/stabs.texinfo
465 # STABS DOCUMENTATION: HTML file
467 stabs/index.html: $(STABS_DOC_FILES)
468 $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/stabs.texinfo
470 # Clean these up before each run. Avoids a catch 22 with not being
471 # able to re-generate these files (to fix a corruption) because these
472 # files contain a corruption.
473 STABS_TEX_TMPS = stabs.aux stabs.cp* stabs.fn* stabs.ky* \
474 stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
476 # STABS DOCUMENTATION: TeX dvi file
477 stabs.dvi : $(STABS_DOC_FILES)
478 rm -f $(STABS_TEX_TMPS)
479 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/stabs.texinfo
484 stabs.pdf: $(STABS_DOC_FILES)
485 rm -f $(STABS_TEX_TMPS)
486 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/stabs.texinfo
488 # Clean these up before each run. Avoids a catch 22 with not being
489 # able to re-generate these files (to fix a corruption) because these
490 # files contain a corruption.
491 ANNOTATE_TEX_TMPS = annotate.aux annotate.cp* annotate.fn* annotate.ky* \
492 annotate.log annotate.pg* annotate.toc annotate.tp* annotate.vr*
494 # ANNOTATE DOCUMENTATION: TeX dvi file
495 annotate.dvi : $(ANNOTATE_DOC_FILES)
496 rm -f $(ANNOTATE_TEX_TMPS)
497 $(SET_TEXINPUTS) $(TEXI2DVI) $(srcdir)/annotate.texinfo
499 annotate.ps: annotate.dvi
502 annotate.pdf: $(ANNOTATE_DOC_FILES)
503 rm -f $(ANNOTATE_TEX_TMPS)
504 $(SET_TEXINPUTS) $(TEXI2DVI) --pdf $(srcdir)/annotate.texinfo
506 annotate.info: $(ANNOTATE_DOC_FILES)
507 $(MAKEINFO) -I $(srcdir) -o annotate.info $(srcdir)/annotate.texinfo
509 annotate/index.html: $(ANNOTATE_DOC_FILES)
510 $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/annotate.texinfo
514 Makefile: Makefile.in $(host_makefile_frag) config.status
515 $(SHELL) ./config.status
518 # The "least clean" level of cleaning. Get rid of files which are
519 # automatically generated files that are just intermediate files,
522 rm -f gdb.mm gdb.ms gdb.me links2roff
523 rm -f $(GDB_TEX_TMPS)
524 rm -f $(GDBINT_TEX_TMPS)
525 rm -f $(STABS_TEX_TMPS)
526 rm -f $(ANNOTATE_TEX_TMPS)
527 rm -f sedref.dvi sedref.tex tmp.sed
533 rm -f Makefile config.status config.log
535 # GDBvn.texi, the dvi files, the info files, and the postscript files,
536 # are all part of the distribution, so it should not be removed by
537 # "clean" or "distclean". Use maintainer-clean to remove them.
539 maintainer-clean realclean: distclean
540 rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
542 install: install-info
544 uninstall: uninstall-info