1# $FreeBSD$
2
3.include "../Makefile.inc0"
4
5.PATH: ${SRCDIR}/bfd ${SRCDIR}/opcodes
6
7LIB=	bfd
8SRCS+=	archive.c \
9	archive64.c \
10	archures.c \
11	bfd.c \
12	bfdio.c \
13	bfdver.h \
14	bfdwin.c \
15	binary.c \
16	cache.c \
17	coffgen.c \
18	config.h \
19	corefile.c \
20	dwarf1.c \
21	dwarf2.c \
22	elf-attrs.c \
23	elf-eh-frame.c \
24	elf-strtab.c \
25	elf-vxworks.c \
26	elf.c \
27	format.c \
28	hash.c \
29	ihex.c \
30	init.c \
31	libbfd.c \
32	linker.c \
33	merge.c \
34	opncls.c \
35	reloc.c \
36	section.c \
37	simple.c \
38	srec.c \
39	stab-syms.c \
40	stabs.c \
41	syms.c \
42	targets.c \
43	targmatch.h \
44	tekhex.c
45.if (${TARGET_ARCH} == "ia64" || ${TARGET_ARCH} == "sparc64")
46WARNS?=	2
47.endif
48CFLAGS+= -D_GNU_SOURCE
49CFLAGS+= -I${SRCDIR}/bfd
50INTERNALLIB=
51CLEANFILES+=	bfdver.h config.h targmatch.h
52
53SELARCH=
54.if ${TARGET_ARCH} == "amd64"
55SELARCH= &bfd_i386_arch
56.elif ${TARGET_ARCH} == "sparc64"
57SELARCH= &bfd_sparc_arch
58.elif ${TARGET_ARCH} == "powerpc64"
59SELARCH= &bfd_powerpc_arch,&bfd_rs6000_arch
60.else
61.for _a in ${ARCHS}
62.if ${SELARCH} == ""
63SELARCH+= &bfd_${_a}_arch
64.else
65SELARCH+= ,&bfd_${_a}_arch
66.endif
67.endfor
68.endif
69CFLAGS+= -DSELECT_ARCHITECTURES="${SELARCH}"
70
71SELVEC=
72.for _v in ${VECS}
73CFLAGS+= -DHAVE_${_v}
74.if ${SELVEC} == ""
75SELVEC+= &${_v}
76.else
77SELVEC+= ,&${_v}
78.endif
79.endfor
80CFLAGS+= -DSELECT_VECS="${SELVEC}"
81CFLAGS+= -DDEFAULT_VECTOR=${DEFAULT_VECTOR}
82CFLAGS+= -DDEBUGDIR="NULL"
83
84# XXX:DEO should grab BFD_VERSION_DATE from ${VERSION}...
85bfdver.h: Makefile
86	echo '#define BFD_VERSION	217500000'	> ${.TARGET}
87	echo '#define BFD_VERSION_DATE	20070703'	>> ${.TARGET}
88	echo '#define BFD_VERSION_STRING ${VERSION}'	>> ${.TARGET}
89	echo '#define REPORT_BUGS_TO "<http://www.freebsd.org/send-pr.html>"' >> ${.TARGET}
90
91targmatch.h: targmatch.sed config.bfd
92	sed -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} > ${.TARGET}
93
94config.h: config.h.fbsd
95.if ${TARGET_ARCH} == "i386"
96	sed -e 's,!!TRAD_HEADER!!,"hosts/i386bsd.h",g' ${.ALLSRC} > ${.TARGET}
97.else
98	sed -e 's,!!TRAD_HEADER!!,,g' ${.ALLSRC} > ${.TARGET}
99.endif
100
101CLEANFILES+=	elf32-target.h elf64-target.h
102elf32-target.h: elfxx-target.h
103	sed -e s/NN/32/g ${.ALLSRC} > ${.TARGET}
104
105elf64-target.h: elfxx-target.h
106	sed -e s/NN/64/g ${.ALLSRC} > ${.TARGET}
107
108.include <bsd.lib.mk>
109