binutils214 stage 1/4. Bring in the build infrastructure (left untied from
[dragonfly.git] / gnu / usr.bin / binutils214 / libbfd / Makefile
1 # $FreeBSD: src/gnu/usr.bin/binutils/libbfd/Makefile,v 1.9.2.3 2002/09/01 23:39:15 obrien Exp $
2 # $DragonFly: src/gnu/usr.bin/binutils214/libbfd/Attic/Makefile,v 1.1 2004/02/01 08:53:04 dillon Exp $
3
4 .include "../Makefile.inc0"
5
6 .PATH: ${SRCDIR}/bfd ${SRCDIR}/opcodes
7
8 LIB=    bfd
9 SRCS+=  archive.c archive64.c archures.c bfd.c bfdio.c binary.c cache.c \
10         coffgen.c corefile.c elf.c elf-eh-frame.c elf-strtab.c format.c \
11         hash.c ihex.c init.c libbfd.c linker.c merge.c opncls.c reloc.c \
12         section.c simple.c srec.c stab-syms.c stabs.c syms.c \
13         targets.c tekhex.c \
14         targmatch.h dwarf1.c dwarf2.c config.h bfd.h bfdver.h
15 .if (${TARGET_ARCH} == "alpha" || ${TARGET_ARCH} == "sparc64")
16 WARNS=  2
17 .endif
18 CFLAGS+= -I${SRCDIR}/bfd
19 INTERNALLIB=    true
20 CLEANFILES+=    bfd.h bfdver.h config.h targmatch.h
21
22 # If set, BINUTILSDISTDIR is the path to a directory containing the full GNU
23 # binutils release. FreeBSD only distributes the bits that are required to
24 # build native architectures. BINUTILSDISTDIR is needed to build cross tools.
25 .if defined(BINUTILSDISTDIR) && exists(${BINUTILSDISTDIR})
26 .PATH: ${BINUTILSDISTDIR}/bfd ${BINUTILSDISTDIR}/opcodes
27 CFLAGS+= -I${BINUTILSDISTDIR}/bfd -I${BINUTILSDISTDIR}/include -I.
28 .endif
29
30 SELARCH=
31 .if ${BINUTIL_ARCH} == "sparc64"
32 SELARCH= &bfd_sparc_arch
33 .else
34 .for _a in ${ARCHS}
35 .if ${SELARCH} == ""
36 SELARCH+= &bfd_${_a}_arch
37 .else
38 SELARCH+= ,&bfd_${_a}_arch
39 .endif
40 .endfor
41 .endif
42 CFLAGS+= -DSELECT_ARCHITECTURES="${SELARCH}"
43
44 SELVEC=
45 .for _v in ${VECS}
46 .if ${SELVEC} == ""
47 SELVEC+= &${_v}
48 .else
49 SELVEC+= ,&${_v}
50 .endif
51 .endfor
52 CFLAGS+= -DSELECT_VECS="${SELVEC}"
53
54 # Used to do keyword replacement in bfd-X.h
55 #
56 BFD_ARCH_SIZE?=64
57 BFD_DEFAULT_TARGET_SIZE?=64
58 .if ${MACHINE_ARCH} == "i386"
59 BFD_HOST_64BIT_LONG?=0
60 .else
61 BFD_HOST_64BIT_LONG?=1
62 .endif
63 BFD_HOST_64_BIT_DEFINED?=0
64
65 bfd.h:  ${SRCDIR}/bfd/bfd-in2.h
66         sed -e "s/@wordsize@/${BFD_ARCH_SIZE}/g" \
67             -e "s/@bfd_default_target_size@/${BFD_DEFAULT_TARGET_SIZE}/g" \
68             -e "s/@BFD_HOST_64BIT_LONG@/${BFD_HOST_64BIT_LONG}/g" \
69             -e "s/@BFD_HOST_64_BIT@/${BFD_HOST_64_BIT}/g" \
70             -e "s/@BFD_HOST_U_64_BIT@/${BFD_HOST_U_64_BIT}/g" \
71             -e "s/@BFD_HOST_64_BIT_DEFINED@/${BFD_HOST_64_BIT_DEFINED}/g" \
72             < ${SRCDIR}/bfd/bfd-in2.h > bfd.h.new
73         mv -f bfd.h.new bfd.h
74
75 bfdver.h: ${SRCDIR}/bfd/version.h
76         sed -e "s/@bfd_version_string@/\\\"`echo -n ${VERSION}`\\\"/g" \
77             -e "s/@bfd_version@/${VERSION_DATE}/g" \
78             < ${SRCDIR}/bfd/version.h > bfdver.h.new
79         mv -f bfdver.h.new bfdver.h
80
81 targmatch.h: targmatch.sed config.bfd dfly_targmatch.h
82         sed -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} > ${.TARGET}.new
83         cat ${.CURDIR}/dfly_targmatch.h >> ${.TARGET}.new
84         mv -f ${.TARGET}.new ${.TARGET}
85         
86 config.h: config.h.template
87 .if ${BINUTIL_ARCH} == "i386"
88         sed -e 's,!!TRAD_HEADER!!,"hosts/i386bsd.h",g' ${.ALLSRC} > ${.TARGET}
89 .else
90         sed -e 's,!!TRAD_HEADER!!,,g' ${.ALLSRC} > ${.TARGET}
91 .endif
92
93 .include <bsd.lib.mk>