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.
27 datarootdir = @datarootdir@
37 INSTALL_PROGRAM = @INSTALL_PROGRAM@
38 INSTALL_DATA = @INSTALL_DATA@
40 mkinstalldirs = $(SHELL) $(srcdir)/../../mkinstalldirs
42 # main GDB source directory
45 # where to find texinfo; GDB dist should include a recent one
46 TEXIDIR=${gdbdir}/../texinfo
48 # where to find makeinfo, preferably one designed for texinfo-2
51 MAKEHTML = $(MAKEINFO) --html
54 # where to find texi2roff, ditto
57 # where to find texi2dvi, ditto
60 # Package version and bug-reporting URL.
61 PKGVERSION = @PKGVERSION@
62 BUGURL_TEXI = @REPORT_BUGS_TEXI@
64 # Where is the source dir for the READLINE library doc?
65 # Traditionally readline is in .. or .
66 READLINE_DIR = ${gdbdir}/../readline/doc
68 # The GDB/MI docs come from a sibling directory ../mi
69 GDBMI_DIR = ${gdbdir}/mi
72 TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$(GDBMI_DIR):$$TEXINPUTS
74 # Files which should be generated via 'info' and installed by 'install-info'
75 INFO_DEPS = gdb.info gdbint.info stabs.info annotate.info
77 # Files which should be generated via 'pdf' and installed by 'install-pdf'
78 PDFFILES = gdb.pdf gdbint.pdf stabs.pdf refcard.pdf annotate.pdf
79 # Files which should be generated via 'html' and installed by 'install-html'
80 HTMLFILES = gdb/index.html gdbint/index.html stabs/index.html annotate/index.html
81 HTMLFILES_INSTALL = gdb gdbint stabs annotate
83 # There may be alternate predefined collections of switches to configure
84 # the GDB manual. Normally this is not done in synch with the software
85 # config system, since this choice tends to be independent; most people
86 # want a doc config of `all' for a generic manual, regardless of sw config.
89 # This list of sed edits will edit the GDB reference card
90 # for what fonts and what papersize to use.
91 # By default (NO edits applied), the refcard uses:
92 # - Computer Modern (CM) fonts
93 # - US letter paper (8.5x11in)
94 # List some of the following files for alternative fonts and paper:
95 # a4rc.sed use A4 paper (297 x 210 mm)
96 # psrc.sed use PostScript fonts (Karl Berry short TeX names)
97 # lpsrc.sed use PostScript fonts (full PostScript names in TeX)
98 # e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
99 # for A4, CM fonts: REFEDITS = a4rc.sed
100 # for US, PS fonts: REFEDITS = psrc.sed
104 # Don Knuth's TeX formatter
108 # Program to generate Postscript files from DVI files.
112 GDB_DOC_SOURCE_INCLUDES = \
115 $(srcdir)/agentexpr.texi \
116 $(READLINE_DIR)/rluser.texi \
117 $(READLINE_DIR)/inc-hist.texinfo
118 GDB_DOC_BUILD_INCLUDES = \
122 $(srcdir)/gdb.texinfo \
123 $(GDB_DOC_SOURCE_INCLUDES) \
124 $(GDB_DOC_BUILD_INCLUDES)
127 GDBINT_DOC_SOURCE_INCLUDES = \
129 $(srcdir)/observer.texi
130 GDBINT_DOC_BUILD_INCLUDES = \
134 $(srcdir)/gdbint.texinfo \
135 $(GDBINT_DOC_SOURCE_INCLUDES) \
136 $(GDBINT_DOC_BUILD_INCLUDES)
138 # Stabs manual: All files
139 STABS_DOC_SOURCE_INCLUDES = \
141 STABS_DOC_BUILD_INCLUDES =
143 $(srcdir)/stabs.texinfo \
144 $(STABS_DOC_SOURCE_INCLUDES) \
145 $(STABS_DOC_BUILD_INCLUDES)
147 # Annotate migration document
148 ANNOTATE_DOC_SOURCE_INCLUDES = \
150 ANNOTATE_DOC_BUILD_INCLUDES = \
152 ANNOTATE_DOC_FILES = \
153 $(srcdir)/annotate.texinfo \
154 $(ANNOTATE_DOC_SOURCE_INCLUDES) \
155 $(ANNOTATE_DOC_BUILD_INCLUDES)
157 #### Host, target, and site specific Makefile fragments come in here.
163 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi annotate.dvi
164 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
167 all-doc: info dvi ps # pdf
170 install-info: $(INFO_DEPS)
171 $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(infodir)
172 @list='$(INFO_DEPS)'; \
173 for file in $$list; do \
174 if test -f $$file; then d=.; else d=$(srcdir); fi; \
175 for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
176 if test -f $$d/$$ifile; then \
177 echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
178 $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
183 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
184 list='$(INFO_DEPS)'; \
185 for file in $$list; do \
186 echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
187 install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
193 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
196 list='$(INFO_DEPS)'; \
197 for file in $$list; do \
199 || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
202 list='$(INFO_DEPS)'; \
203 for file in $$list; do \
204 (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
207 html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
209 install-html: $(HTMLFILES)
211 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
212 @list='$(HTMLFILES_INSTALL)'; for p in $$list; do \
213 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
214 f=$(html__strip_dir) \
215 if test -d "$$d$$p"; then \
216 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
217 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
218 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
219 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
221 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
222 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
226 pdf__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
228 install-pdf: $(PDFFILES)
230 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)"
231 @list='$(PDFFILES)'; for p in $$list; do \
232 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
233 f=$(pdf__strip_dir) \
234 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
235 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
238 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
240 # Copy the object files from a particular stage into a subdirectory.
243 -mv $(STAGESTUFF) stage1
247 -mv $(STAGESTUFF) stage2
251 -mv $(STAGESTUFF) stage3
256 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
259 -(cd stage1 ; mv -f * ..)
263 -(cd stage2 ; mv -f * ..)
267 -(cd stage3 ; mv -f * ..)
270 # GDB QUICK REFERENCE (dvi output)
271 refcard.dvi : refcard.tex $(REFEDITS)
273 for f in x $(REFEDITS) ; do \
274 test x$$f = xx && continue ; \
275 cat $(srcdir)/$$f >>tmp.sed ; \
277 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
278 $(SET_TEXINPUTS) $(TEX) sedref.tex
279 mv sedref.dvi refcard.dvi
280 rm -f sedref.log sedref.tex tmp.sed
282 refcard.ps : refcard.dvi
283 $(DVIPS) -t landscape -o $@ $?
285 refcard.pdf : refcard.tex $(REFEDITS)
287 for f in x $(REFEDITS) ; do \
288 test x$$f = xx && continue ; \
289 cat $(srcdir)/$$f >>tmp.sed ; \
291 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
292 $(SET_TEXINPUTS) $(PDFTEX) sedref.tex
293 mv sedref.pdf refcard.pdf
294 rm -f sedref.log sedref.tex tmp.sed
296 # File to record current GDB version number (copied from main dir version.in)
297 GDBvn.texi : ${gdbdir}/version.in
298 echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
299 if [ -n "$(PKGVERSION)" ]; then \
300 echo "@set VERSION_PACKAGE $(PKGVERSION)" >> ./GDBvn.new; \
302 echo "@set BUGURL $(BUGURL_TEXI)" >> ./GDBvn.new
303 if [ "$(BUGURL_TEXI)" = "@uref{http://www.gnu.org/software/gdb/bugs/}" ]; then \
304 echo "@set BUGURL_DEFAULT" >> ./GDBvn.new; \
306 mv GDBvn.new GDBvn.texi
309 .PRECIOUS: GDBvn.texi
311 # Choose configuration for GDB manual (normally `all'; normally not tied into
312 # `configure' script because most users prefer generic version of manual,
313 # not one for their binary config---which may not be specifically
315 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
316 (test "$(LN_S)" = "ln -s" && \
317 ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi) || \
318 ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
319 cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
321 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
322 # If your texinfo or makeinfo don't support these, get a new texinfo release
324 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
325 # Note that we can *generate* GDBvn.texi, but since we distribute one in the
326 # source directory for the benefit of people who *don't* use this makefile,
327 # VPATH will often tell make not to bother building it, because the one
328 # in the srcdir is up to date. (if not, then make should build one here).
330 # Clean these up before each run. Avoids a catch 22 with not being
331 # able to re-generate these files (to fix a corruption) because these
332 # files contain a corruption.
333 GDB_TEX_TMPS = gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
336 # GDB MANUAL: TeX dvi file
337 gdb.dvi: ${GDB_DOC_FILES}
338 if [ ! -f ./GDBvn.texi ]; then \
339 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
340 ln $(srcdir)/GDBvn.texi . || \
341 cp $(srcdir)/GDBvn.texi . ; else true; fi
342 rm -f $(GDB_TEX_TMPS)
343 $(TEXI2DVI) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
344 $(srcdir)/gdb.texinfo
349 gdb.pdf: ${GDB_DOC_FILES}
350 if [ ! -f ./GDBvn.texi ]; then \
351 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
352 ln $(srcdir)/GDBvn.texi . || \
353 cp $(srcdir)/GDBvn.texi . ; else true; fi
354 rm -f $(GDB_TEX_TMPS)
355 $(TEXI2DVI) --pdf -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
356 $(srcdir)/gdb.texinfo
358 # GDB MANUAL: info file
359 gdb.info: ${GDB_DOC_FILES}
360 $(MAKEINFO) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) \
361 -o gdb.info $(srcdir)/gdb.texinfo
363 # GDB MANUAL: roff translations
364 # Try to use a recent texi2roff. v2 was put on prep in jan91.
365 # If you want an index, see texi2roff doc for postprocessing
366 # and add -i to texi2roff invocations below.
367 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
368 # corresponding -e lines when later texi2roff's are current)
369 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
370 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
371 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
372 # + @alphaenumerate is ridiculously new, turned into @enumerate
374 # texi2roff doesn't have a notion of include dirs, so we have to fake
375 # it out for gdb manual's include files---but only if not configured
377 links2roff: $(GDB_DOC_SOURCE_INCLUDES)
378 if [ ! -f gdb.texinfo ]; then \
379 (test "$(LN_S)" = "ln -s" && ln -s $(GDB_DOC_SOURCE_INCLUDES) .) || \
380 ln $(GDB_DOC_SOURCE_INCLUDES) . || \
381 cp $(GDB_DOC_SOURCE_INCLUDES) . ; \
385 # gdb manual suitable for [gtn]roff -me
386 gdb.me: $(GDB_DOC_FILES) links2roff
387 sed -e '/\\input texinfo/d' \
388 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
389 -e '/^@ifinfo/,/^@end ifinfo/d' \
393 -e 's/^@alphaenumerate/@enumerate/g' \
394 -e 's/^@end alphaenumerate/@end enumerate/g' \
395 $(srcdir)/gdb.texinfo | \
397 sed -e 's/---/\\(em/g' \
400 # gdb manual suitable for [gtn]roff -ms
401 gdb.ms: $(GDB_DOC_FILES) links2roff
402 sed -e '/\\input texinfo/d' \
403 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
404 -e '/^@ifinfo/,/^@end ifinfo/d' \
408 -e 's/^@alphaenumerate/@enumerate/g' \
409 -e 's/^@end alphaenumerate/@end enumerate/g' \
410 $(srcdir)/gdb.texinfo | \
412 sed -e 's/---/\\(em/g' \
415 # gdb manual suitable for [tn]roff -mm
416 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
417 # try leaving them in
418 gdb.mm: $(GDB_DOC_FILES) links2roff
419 sed -e '/\\input texinfo/d' \
420 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
421 -e '/^@ifinfo/,/^@end ifinfo/d' \
426 -e 's/^@alphaenumerate/@enumerate/g' \
427 -e 's/^@end alphaenumerate/@end enumerate/g' \
428 $(srcdir)/gdb.texinfo | \
430 sed -e 's/---/\\(em/g' \
433 # GDB MANUAL: HTML file
435 gdb/index.html: ${GDB_DOC_FILES}
436 $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I ${GDBMI_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo
438 # Clean these up before each run. Avoids a catch 22 with not being
439 # able to re-generate these files (to fix a corruption) because these
440 # files contain a corruption.
441 GDBINT_TEX_TMPS = gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
442 gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
444 # GDB INTERNALS MANUAL: TeX dvi file
445 gdbint.dvi: $(GDBINT_DOC_FILES)
446 rm -f $(GDBINT_TEX_TMPS)
447 $(TEXI2DVI) -I $(srcdir) $(srcdir)/gdbint.texinfo
449 gdbint.ps : gdbint.dvi
452 gdbint.pdf: $(GDBINT_DOC_FILES)
453 rm -f $(GDBINT_TEX_TMPS)
454 $(TEXI2DVI) --pdf -I $(srcdir) $(srcdir)/gdbint.texinfo
456 # GDB INTERNALS MANUAL: info file
458 gdbint.info: $(GDBINT_DOC_FILES)
459 $(MAKEINFO) -I $(srcdir) -o gdbint.info $(srcdir)/gdbint.texinfo
461 # GDB INTERNALS MANUAL: HTML file
463 gdbint/index.html: $(GDBINT_DOC_FILES)
464 $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/gdbint.texinfo
466 stabs.info: $(STABS_DOC_FILES)
467 $(MAKEINFO) -I $(srcdir) -o stabs.info $(srcdir)/stabs.texinfo
469 # STABS DOCUMENTATION: HTML file
471 stabs/index.html: $(STABS_DOC_FILES)
472 $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/stabs.texinfo
474 # Clean these up before each run. Avoids a catch 22 with not being
475 # able to re-generate these files (to fix a corruption) because these
476 # files contain a corruption.
477 STABS_TEX_TMPS = stabs.aux stabs.cp* stabs.fn* stabs.ky* \
478 stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
480 # STABS DOCUMENTATION: TeX dvi file
481 stabs.dvi : $(STABS_DOC_FILES)
482 rm -f $(STABS_TEX_TMPS)
483 $(TEXI2DVI) -I $(srcdir) $(srcdir)/stabs.texinfo
488 stabs.pdf: $(STABS_DOC_FILES)
489 rm -f $(STABS_TEX_TMPS)
490 $(TEXI2DVI) --pdf -I $(srcdir) $(srcdir)/stabs.texinfo
492 # Clean these up before each run. Avoids a catch 22 with not being
493 # able to re-generate these files (to fix a corruption) because these
494 # files contain a corruption.
495 ANNOTATE_TEX_TMPS = annotate.aux annotate.cp* annotate.fn* annotate.ky* \
496 annotate.log annotate.pg* annotate.toc annotate.tp* annotate.vr*
498 # ANNOTATE DOCUMENTATION: TeX dvi file
499 annotate.dvi : $(ANNOTATE_DOC_FILES)
500 rm -f $(ANNOTATE_TEX_TMPS)
501 $(TEXI2DVI) -I $(srcdir) $(srcdir)/annotate.texinfo
503 annotate.ps: annotate.dvi
506 annotate.pdf: $(ANNOTATE_DOC_FILES)
507 rm -f $(ANNOTATE_TEX_TMPS)
508 $(TEXI2DVI) --pdf -I $(srcdir) $(srcdir)/annotate.texinfo
510 annotate.info: $(ANNOTATE_DOC_FILES)
511 $(MAKEINFO) -I $(srcdir) -o annotate.info $(srcdir)/annotate.texinfo
513 annotate/index.html: $(ANNOTATE_DOC_FILES)
514 $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/annotate.texinfo
518 Makefile: Makefile.in $(host_makefile_frag) config.status
519 $(SHELL) ./config.status
522 # The "least clean" level of cleaning. Get rid of files which are
523 # automatically generated files that are just intermediate files,
526 rm -f gdb.mm gdb.ms gdb.me links2roff
527 rm -f $(GDB_TEX_TMPS)
528 rm -f $(GDBINT_TEX_TMPS)
529 rm -f $(STABS_TEX_TMPS)
530 rm -f $(ANNOTATE_TEX_TMPS)
531 rm -f sedref.dvi sedref.tex tmp.sed
537 rm -f Makefile config.status config.log
539 # GDBvn.texi, the dvi files, the info files, and the postscript files,
540 # are all part of the distribution, so it should not be removed by
541 # "clean" or "distclean". Use maintainer-clean to remove them.
543 maintainer-clean realclean: distclean
544 rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
546 install: install-info
548 uninstall: uninstall-info