binutils220: add our build infrastructure
[dragonfly.git] / gnu / usr.bin / binutils220 / libbfd / Makefile
1 .include "../Makefile.inc0"
2
3 LIB=    bfd
4 INTERNALLIB=    true
5
6 CONTRIBDIR=     ${SRCDIR}/bfd
7 .PATH:  ${CONTRIBDIR}
8
9 CFLAGS+=        -I${SRCDIR}/include -I${CONTRIBDIR} -I${.CURDIR} -I${.OBJDIR}
10 # XXX no clue what DEBUGDIR is for
11 CFLAGS+=        -DDEBUGDIR='"/usr/lib/debug"'
12
13 SRCS=   archive.c archures.c bfd.c bfdio.c bfdwin.c \
14         cache.c coffgen.c corefile.c format.c init.c libbfd.c \
15         opncls.c reloc.c section.c syms.c targets.c hash.c \
16         linker.c srec.c binary.c tekhex.c ihex.c stabs.c \
17         stab-syms.c merge.c dwarf2.c simple.c compress.c \
18         verilog.c
19
20 SRCS+=          targmatch.h elf32-target.h elf64-target.h
21 CLEANFILES+=    elf64-target.h elf32-target.h targmatch.h
22
23 targmatch.h: config.bfd targmatch.sed
24         sed -f ${CONTRIBDIR}/targmatch.sed < ${CONTRIBDIR}/config.bfd > ${.TARGET}
25
26 elf32-target.h: elfxx-target.h
27         sed -e s/NN/32/g < ${CONTRIBDIR}/elfxx-target.h > ${.TARGET}
28 elf64-target.h: elfxx-target.h
29         sed -e s/NN/64/g < ${CONTRIBDIR}/elfxx-target.h > ${.TARGET}
30
31 TARGET_ARCH?=   ${MACHINE_ARCH}
32 .include "Makefile.${TARGET_ARCH}"
33
34 .for _v in ${VECTORS}
35 CFLAGS+= -DHAVE_${_v}
36 .endfor
37 CFLAGS+= -DSELECT_VECS='${VECTORS:S/^/\&/:S/$/,/} NULL'
38 CFLAGS+= -DSELECT_ARCHITECTURES='${ARCHITECTURES:S/^/\&/:S/$/,/} NULL'
39 CFLAGS+= -DDEFAULT_VECTOR=${DEFAULT_VECTOR}
40
41
42 SRCS+=          bfd.h bfdver.h
43 CLEANFILES+=    bfd.h bfdver.h
44
45 # Used to do keyword replacement in bfd-X.h
46 #
47 BFD_HOST_64_BIT_DEFINED?=1
48 BFD_HOST_LONG_LONG?=1
49 .include "Makefile.host.${MACHINE_ARCH}"
50
51 bfd.h:  ${CONTRIBDIR}/bfd-in2.h
52         sed -e "s/@supports_plugins@/0/g" \
53             -e "s/@wordsize@/${BFD_ARCH_SIZE}/g" \
54             -e "s/@bfd_default_target_size@/${BFD_DEFAULT_TARGET_SIZE}/g" \
55             -e "s/@BFD_HOST_64BIT_LONG@/${BFD_HOST_64BIT_LONG}/g" \
56             -e "s/@BFD_HOST_64BIT_LONG_LONG@/${BFD_HOST_64BIT_LONG_LONG}/g" \
57             -e "s/@BFD_HOST_64_BIT@/${BFD_HOST_64_BIT}/g" \
58             -e "s/@BFD_HOST_U_64_BIT@/${BFD_HOST_U_64_BIT}/g" \
59             -e "s/@BFD_HOST_64_BIT_DEFINED@/${BFD_HOST_64_BIT_DEFINED}/g" \
60             -e "s/@bfd_file_ptr@/${BFD_HOST_64_BIT}/g" \
61             -e "s/@BFD_HOSTPTR_T@/${BFD_HOSTPTR_T}/g" \
62             < ${CONTRIBDIR}/bfd-in2.h > bfd.h.new
63         mv -f bfd.h.new bfd.h
64
65 bfdver.h: ${CONTRIBDIR}/version.h
66         sed -e "s/@bfd_version_string@/\"2.20.0\"/g" \
67             -e "s/@bfd_version_package@/\"(GNU Binutils) \"/g" \
68             -e "s/@bfd_version@/220000000/g" \
69             -e "s/@report_bugs_to@/\"\"/g" \
70             < ${CONTRIBDIR}/version.h > bfdver.h.new
71         mv -f bfdver.h.new bfdver.h
72
73 SRCS+=          bfd_stdint.h
74 CLEANFILES+=    bfd_stdint.h
75
76 bfd_stdint.h:
77         touch ${.TARGET}
78
79 .include <bsd.lib.mk>