1 # $Id: Makefile,v 1.37 1998/09/14 22:49:01 jdp Exp $
5 GDBDIR= ${.CURDIR}/../../../../contrib/gdb
6 .if ${OBJFORMAT} == elf
7 BFDDIR= ${.CURDIR}/../../binutils/libbfd/${MACHINE_ARCH}
8 BINDIR= /usr/libexec/elf
10 BFDDIR= ${.CURDIR}/../bfd
11 BINDIR= /usr/libexec/aout
14 .PATH: ${GDBDIR}/opcodes
16 .if ${OBJFORMAT} == elf
17 CFLAGS+= -DFREEBSD_ELF
20 XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \
21 c-typeprint.c c-valprint.c ch-lang.c ch-typeprint.c \
22 ch-valprint.c coffread.c command.c complaints.c copying.c \
23 core-regset.c corelow.c cp-valprint.c \
24 dcache.c dbxread.c demangle.c dwarfread.c \
25 elfread.c environ.c eval.c exec.c expprint.c \
26 findvar.c fork-child.c freebsd-nat.c gdbtypes.c \
27 i386-tdep.c infcmd.c inflow.c infptrace.c \
28 infrun.c inftarg.c language.c \
29 m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \
30 mem-break.c minsyms.c objfiles.c parse.c \
31 printcmd.c remote.c remote-utils.c solib.c source.c \
32 stabsread.c stack.c symfile.c symmisc.c \
33 symtab.c target.c thread.c top.c \
34 typeprint.c utils.c valarith.c valops.c \
35 valprint.c values.c version.c \
36 serial.c ser-unix.c ser-tcp.c mdebugread.c \
37 c-exp.y f-exp.y m2-exp.y i387-tdep.c \
39 corefile.c ch-exp.c f-lang.c scm-exp.c scm-lang.c \
40 scm-valprint.c f-typeprint.c f-valprint.c nlmread.c \
42 XSRCS+= i386-dis.c dis-buf.c disassemble.c
45 CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I${BFDDIR}
48 # uncomment the next line if you want to debug gdb
52 CLEANFILES= init.c init.c-tmp
54 .if ${OBJFORMAT} == elf
56 .if exists(${.OBJDIR}/../../binutils/libbfd)
57 LIBBFD= ${.OBJDIR}/../../binutils/libbfd/libbfd.a
59 LIBBFD= ${.CURDIR}/../../binutils/libbfd/libbfd.a
62 .if exists(${.OBJDIR}/../../binutils/libiberty)
63 LIBIBERTY= ${.OBJDIR}/../../binutils/libiberty/libiberty.a
65 LIBIBERTY= ${.CURDIR}/../../binutils/libiberty/libiberty.a
70 .if exists(${.OBJDIR}/../bfd)
71 LIBBFD= ${.OBJDIR}/../bfd/libbfd.a
73 LIBBFD= ${.CURDIR}/../bfd/libbfd.a
76 .if exists(${.OBJDIR}/../libiberty)
77 LIBIBERTY= ${.OBJDIR}/../libiberty/libiberty.a
79 LIBIBERTY= ${.CURDIR}/../libiberty/libiberty.a
84 DPADD= ${LIBBFD} ${LIBREADLINE} ${LIBGNUREGEX} ${LIBIBERTY} ${LIBTERMCAP}
85 LDADD= ${LIBBFD} -lreadline -lgnuregex ${LIBIBERTY} -ltermcap
89 # We do this by grepping through sources. If that turns out to be too slow,
90 # maybe we could just require every .o file to have an initialization routine
91 # of a given name (remote-udi.o -> _initialize_remote_udi, etc.).
93 # Formatting conventions: The name of the _initialize_* routines must start
94 # in column zero, and must not be inside #if.
96 # Note that the set of files with init functions might change, or the names
97 # of the functions might change, so this files needs to depend on all the
98 # object files that will be linked into gdb.
101 @echo Making ${.TARGET}
103 @echo '/* Do not modify this file. */' >init.c-tmp
104 @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
105 @echo 'void initialize_all_files () {' >>init.c-tmp
106 @for i in ${.ALLSRC} ; do \
107 filename=`echo $$i | sed \
112 -e '/xdr_ptrace.c/d' \
118 -e '/^[a-z0-9A-Z_]*_[SU].c/d' \
119 -e '/[a-z0-9A-Z_]*-exp.tab.c/d'` ; \
122 *) sed <$$filename >>init.c-tmp -n \
123 -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (); \1 ();}/p' ; ;; \
126 @echo '}' >>init.c-tmp
127 @mv init.c-tmp ${.TARGET}
131 .include <bsd.prog.mk>