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-eh-frame.c \
23	elf-strtab.c \
24	elf-vxworks.c \
25	elf.c \
26	format.c \
27	hash.c \
28	ihex.c \
29	init.c \
30	libbfd.c \
31	linker.c \
32	merge.c \
33	opncls.c \
34	reloc.c \
35	section.c \
36	simple.c \
37	srec.c \
38	stab-syms.c \
39	stabs.c \
40	syms.c \
41	targets.c \
42	targmatch.h \
43	tekhex.c
44.if (${TARGET_ARCH} == "ia64" || ${TARGET_ARCH} == "sparc64")
45WARNS?=	2
46.endif
47CFLAGS+= -D_GNU_SOURCE
48CFLAGS+= -I${SRCDIR}/bfd
49INTERNALLIB=
50CLEANFILES+=	bfdver.h config.h targmatch.h
51
52SELARCH=
53.if ${TARGET_ARCH} == "amd64"
54SELARCH= &bfd_i386_arch
55.elif ${TARGET_ARCH} == "sparc64"
56SELARCH= &bfd_sparc_arch
57.elif ${TARGET_ARCH} == "powerpc64"
58SELARCH= &bfd_powerpc_arch,&bfd_rs6000_arch
59.else
60.for _a in ${ARCHS}
61.if ${SELARCH} == ""
62SELARCH+= &bfd_${_a}_arch
63.else
64SELARCH+= ,&bfd_${_a}_arch
65.endif
66.endfor
67.endif
68CFLAGS+= -DSELECT_ARCHITECTURES="${SELARCH}"
69
70SELVEC=
71.for _v in ${VECS}
72CFLAGS+= -DHAVE_${_v}
73.if ${SELVEC} == ""
74SELVEC+= &${_v}
75.else
76SELVEC+= ,&${_v}
77.endif
78.endfor
79CFLAGS+= -DSELECT_VECS="${SELVEC}"
80CFLAGS+= -DDEFAULT_VECTOR=${DEFAULT_VECTOR}
81
82# XXX:DEO should grab BFD_VERSION_DATE from ${VERSION}...
83bfdver.h: Makefile
84	echo '#define BFD_VERSION	217000000'	> ${.TARGET}
85	echo '#define BFD_VERSION_DATE	20070807'	>> ${.TARGET}
86	echo '#define BFD_VERSION_STRING ${VERSION}'	>> ${.TARGET}
87
88targmatch.h: targmatch.sed config.bfd
89	sed -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} > ${.TARGET}
90
91config.h: config.h.fbsd
92.if ${TARGET_ARCH} == "i386"
93	sed -e 's,!!TRAD_HEADER!!,"hosts/i386bsd.h",g' ${.ALLSRC} > ${.TARGET}
94.else
95	sed -e 's,!!TRAD_HEADER!!,,g' ${.ALLSRC} > ${.TARGET}
96.endif
97
98CLEANFILES+=	elf32-target.h elf64-target.h
99elf32-target.h: elfxx-target.h
100	sed -e s/NN/32/g ${.ALLSRC} > ${.TARGET}
101
102elf64-target.h: elfxx-target.h
103	sed -e s/NN/64/g ${.ALLSRC} > ${.TARGET}
104
105.include <bsd.lib.mk>
106