1275373Semaste# $FreeBSD: stable/11/usr.bin/elfcopy/Makefile 319186 2017-05-30 04:27:05Z ngie $
2275373Semaste
3275373Semaste.include <src.opts.mk>
4275373Semaste
5298401SemasteELFTCDIR=	${SRCTOP}/contrib/elftoolchain
6275373SemasteELFCOPYDIR=	${ELFTCDIR}/elfcopy
7275373Semaste
8275373Semaste.PATH: ${ELFCOPYDIR}
9275373Semaste
10286030Semaste.if ${MK_ELFCOPY_AS_OBJCOPY} != "no"
11286030SemastePROG=	objcopy
12286030Semasteobjcopy.1: elfcopy.1
13286030Semaste	sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
14286030Semaste	    -e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET}
15286030SemasteCLEANFILES+= objcopy.1
16286030Semaste.else
17275373SemastePROG=	elfcopy
18286030Semaste.endif
19275373Semaste
20295582SemasteSRCS=	archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c
21275373Semaste
22275373SemasteWARNS?=	5
23275373Semaste
24295582SemasteLIBADD=	archive elftc elf pe
25275373Semaste
26295582SemasteCFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
27295582SemasteCFLAGS+=-DWITH_PE=1
28275373Semaste
29286030SemasteMAN=	${PROG}.1 strip.1
30275373Semaste
31286030SemasteLINKS=	${BINDIR}/${PROG} ${BINDIR}/strip
32275373Semaste
33301476Sbdrewery# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
34301476Sbdrewery# We need to link against the correct version of these files. One
35319186Sngie# solution is to include SRCTOP/sys in the include path. This causes
36301476Sbdrewery# problems when a header file in sys depends on a file in another
37301476Sbdrewery# part of the tree, e.g. a machine dependent header.
38301476Sbdrewery#
39301476SbdrewerySRCS+=		sys/elf_common.h
40301476SbdreweryCLEANDIRS=	sys
41301476SbdreweryCFLAGS+=	-I.
42301476Sbdrewerysys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
43301476Sbdrewery	mkdir -p ${.OBJDIR}/sys
44301476Sbdrewery	ln -sf ${.ALLSRC} ${.TARGET}
45301476Sbdrewery
46275373Semaste.include <bsd.prog.mk>
47