Initial import from FreeBSD RELENG_4:
[dragonfly.git] / gnu / usr.bin / binutils / gdb / Makefile
1 # $FreeBSD: src/gnu/usr.bin/binutils/gdb/Makefile,v 1.43.2.4 2002/06/25 05:04:46 obrien Exp $
2
3 .include "../Makefile.inc0"
4
5 .PATH: ${SRCDIR}/binutils
6
7 .if ${MACHINE_ARCH} == "i386"
8 CFLAGS+=        -Dprint_insn_i386=print_insn_i386_att
9 .endif
10
11 NOSHARED?=yes
12 PROG=   gdb
13 XSRCS=  annotate.c ax-general.c ax-gdb.c bcache.c blockframe.c          \
14         breakpoint.c buildsym.c c-exp.y c-lang.c c-typeprint.c          \
15         c-valprint.c ch-exp.c ch-lang.c ch-typeprint.c ch-valprint.c    \
16         coffread.c command.c complaints.c copying.c core-regset.c       \
17         corefile.c corelow.c cp-valprint.c dcache.c dbxread.c           \
18         demangle.c dwarfread.c dwarf2read.c elfread.c environ.c eval.c  \
19         exec.c expprint.c f-exp.y f-lang.c f-typeprint.c f-valprint.c   \
20         findvar.c fork-child.c freebsd-uthread.c gdbarch.c gdbtypes.c   \
21         infcmd.c inflow.c infptrace.c infrun.c inftarg.c language.c     \
22         jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c nlmread.c       \
23         m2-lang.c m2-exp.y m2-typeprint.c m2-valprint.c main.c maint.c  \
24         mdebugread.c mem-break.c minsyms.c objfiles.c parse.c           \
25         printcmd.c remote.c remote-utils.c scm-exp.c scm-lang.c         \
26         scm-valprint.c solib.c source.c stabsread.c stack.c symfile.c   \
27         symmisc.c symtab.c target.c thread.c top.c tracepoint.c         \
28         typeprint.c utils.c valarith.c valops.c valprint.c values.c     \
29         version.c serial.c ser-unix.c ser-tcp.c
30 SRCS=   init.c ${XSRCS}
31
32 .if exists(${.CURDIR}/Makefile.${MACHINE_ARCH})
33 .include "${.CURDIR}/Makefile.${MACHINE_ARCH}"
34 .endif
35
36 #CFLAGS+=       -I${.CURDIR}/${RELTOP}/libbinutils
37 CFLAGS+=        -I${.CURDIR}/${MACHINE_ARCH}
38 CFLAGS+=        -I${SRCDIR}/binutils
39 CFLAGS+=        -I${SRCDIR}/bfd
40 CFLAGS+=        -I${GDBDIR}/gdb
41 CFLAGS+=        -I${GDBDIR}/gdb/config
42 DPADD=          ${RELTOP}/libbfd/libbfd.a
43 DPADD+=         ${RELTOP}/libopcodes/libopcodes.a
44 DPADD+=         ${LIBGNUREGEX}
45 DPADD+=         ${RELTOP}/libiberty/libiberty.a
46 DPADD+=         ${LIBREADLINE}
47 DPADD+=         ${LIBTERMCAP}
48 LDADD+=         ${RELTOP}/libbfd/libbfd.a
49 LDADD+=         ${RELTOP}/libopcodes/libopcodes.a
50 LDADD+=         -lgnuregex
51 LDADD+=         ${RELTOP}/libiberty/libiberty.a
52 LDADD+=         -lreadline
53 LDADD+=         -ltermcap
54
55 GDBDIR= ${.CURDIR}/../../../../contrib/gdb
56 .PATH:  ${GDBDIR}/gdb
57 .PATH:  ${SRCDIR}/opcodes
58
59 CFLAGS+=        -DFREEBSD_ELF
60
61 CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline
62 # use phkmalloc
63 CFLAGS+= -DNO_MMALLOC
64 # uncomment the next line if you want to debug gdb
65 #CFLAGS+= -g
66 YFLAGS=
67
68 CLEANFILES=     init.c init.c-tmp
69
70 # We do this by grepping through sources.  If that turns out to be too slow,
71 # maybe we could just require every .o file to have an initialization routine
72 # of a given name (remote-udi.o -> _initialize_remote_udi, etc.).
73 #
74 # Formatting conventions:  The name of the _initialize_* routines must start
75 # in column zero, and must not be inside #if.
76 #
77 # Note that the set of files with init functions might change, or the names
78 # of the functions might change, so this files needs to depend on all the
79 # object files that will be linked into gdb.
80
81 init.c: ${XSRCS}
82         @${ECHO} Making ${.TARGET}
83         @rm -f init.c-tmp
84         @echo '/* Do not modify this file.  */' >init.c-tmp
85         @echo '/* It is created automatically by the Makefile.  */'>>init.c-tmp
86         @echo 'void initialize_all_files () {' >>init.c-tmp
87         @for i in ${.ALLSRC} ; do \
88           filename=`echo $$i | sed \
89             -e '/^Onindy.c/d' \
90             -e '/^nindy.c/d' \
91             -e '/ttyflush.c/d' \
92             -e '/xdr_ld.c/d' \
93             -e '/xdr_ptrace.c/d' \
94             -e '/xdr_rdb.c/d' \
95             -e '/udr.c/d' \
96             -e '/udip2soc.c/d' \
97             -e '/udi2go32.c/d' \
98             -e '/version.c/d' \
99             -e '/^[a-z0-9A-Z_]*_[SU].c/d' \
100             -e '/[a-z0-9A-Z_]*-exp.tab.c/d'` ; \
101           case $$filename in \
102             "") ;; \
103             *) sed <$$filename >>init.c-tmp -n \
104         -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/  {extern void \1 (); \1 ();}/p' ; ;; \
105           esac ; \
106         done
107         @echo '}' >>init.c-tmp
108         @mv init.c-tmp ${.TARGET}
109
110 .PRECIOUS: init.c
111
112 .include <bsd.prog.mk>