]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - gnu/usr.bin/binutils/gdb/Makefile
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / gnu / usr.bin / binutils / gdb / Makefile
1 # ex:ts=8
2 # $FreeBSD$
3
4 .include "../Makefile.inc0"
5
6 GDBDIR= ${.CURDIR}/../../../../contrib/gdb
7 .PATH: ${GDBDIR}/gdb ${GDBDIR}/gdb/cli ${GDBDIR}/gdb/mi
8 .PATH: ${SRCDIR}/opcodes ${SRCDIR}/binutils
9
10 #       For FSF GDB files, use their CPU (arch) name; for our files use ours.
11 .if ${TARGET_ARCH} == "sparc64"
12 GDB_CPU=        sparc
13 .elif ${TARGET_ARCH} == "amd64"
14 GDB_CPU=        i386
15 .else
16 GDB_CPU=        ${TARGET_ARCH}
17 .endif
18
19 NO_SHARED?=yes
20 PROG=   gdb
21 XSRCS=  annotate.c arch-utils.c ax-general.c ax-gdb.c bcache.c          \
22         blockframe.c breakpoint.c buildsym.c complaints.c completer.c   \
23         copying.c corefile.c corelow.c dcache.c doublest.c event-loop.c \
24         event-top.c environ.c eval.c exec.c expprint.c fork-child.c     \
25         frame.c gdb-events.c gdbarch.c gdbtypes.c infcmd.c inflow.c     \
26         infptrace.c inf-loop.c infrun.c inftarg.c language.c linespec.c \
27         main.c maint.c mdebugread.c mem-break.c memattr.c minsyms.c     \
28         objfiles.c parse.c printcmd.c regcache.c remote.c               \
29         remote-utils.c signals.c source.c stabsread.c stack.c symfile.c \
30         symmisc.c symtab.c target.c thread.c top.c tracepoint.c         \
31         typeprint.c ui-file.c ui-out.c utils.c valarith.c valops.c      \
32         varobj.c valprint.c values.c wrapper.c                          \
33         cli-cmds.c cli-cmds.h cli-decode.c cli-decode.h cli-out.c       \
34         cli-script.c cli-script.h cli-setshow.c cli-setshow.h           \
35         cli-utils.c cli-utils.h                                         \
36         mi-cmd-break.c mi-cmd-disas.c mi-cmd-stack.c mi-cmd-var.c       \
37         mi-cmds.c mi-console.c mi-getopt.c mi-main.c mi-out.c mi-parse.c\
38         serial.c ser-unix.c ser-tcp.c                                   \
39         c-exp.y c-lang.c c-typeprint.c c-valprint.c                     \
40         ch-exp.c ch-lang.c ch-typeprint.c ch-valprint.c                 \
41         cp-abi.c gnu-v2-abi.c gnu-v3-abi.c cp-valprint.c demangle.c     \
42         f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c           \
43         jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c nlmread.c       \
44         m2-lang.c m2-exp.y m2-typeprint.c m2-valprint.c                 \
45         scm-exp.c scm-lang.c scm-valprint.c                             \
46         coffread.c dbxread.c dwarfread.c dwarf2read.c elfread.c         \
47         solib.c solib-svr4.c solib-legacy.c
48 XSRCS+= freebsd-uthread.c kvm-fbsd.c kvm-fbsd-machine.h solib-fbsd-kld.c
49 SRCS=   init.c ${XSRCS} nm.h tm.h xm.h gdbversion.c xregex.h
50
51 .include "${.CURDIR}/Makefile.${TARGET_ARCH}"
52
53 WARNS?= 0
54 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
55 CFLAGS+=        -DCROSS_COMPILE=1
56 .endif
57 CFLAGS+=        -DDEFAULT_BFD_ARCH=bfd_${GDB_CPU}_arch
58 CFLAGS+=        -I${.CURDIR}/${TARGET_ARCH}
59 CFLAGS+=        -I${SRCDIR}/binutils -I${SRCDIR}/bfd
60 CFLAGS+=        -I${GDBDIR}/gdb -I${GDBDIR}/gdb/config
61 CFLAGS+=        -I$(.CURDIR)
62
63 YFLAGS=
64
65 DPADD=          ${LIBKVM} ${LIBM}
66 DPADD+=         ${RELTOP}/libbfd/libbfd.a ${RELTOP}/libopcodes/libopcodes.a
67 DPADD+=         ${LIBGNUREGEX}
68 DPADD+=         ${RELTOP}/libiberty/libiberty.a
69 DPADD+=         ${LIBREADLINE} ${LIBTERMCAP}
70 LDADD=          -lkvm -lm
71 LDADD+=         ${RELTOP}/libbfd/libbfd.a ${RELTOP}/libopcodes/libopcodes.a
72 LDADD+=         -lgnuregex
73 LDADD+=         ${RELTOP}/libiberty/libiberty.a
74 LDADD+=         -lreadline -ltermcap
75
76 CLEANFILES=     init.c init.c-tmp nm.h tm.h xm.h gdbversion.c xregex.h kvm-fbsd-machine.h
77
78 # We do this by grepping through sources.  If that turns out to be too slow,
79 # maybe we could just require every .o file to have an initialization routine
80 # of a given name (remote-udi.o -> _initialize_remote_udi, etc.).
81 #
82 # Formatting conventions:  The name of the _initialize_* routines must start
83 # in column zero, and must not be inside #if.
84 #
85 # Note that the set of files with init functions might change, or the names
86 # of the functions might change, so this files needs to depend on all the
87 # object files that will be linked into gdb.
88
89 init.c: ${XSRCS}
90         @${ECHO} Making ${.TARGET}
91         @rm -f init.c-tmp
92         @echo '/* Do not modify this file.  */' >init.c-tmp
93         @echo '/* It is created automatically by the Makefile.  */'>>init.c-tmp
94         @echo '#include "defs.h"'               >>init.c-tmp
95         @echo '#include "call-cmds.h"'          >>init.c-tmp
96         @echo 'void initialize_all_files () {' >>init.c-tmp
97         @for i in ${.ALLSRC} ; do \
98           filename=`echo $$i | sed \
99             -e '/^Onindy.c/d' \
100             -e '/^nindy.c/d' \
101             -e '/ttyflush.c/d' \
102             -e '/xdr_ld.c/d' \
103             -e '/xdr_ptrace.c/d' \
104             -e '/xdr_rdb.c/d' \
105             -e '/udr.c/d' \
106             -e '/udip2soc.c/d' \
107             -e '/udi2go32.c/d' \
108             -e '/version.c/d' \
109             -e '/^[a-z0-9A-Z_]*_[SU].c/d' \
110             -e '/[a-z0-9A-Z_]*-exp.tab.c/d'` ; \
111           case $$filename in \
112             "") ;; \
113             *) sed <$$filename >>init.c-tmp -n \
114         -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/  {extern void \1 (); \1 ();}/p' ; ;; \
115           esac ; \
116         done
117         @echo '}' >>init.c-tmp
118         @mv init.c-tmp ${.TARGET}
119
120 .PRECIOUS: init.c
121
122 tm.h:
123         echo '#include "${GDB_CPU}/tm-fbsd.h"'          > ${.TARGET}
124 .if exists(${.CURDIR}/fbsd-kgdb-${TARGET_ARCH}.h)
125         echo '#include "fbsd-kgdb-${TARGET_ARCH}.h"'    >> ${.TARGET}
126 .endif
127
128 .for H in nm-fbsd xm-${GDB_CPU}
129 ${H:C/-.*$//}.h:
130         ln -sf ${GDBDIR}/gdb/config/${GDB_CPU}/${H}.h ${.TARGET}
131 .endfor
132
133 kvm-fbsd-machine.h:
134         ln -sf ${.CURDIR}/kvm-fbsd-${TARGET_ARCH}.h ${.TARGET}
135
136 GDB_VERSION=    "5.2.1 (FreeBSD)"
137 gdbversion.c: Makefile
138         @echo '#include "version.h"'                            > ${.TARGET}
139         @echo 'const char version[] = ${GDB_VERSION};'          >>${.TARGET}
140         @echo 'const char host_name[] = "${MACHINE_ARCH}-undermydesk-freebsd";'                 >>${.TARGET}
141         @echo 'const char target_name[] = "${TARGET_ARCH}-undermydesk-freebsd";'                >>${.TARGET}
142
143 xregex.h:
144         @echo '#include <gnu/regex.h>' >${.TARGET}
145
146 .include <bsd.prog.mk>