1 ##Copyright (C) 1991-2013 Free Software Foundation, Inc.
3 # Makefile for GDB documentation.
4 # This file is part of GDB.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 datarootdir = @datarootdir@
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
48 MAKEINFOFLAGS = @MAKEINFOFLAGS@
49 MAKEINFO_EXTRA_FLAGS = @MAKEINFO_EXTRA_FLAGS@
50 MAKEINFO_CMD = $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS)
52 MAKEHTML = $(MAKEINFO_CMD) --html
55 # where to find texi2roff, ditto
58 # where to find texi2dvi, ditto
61 # Package version and bug-reporting URL.
62 PKGVERSION = @PKGVERSION@
63 BUGURL_TEXI = @REPORT_BUGS_TEXI@
65 # Where is the source dir for the READLINE library doc?
66 # Traditionally readline is in .. or .
67 READLINE_DIR = ${gdbdir}/../readline/doc
68 READLINE_TEXI_INCFLAG = @READLINE_TEXI_INCFLAG@
70 # The GDB/MI docs come from a sibling directory ../mi
71 GDBMI_DIR = ${gdbdir}/mi
74 TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$(GDBMI_DIR):$$TEXINPUTS
76 # Files which should be generated via 'info' and installed by 'install-info'
77 INFO_DEPS = gdb.info gdbint.info stabs.info annotate.info
79 # Files which should be generated via 'pdf' and installed by 'install-pdf'
80 PDFFILES = gdb.pdf gdbint.pdf stabs.pdf refcard.pdf annotate.pdf
81 # Files which should be generated via 'html' and installed by 'install-html'
82 HTMLFILES = gdb/index.html gdbint/index.html stabs/index.html annotate/index.html
83 HTMLFILES_INSTALL = gdb gdbint stabs annotate
85 # There may be alternate predefined collections of switches to configure
86 # the GDB manual. Normally this is not done in synch with the software
87 # config system, since this choice tends to be independent; most people
88 # want a doc config of `all' for a generic manual, regardless of sw config.
91 # This list of sed edits will edit the GDB reference card
92 # for what fonts and what papersize to use.
93 # By default (NO edits applied), the refcard uses:
94 # - Computer Modern (CM) fonts
95 # - US letter paper (8.5x11in)
96 # List some of the following files for alternative fonts and paper:
97 # a4rc.sed use A4 paper (297 x 210 mm)
98 # psrc.sed use PostScript fonts (Karl Berry short TeX names)
99 # lpsrc.sed use PostScript fonts (full PostScript names in TeX)
100 # e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
101 # for A4, CM fonts: REFEDITS = a4rc.sed
102 # for US, PS fonts: REFEDITS = psrc.sed
106 # Don Knuth's TeX formatter
110 # Program to generate Postscript files from DVI files.
114 # Note that this unconditionally includes the readline texi files,
115 # even when --with-system-readline is used. This is harmless because
116 # these are only used as dependencies.
117 GDB_DOC_SOURCE_INCLUDES = \
120 $(srcdir)/agentexpr.texi \
121 $(READLINE_DIR)/rluser.texi \
122 $(READLINE_DIR)/hsuser.texi
123 GDB_DOC_BUILD_INCLUDES = \
127 $(srcdir)/gdb.texinfo \
128 $(GDB_DOC_SOURCE_INCLUDES) \
129 $(GDB_DOC_BUILD_INCLUDES)
132 GDBINT_DOC_SOURCE_INCLUDES = \
134 $(srcdir)/observer.texi
135 GDBINT_DOC_BUILD_INCLUDES = \
139 $(srcdir)/gdbint.texinfo \
140 $(GDBINT_DOC_SOURCE_INCLUDES) \
141 $(GDBINT_DOC_BUILD_INCLUDES)
143 # Stabs manual: All files
144 STABS_DOC_SOURCE_INCLUDES = \
146 STABS_DOC_BUILD_INCLUDES =
148 $(srcdir)/stabs.texinfo \
149 $(STABS_DOC_SOURCE_INCLUDES) \
150 $(STABS_DOC_BUILD_INCLUDES)
152 # Annotate migration document
153 ANNOTATE_DOC_SOURCE_INCLUDES = \
155 ANNOTATE_DOC_BUILD_INCLUDES = \
158 ANNOTATE_DOC_FILES = \
159 $(srcdir)/annotate.texinfo \
160 $(ANNOTATE_DOC_SOURCE_INCLUDES) \
161 $(ANNOTATE_DOC_BUILD_INCLUDES)
163 #### Host, target, and site specific Makefile fragments come in here.
169 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi annotate.dvi
170 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
173 all-doc: info dvi ps # pdf
175 rm -f gdb-cfg.texi GDBvn.texi
177 install-info: $(INFO_DEPS)
178 $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(infodir)
179 @list='$(INFO_DEPS)'; \
180 for file in $$list; do \
181 if test -f $$file; then d=.; else d=$(srcdir); fi; \
182 for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
183 if test -f $$d/$$ifile; then \
184 echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
185 $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
190 @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 \
193 echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
194 install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
200 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
203 list='$(INFO_DEPS)'; \
204 for file in $$list; do \
206 || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
209 list='$(INFO_DEPS)'; \
210 for file in $$list; do \
211 (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
214 html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
216 install-html: $(HTMLFILES)
218 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
219 @list='$(HTMLFILES_INSTALL)'; for p in $$list; do \
220 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
221 f=$(html__strip_dir) \
222 if test -d "$$d$$p"; then \
223 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
224 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
225 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
226 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
228 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
229 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
233 pdf__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
235 install-pdf: $(PDFFILES)
237 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)"
238 @list='$(PDFFILES)'; for p in $$list; do \
239 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
240 f=$(pdf__strip_dir) \
241 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
242 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
245 STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
247 # Copy the object files from a particular stage into a subdirectory.
250 -mv $(STAGESTUFF) stage1
254 -mv $(STAGESTUFF) stage2
258 -mv $(STAGESTUFF) stage3
263 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
266 -(cd stage1 ; mv -f * ..)
270 -(cd stage2 ; mv -f * ..)
274 -(cd stage3 ; mv -f * ..)
277 # GDB QUICK REFERENCE (dvi output)
278 refcard.dvi : refcard.tex $(REFEDITS)
280 for f in x $(REFEDITS) ; do \
281 test x$$f = xx && continue ; \
282 cat $(srcdir)/$$f >>tmp.sed ; \
284 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
285 $(SET_TEXINPUTS) $(TEX) sedref.tex
286 mv sedref.dvi refcard.dvi
287 rm -f sedref.log sedref.tex tmp.sed
289 refcard.ps : refcard.dvi
290 $(DVIPS) -t landscape -o $@ $?
292 refcard.pdf : refcard.tex $(REFEDITS)
294 for f in x $(REFEDITS) ; do \
295 test x$$f = xx && continue ; \
296 cat $(srcdir)/$$f >>tmp.sed ; \
298 sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex
299 $(SET_TEXINPUTS) $(PDFTEX) sedref.tex
300 mv sedref.pdf refcard.pdf
301 rm -f sedref.log sedref.tex tmp.sed
303 # File to record current GDB version number (copied from main dir version.in)
304 GDBvn.texi : ${gdbdir}/version.in
305 echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
306 if [ -n "$(PKGVERSION)" ]; then \
307 echo "@set VERSION_PACKAGE $(PKGVERSION)" >> ./GDBvn.new; \
309 echo "@set BUGURL $(BUGURL_TEXI)" >> ./GDBvn.new
310 if [ "$(BUGURL_TEXI)" = "@uref{http://www.gnu.org/software/gdb/bugs/}" ]; then \
311 echo "@set BUGURL_DEFAULT" >> ./GDBvn.new; \
313 if test -z "$(READLINE_TEXI_INCFLAG)"; then \
314 echo "@set SYSTEM_READLINE" >> ./GDBvn.new; \
316 mv GDBvn.new GDBvn.texi
319 .PRECIOUS: GDBvn.texi
321 # Choose configuration for GDB manual (normally `all'; normally not tied into
322 # `configure' script because most users prefer generic version of manual,
323 # not one for their binary config---which may not be specifically
325 gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
326 (test "$(LN_S)" = "ln -s" && \
327 ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi) || \
328 ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
329 cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
331 # GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
332 # If your texinfo or makeinfo don't support these, get a new texinfo release
334 # The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
335 # Note that we can *generate* GDBvn.texi, but since we distribute one in the
336 # source directory for the benefit of people who *don't* use this makefile,
337 # VPATH will often tell make not to bother building it, because the one
338 # in the srcdir is up to date. (if not, then make should build one here).
340 # Clean these up before each run. Avoids a catch 22 with not being
341 # able to re-generate these files (to fix a corruption) because these
342 # files contain a corruption.
343 GDB_TEX_TMPS = gdb.aux gdb.cp* gdb.fn* gdb.ky* gdb.log gdb.pg* gdb.toc \
346 # GDB MANUAL: TeX dvi file
347 gdb.dvi: ${GDB_DOC_FILES}
348 if [ ! -f ./GDBvn.texi ]; then \
349 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
350 ln $(srcdir)/GDBvn.texi . || \
351 cp $(srcdir)/GDBvn.texi . ; else true; fi
352 rm -f $(GDB_TEX_TMPS)
353 $(TEXI2DVI) $(READLINE_TEXI_INCFLAG) -I ${GDBMI_DIR} -I $(srcdir) \
354 $(srcdir)/gdb.texinfo
359 gdb.pdf: ${GDB_DOC_FILES}
360 if [ ! -f ./GDBvn.texi ]; then \
361 (test "$(LN_S)" = "ln -s" && ln -s $(srcdir)/GDBvn.texi .) || \
362 ln $(srcdir)/GDBvn.texi . || \
363 cp $(srcdir)/GDBvn.texi . ; else true; fi
364 rm -f $(GDB_TEX_TMPS)
365 $(TEXI2DVI) --pdf $(READLINE_TEXI_INCFLAG) -I ${GDBMI_DIR} -I $(srcdir) \
366 $(srcdir)/gdb.texinfo
368 # GDB MANUAL: info file
369 gdb.info: ${GDB_DOC_FILES}
370 $(MAKEINFO_CMD) $(READLINE_TEXI_INCFLAG) -I ${GDBMI_DIR} -I $(srcdir) \
371 -o gdb.info $(srcdir)/gdb.texinfo
373 # GDB MANUAL: roff translations
374 # Try to use a recent texi2roff. v2 was put on prep in jan91.
375 # If you want an index, see texi2roff doc for postprocessing
376 # and add -i to texi2roff invocations below.
377 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
378 # corresponding -e lines when later texi2roff's are current)
379 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
380 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
381 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
382 # + @alphaenumerate is ridiculously new, turned into @enumerate
384 # texi2roff doesn't have a notion of include dirs, so we have to fake
385 # it out for gdb manual's include files---but only if not configured
387 links2roff: $(GDB_DOC_SOURCE_INCLUDES)
388 if [ ! -f gdb.texinfo ]; then \
389 (test "$(LN_S)" = "ln -s" && ln -s $(GDB_DOC_SOURCE_INCLUDES) .) || \
390 ln $(GDB_DOC_SOURCE_INCLUDES) . || \
391 cp $(GDB_DOC_SOURCE_INCLUDES) . ; \
395 # gdb manual suitable for [gtn]roff -me
396 gdb.me: $(GDB_DOC_FILES) links2roff
397 sed -e '/\\input texinfo/d' \
398 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
399 -e '/^@ifinfo/,/^@end ifinfo/d' \
403 -e 's/^@alphaenumerate/@enumerate/g' \
404 -e 's/^@end alphaenumerate/@end enumerate/g' \
405 $(srcdir)/gdb.texinfo | \
407 sed -e 's/---/\\(em/g' \
410 # gdb manual suitable for [gtn]roff -ms
411 gdb.ms: $(GDB_DOC_FILES) links2roff
412 sed -e '/\\input texinfo/d' \
413 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
414 -e '/^@ifinfo/,/^@end ifinfo/d' \
418 -e 's/^@alphaenumerate/@enumerate/g' \
419 -e 's/^@end alphaenumerate/@end enumerate/g' \
420 $(srcdir)/gdb.texinfo | \
422 sed -e 's/---/\\(em/g' \
425 # gdb manual suitable for [tn]roff -mm
426 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
427 # try leaving them in
428 gdb.mm: $(GDB_DOC_FILES) links2roff
429 sed -e '/\\input texinfo/d' \
430 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
431 -e '/^@ifinfo/,/^@end ifinfo/d' \
436 -e 's/^@alphaenumerate/@enumerate/g' \
437 -e 's/^@end alphaenumerate/@end enumerate/g' \
438 $(srcdir)/gdb.texinfo | \
440 sed -e 's/---/\\(em/g' \
443 # GDB MANUAL: HTML file
445 gdb/index.html: ${GDB_DOC_FILES}
446 $(MAKEHTML) $(MAKEHTMLFLAGS) $(READLINE_TEXI_INCFLAG) -I ${GDBMI_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo
448 # Clean these up before each run. Avoids a catch 22 with not being
449 # able to re-generate these files (to fix a corruption) because these
450 # files contain a corruption.
451 GDBINT_TEX_TMPS = gdbint.aux gdbint.cp* gdbint.fn* gdbint.ky* \
452 gdbint.log gdbint.pg* gdbint.toc gdbint.tp* gdbint.vr*
454 # GDB INTERNALS MANUAL: TeX dvi file
455 gdbint.dvi: $(GDBINT_DOC_FILES)
456 rm -f $(GDBINT_TEX_TMPS)
457 $(TEXI2DVI) -I $(srcdir) $(srcdir)/gdbint.texinfo
459 gdbint.ps : gdbint.dvi
462 gdbint.pdf: $(GDBINT_DOC_FILES)
463 rm -f $(GDBINT_TEX_TMPS)
464 $(TEXI2DVI) --pdf -I $(srcdir) $(srcdir)/gdbint.texinfo
466 # GDB INTERNALS MANUAL: info file
468 gdbint.info: $(GDBINT_DOC_FILES)
469 $(MAKEINFO_CMD) -I $(srcdir) -o gdbint.info $(srcdir)/gdbint.texinfo
471 # GDB INTERNALS MANUAL: HTML file
473 gdbint/index.html: $(GDBINT_DOC_FILES)
474 $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/gdbint.texinfo
476 stabs.info: $(STABS_DOC_FILES)
477 $(MAKEINFO_CMD) -I $(srcdir) -o stabs.info $(srcdir)/stabs.texinfo
479 # STABS DOCUMENTATION: HTML file
481 stabs/index.html: $(STABS_DOC_FILES)
482 $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/stabs.texinfo
484 # Clean these up before each run. Avoids a catch 22 with not being
485 # able to re-generate these files (to fix a corruption) because these
486 # files contain a corruption.
487 STABS_TEX_TMPS = stabs.aux stabs.cp* stabs.fn* stabs.ky* \
488 stabs.log stabs.pg* stabs.toc stabs.tp* stabs.vr*
490 # STABS DOCUMENTATION: TeX dvi file
491 stabs.dvi : $(STABS_DOC_FILES)
492 rm -f $(STABS_TEX_TMPS)
493 $(TEXI2DVI) -I $(srcdir) $(srcdir)/stabs.texinfo
498 stabs.pdf: $(STABS_DOC_FILES)
499 rm -f $(STABS_TEX_TMPS)
500 $(TEXI2DVI) --pdf -I $(srcdir) $(srcdir)/stabs.texinfo
502 # Clean these up before each run. Avoids a catch 22 with not being
503 # able to re-generate these files (to fix a corruption) because these
504 # files contain a corruption.
505 ANNOTATE_TEX_TMPS = annotate.aux annotate.cp* annotate.fn* annotate.ky* \
506 annotate.log annotate.pg* annotate.toc annotate.tp* annotate.vr*
508 # ANNOTATE DOCUMENTATION: TeX dvi file
509 annotate.dvi : $(ANNOTATE_DOC_FILES)
510 rm -f $(ANNOTATE_TEX_TMPS)
511 $(TEXI2DVI) -I $(srcdir) $(srcdir)/annotate.texinfo
513 annotate.ps: annotate.dvi
516 annotate.pdf: $(ANNOTATE_DOC_FILES)
517 rm -f $(ANNOTATE_TEX_TMPS)
518 $(TEXI2DVI) --pdf -I $(srcdir) $(srcdir)/annotate.texinfo
520 annotate.info: $(ANNOTATE_DOC_FILES)
521 $(MAKEINFO_CMD) -I $(srcdir) -o annotate.info $(srcdir)/annotate.texinfo
523 annotate/index.html: $(ANNOTATE_DOC_FILES)
524 $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/annotate.texinfo
528 Makefile: Makefile.in $(host_makefile_frag) ../config.status
529 cd .. && $(SHELL) ./config.status doc/Makefile
532 # The "least clean" level of cleaning. Get rid of files which are
533 # automatically generated files that are just intermediate files,
536 rm -f gdb.mm gdb.ms gdb.me links2roff
537 rm -f $(GDB_TEX_TMPS)
538 rm -f $(GDBINT_TEX_TMPS)
539 rm -f $(STABS_TEX_TMPS)
540 rm -f $(ANNOTATE_TEX_TMPS)
541 rm -f sedref.dvi sedref.tex tmp.sed
544 rm -f gdb-cfg.texi GDBvn.texi
549 # GDBvn.texi, the dvi files, the info files, and the postscript files,
550 # are all part of the distribution, so it should not be removed by
551 # "clean" or "distclean". Use maintainer-clean to remove them.
553 maintainer-clean realclean: distclean
554 rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
556 install: install-info
558 uninstall: uninstall-info