1#	$NetBSD: Makefile,v 1.4 2010/03/14 00:26:09 mrg Exp $
2
3NOLINKLIB=	# defined
4NOLINT=		# defined
5NOMAN=		# defined
6NOPROFILE=	# defined
7
8.include <bsd.own.mk>
9
10# If the platform does not support shared libraries, we need to supply
11# *something* for BFD-using programs to link against.  Also provide an
12# empty libinstall target so that libbfd.a does not get installed.
13.if ${MKPIC} == "no"
14MKLINKLIB=	yes
15libinstall:	# do nothing
16.endif
17
18LIB=		bfd
19
20BFD_MACHINE_ARCH?=	${MACHINE_ARCH}
21
22.if exists(${.CURDIR}/arch/${BFD_MACHINE_ARCH}/defs.mk)
23.include "${.CURDIR}/arch/${BFD_MACHINE_ARCH}/defs.mk"
24
25DIST=		${NETBSDSRCDIR}/external/gpl3/binutils/dist
26
27SHLIB_MAJOR=	11
28SHLIB_MINOR=	0
29
30LIBDPLIBS+=	z	${.CURDIR}/../../../../../lib/libz
31
32GCPPFLAGS=	${G_archdefs} ${G_DEFS} ${G_INCLUDES} ${G_TDEFAULTS}
33CPPFLAGS+=	-I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
34		-I${DIST}/bfd ${GCPPFLAGS:M-D*} ${GCPPFLAGS:M-I*:N-I.*} \
35		-DDEBUGDIR=\"${DEBUGDIR}\"
36
37GSRCS=		${G_libbfd_la_OBJECTS:libbfd.lo=lib_bfd.lo} \
38		${G_libbfd_la_DEPENDENCIES:M*.lo}
39SRCS=		${GSRCS:.lo=.c}
40
41DPSRCS+=	elf32-target.h elf64-target.h targmatch.h \
42		elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
43CLEANFILES+=	elf32-target.h elf64-target.h targmatch.h \
44		elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
45
46TEXINFO=	bfd.texinfo
47INFOFLAGS=	-I${DIST}/bfd/doc
48
49.PATH: ${DIST}/bfd ${DIST}/bfd/doc
50
51.include <bsd.lib.mk>
52.include <bsd.info.mk>
53
54${OBJS} ${SOBJS}: elf32-target.h elf64-target.h
55targets.o targets.pico: targmatch.h Makefile
56.else
57.include <bsd.prog.mk> # do nothing
58.endif
59
60targmatch.h: config.bfd targmatch.sed
61	${_MKTARGET_CREATE}
62	${TOOL_SED} -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} >$@
63
64elf32-target.h: elfxx-target.h
65	${_MKTARGET_CREATE}
66	${TOOL_SED} -e s/NN/32/g < $> > $@
67
68elf64-target.h: elfxx-target.h
69	${_MKTARGET_CREATE}
70	${TOOL_SED} -e s/NN/64/g < $> > $@
71
72elf32-ia64.c: elfxx-ia64.c
73	${_MKTARGET_CREATE}
74	${TOOL_SED} -e s/NN/32/g < $> > $@
75
76elf64-ia64.c: elfxx-ia64.c
77	${_MKTARGET_CREATE}
78	${TOOL_SED} -e s/NN/64/g < $> > $@
79
80peigen.c: peXXigen.c
81	${_MKTARGET_CREATE}
82	${TOOL_SED} -e s/XX/pe/g < $> > $@
83
84pepigen.c: peXXigen.c
85	${_MKTARGET_CREATE}
86	${TOOL_SED} -e s/XX/pep/g < $> > $@
87
88pex64igen.c: peXXigen.c
89	${_MKTARGET_CREATE}
90	${TOOL_SED} -e s/XX/pex64/g < $> > $@
91