1# $FreeBSD$
2
3.include "../Makefile.inc0"
4
5.PATH: ${SRCDIR}/bfd ${SRCDIR}/opcodes
6
7LIB=	bfd
8SRCS+=	archive.c archive64.c archures.c bfd.c binary.c cache.c \
9	coffgen.c corefile.c elf.c elf-eh-frame.c elf-strtab.c format.c \
10	hash.c ihex.c init.c libbfd.c linker.c merge.c opncls.c reloc.c \
11	section.c srec.c stab-syms.c stabs.c syms.c targets.c tekhex.c \
12	targmatch.h dwarf1.c dwarf2.c config.h
13.if (${TARGET_ARCH} == "alpha")
14WARNS=	2
15.endif
16CFLAGS+= -I${SRCDIR}/bfd
17CFLAGS+= -DBFD_VERSION=\"${VERSION_DATE}\" -DBFD_VERSION_DATE=${VERSION_DATE}
18CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\"
19NOPROFILE=	true
20NOPIC=		true
21INTERNALLIB=	true
22INTERNALSTATICLIB=true
23CLEANFILES+=	config.h targmatch.h
24
25# If set, BINUTILSDISTDIR is the path to a directory containing the full GNU
26# binutils release. FreeBSD only distributes the bits that are required to
27# build native architectures. BINUTILSDISTDIR is needed to build cross tools.
28.if defined(BINUTILSDISTDIR) && exists(${BINUTILSDISTDIR})
29.PATH: ${BINUTILSDISTDIR}/bfd ${BINUTILSDISTDIR}/opcodes
30CFLAGS+= -I${BINUTILSDISTDIR}/bfd -I${BINUTILSDISTDIR}/include -I.
31.endif
32
33SELARCH=
34.if ${BINUTIL_ARCH} == "sparc64"
35SELARCH= &bfd_sparc_arch
36.else
37.for _a in ${ARCHS}
38.if ${SELARCH} == ""
39SELARCH+= &bfd_${_a}_arch
40.else
41SELARCH+= ,&bfd_${_a}_arch
42.endif
43.endfor
44.endif
45CFLAGS+= -DSELECT_ARCHITECTURES="${SELARCH}"
46
47SELVEC=
48.for _v in ${VECS}
49.if ${SELVEC} == ""
50SELVEC+= &${_v}
51.else
52SELVEC+= ,&${_v}
53.endif
54.endfor
55CFLAGS+= -DSELECT_VECS="${SELVEC}"
56
57targmatch.h: targmatch.sed config.bfd
58	sed -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} > ${.TARGET}
59
60config.h: config.h.fbsd
61.if ${BINUTIL_ARCH} == "i386"
62	sed -e 's,!!TRAD_HEADER!!,"hosts/i386bsd.h",g' ${.ALLSRC} > ${.TARGET}
63.else
64	sed -e 's,!!TRAD_HEADER!!,,g' ${.ALLSRC} > ${.TARGET}
65.endif
66
67.include <bsd.lib.mk>
68