xref: /freebsd/usr.bin/elfcopy/Makefile (revision f947f58ce624b5442e24b1efa69c0ddcdf3e0ddb)
1ca0fc8efSEd Maste.include <src.opts.mk>
2ca0fc8efSEd Maste
3*f947f58cSLexi WinterPACKAGE=	toolchain
4ca0fc8efSEd Maste
5ca0fc8efSEd MasteELFTCDIR=	${SRCTOP}/contrib/elftoolchain
6ca0fc8efSEd MasteELFCOPYDIR=	${ELFTCDIR}/elfcopy
7ca0fc8efSEd Maste
8ca0fc8efSEd Maste.PATH: ${ELFCOPYDIR}
9ca0fc8efSEd Maste
10ca0fc8efSEd MastePROG=	elfcopy
11ca0fc8efSEd MasteMAN=	elfcopy.1
12ca0fc8efSEd Maste
13ca0fc8efSEd Maste.if ${MK_LLVM_BINUTILS} == "no"
14ca0fc8efSEd Maste
15ca0fc8efSEd MasteLINKS+=	${BINDIR}/${PROG} ${BINDIR}/objcopy
16ca0fc8efSEd MasteLINKS+=	${BINDIR}/${PROG} ${BINDIR}/strip
17ca0fc8efSEd MasteMAN+=	objcopy.1 strip.1
18ca0fc8efSEd Maste
19ca0fc8efSEd Masteobjcopy.1: elfcopy.1
20ca0fc8efSEd Maste	sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
21ca0fc8efSEd Maste	    -e '/\.Nm elfcopy ,/d' < ${.ALLSRC} > ${.TARGET}
22ca0fc8efSEd MasteCLEANFILES+= objcopy.1
23ca0fc8efSEd Maste
24ca0fc8efSEd Maste.endif
25ca0fc8efSEd Maste
26ca0fc8efSEd MasteSRCS=	archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c
27ca0fc8efSEd Maste
28ca0fc8efSEd MasteWARNS?=	5
29ca0fc8efSEd Maste
30ca0fc8efSEd MasteLIBADD=	archive elftc elf pe
31ca0fc8efSEd Maste
32ca0fc8efSEd MasteCFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
33ca0fc8efSEd MasteCFLAGS+=-DWITH_PE=1
34ca0fc8efSEd Maste
35ca0fc8efSEd Maste
36ca0fc8efSEd Maste
37ca0fc8efSEd Maste# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
38ca0fc8efSEd Maste# We need to link against the correct version of these files. One
39ca0fc8efSEd Maste# solution is to include SRCTOP/sys in the include path. This causes
40ca0fc8efSEd Maste# problems when a header file in sys depends on a file in another
41ca0fc8efSEd Maste# part of the tree, e.g. a machine dependent header.
42ca0fc8efSEd Maste#
43ca0fc8efSEd MasteSRCS+=		sys/elf_common.h
44ca0fc8efSEd MasteCLEANDIRS=	sys
45ca0fc8efSEd MasteCFLAGS+=	-I.
46ca0fc8efSEd Mastesys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
47ca0fc8efSEd Maste	mkdir -p ${.OBJDIR}/sys
48ca0fc8efSEd Maste	ln -sf ${.ALLSRC} ${.TARGET}
49ca0fc8efSEd Maste
50ca0fc8efSEd Maste.include <bsd.prog.mk>
51