xref: /minix3/external/gpl3/binutils/lib/libbfd/Makefile (revision a150b26ee803b20080e65cd7a048322ba498f6bf)
1#	$NetBSD: Makefile,v 1.13 2015/03/28 07:03:23 matt Exp $
2
3NOLINKLIB=	# defined
4NOLINT=		# defined
5NOMAN=		# defined
6NOPROFILE=	# defined
7NOCLANGERROR=	# defined
8
9.include <bsd.own.mk>
10
11# If the platform does not support shared libraries, we need to supply
12# *something* for BFD-using programs to link against.  Also provide an
13# empty libinstall target so that libbfd.a does not get installed.
14.if ${MKPIC} == "no"
15MKLINKLIB=	yes
16libinstall:	# do nothing
17.endif
18
19LIB=		bfd
20
21BFD_MACHINE_ARCH?=	${MACHINE_ARCH:C/armv[4-7]/arm/}
22
23DEFS_MK=${.CURDIR}/arch/${BFD_MACHINE_ARCH}/defs.mk
24
25.if exists(${DEFS_MK})
26.include "${DEFS_MK}"
27
28DIST=		${NETBSDSRCDIR}/external/gpl3/binutils/dist
29
30.if defined(__MINIX)
31# MINIX: make sure sources are fetched, even when tools not built earlier
32GNUHOSTDIST=	${DIST}
33.include "${.CURDIR}/../../../../../minix/Makefile.fetchgnu"
34.endif # defined(__MINIX)
35
36SHLIB_MAJOR=	13
37SHLIB_MINOR=	0
38
39LIBDPLIBS+=	z	${.CURDIR}/../../../../../lib/libz
40
41GCPPFLAGS=	${G_archdefs} ${G_DEFS} ${G_INCLUDES} ${G_TDEFAULTS}
42CPPFLAGS+=	-I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
43		-I${DIST}/bfd ${GCPPFLAGS:M-D*} ${GCPPFLAGS:M-I*:N-I.*} \
44		-DDEBUGDIR=\"${DEBUGDIR}\"
45
46.if (${BFD_MACHINE_ARCH} == "vax")
47CPPFLAGS.elf.c +=	-O0
48.endif
49
50GSRCS=		${G_libbfd_la_OBJECTS:libbfd.lo=lib_bfd.lo} \
51		${G_libbfd_la_DEPENDENCIES:M*.lo}
52SRCS=		${GSRCS:.lo=.c}
53
54DPSRCS+=	elf32-target.h elf64-target.h targmatch.h \
55		elf32-ia64.c elf64-ia64.c peigen.c pepigen.c \
56		pex64igen.c
57CLEANFILES+=	elf32-target.h elf64-target.h targmatch.h \
58		elf32-ia64.c elf64-ia64.c peigen.c pepigen.c \
59		pex64igen.c
60
61TEXINFO=	bfd.texinfo
62INFOFLAGS=	-I${DIST}/bfd/doc
63
64.PATH: ${DIST}/bfd ${DIST}/bfd/doc
65
66.include <bsd.lib.mk>
67.include <bsd.info.mk>
68
69${OBJS} ${SOBJS}: elf32-target.h elf64-target.h
70targets.o targets.pico: targmatch.h Makefile
71.else
72.include <bsd.prog.mk> # do nothing
73.endif
74
75targmatch.h: config.bfd targmatch.sed
76	${_MKTARGET_CREATE}
77	${TOOL_SED} -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} >$@
78
79elf32-target.h: elfxx-target.h
80	${_MKTARGET_CREATE}
81	${TOOL_SED} -e s/NN/32/g < $> > $@
82
83elf64-target.h: elfxx-target.h
84	${_MKTARGET_CREATE}
85	${TOOL_SED} -e s/NN/64/g < $> > $@
86
87elf32-ia64.c: elfnn-ia64.c
88	${_MKTARGET_CREATE}
89	${TOOL_SED} -e s/NN/32/g < $> > $@
90
91elf64-ia64.c: elfnn-ia64.c
92	${_MKTARGET_CREATE}
93	${TOOL_SED} -e s/NN/64/g < $> > $@
94
95elf32-riscv.c: elfnn-riscv.c
96	${_MKTARGET_CREATE}
97	${TOOL_SED} -e s/NN/32/g < $> > $@
98
99elf64-riscv.c: elfnn-riscv.c
100	${_MKTARGET_CREATE}
101	${TOOL_SED} -e s/NN/64/g < $> > $@
102
103peigen.c: peXXigen.c
104	${_MKTARGET_CREATE}
105	${TOOL_SED} -e s/XX/pe/g < $> > $@
106
107pepigen.c: peXXigen.c
108	${_MKTARGET_CREATE}
109	${TOOL_SED} -e s/XX/pep/g < $> > $@
110
111pex64igen.c: peXXigen.c
112	${_MKTARGET_CREATE}
113	${TOOL_SED} -e s/XX/pex64/g < $> > $@
114
115.if defined(__MINIX) && ${USETOOLS} != "yes"
116# Trigger the fetch phase, even when not building tools
117${SRCS} realdepend realall realinstall: ${fetch_done}
118.endif # defined(__MINIX)
119