xref: /freebsd/contrib/elftoolchain/elfcopy/Makefile (revision 715d1396d6233158b94e85414b57520ee3e536cc)
1*715d1396SEd Maste# $Id: Makefile 3608 2018-04-14 21:23:04Z jkoshy $
2a85fe12eSEd Maste
3a85fe12eSEd MasteTOP=	..
4a85fe12eSEd Maste
5839529caSEd Maste.include "${TOP}/mk/elftoolchain.components.mk"
6839529caSEd Maste
7a85fe12eSEd MastePROG=	elfcopy
8a85fe12eSEd Maste
9839529caSEd MasteSRCS=	archive.c ascii.c binary.c main.c sections.c segments.c \
10839529caSEd Maste	symbols.c
11a85fe12eSEd Maste
12a85fe12eSEd MasteWARNS?=	5
13a85fe12eSEd Maste
14a85fe12eSEd MasteDPADD=	${LIBELF} ${LIBELFTC}
15a85fe12eSEd MasteLDADD=	-lelf -lelftc
16a85fe12eSEd Maste
17a85fe12eSEd Maste.if !defined(LIBELF_AR)
18a85fe12eSEd MasteLDADD+= -larchive
19a85fe12eSEd Maste.endif
20a85fe12eSEd Maste
21*715d1396SEd Maste.if defined(WITH_PE) && ${WITH_PE} == "yes"
22839529caSEd MasteSRCS+=	pe.c
23839529caSEd MasteCFLAGS+= -DWITH_PE=1
24839529caSEd Maste
25839529caSEd MasteDPADD+=	${LIBPE}
26839529caSEd MasteLDADD+=	-lpe
27839529caSEd Maste.endif
28839529caSEd Maste
29a85fe12eSEd MasteMAN=	elfcopy.1 mcs.1 strip.1
30839529caSEd MasteMLINKS=	elfcopy.1 objcopy.1
31a85fe12eSEd Maste
32a85fe12eSEd MasteNO_SHARED?=	yes
33a85fe12eSEd Maste
34839529caSEd MasteLINKS=	${BINDIR}/elfcopy ${BINDIR}/mcs		\
35839529caSEd Maste	${BINDIR}/elfcopy ${BINDIR}/objcopy 	\
36839529caSEd Maste	${BINDIR}/elfcopy ${BINDIR}/strip
37a85fe12eSEd Maste
38839529caSEd MasteEXTRA_TARGETS=	mcs strip objcopy
39a85fe12eSEd Maste
40a85fe12eSEd MasteCLEANFILES+=	${EXTRA_TARGETS}
41a85fe12eSEd Maste
42a85fe12eSEd Maste# Create in-place symbolic links to "elfcopy" at build time.
43a85fe12eSEd Maste
44a85fe12eSEd Masteall:	${EXTRA_TARGETS}
45a85fe12eSEd Maste
46a85fe12eSEd Maste${EXTRA_TARGETS}:	${PROG}
47a85fe12eSEd Maste	ln -s ${PROG} ${.TARGET}
48a85fe12eSEd Maste
49a85fe12eSEd Maste.include "${TOP}/mk/elftoolchain.prog.mk"
50a85fe12eSEd Maste
51a85fe12eSEd Maste.if ${OS_HOST} == "OpenBSD"
52a85fe12eSEd MasteCFLAGS+=	-I/usr/local/include
53a85fe12eSEd MasteLDFLAGS+=	-L/usr/local/lib
54*715d1396SEd Maste.elif ${OS_HOST} == "DragonFly"
55*715d1396SEd MasteLDADD+=		-lbz2
56a85fe12eSEd Maste.endif
57