1# $FreeBSD: stable/11/usr.bin/elfcopy/Makefile 319186 2017-05-30 04:27:05Z ngie $
2
3.include <src.opts.mk>
4
5ELFTCDIR=	${SRCTOP}/contrib/elftoolchain
6ELFCOPYDIR=	${ELFTCDIR}/elfcopy
7
8.PATH: ${ELFCOPYDIR}
9
10.if ${MK_ELFCOPY_AS_OBJCOPY} != "no"
11PROG=	objcopy
12objcopy.1: elfcopy.1
13	sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
14	    -e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET}
15CLEANFILES+= objcopy.1
16.else
17PROG=	elfcopy
18.endif
19
20SRCS=	archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c
21
22WARNS?=	5
23
24LIBADD=	archive elftc elf pe
25
26CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
27CFLAGS+=-DWITH_PE=1
28
29MAN=	${PROG}.1 strip.1
30
31LINKS=	${BINDIR}/${PROG} ${BINDIR}/strip
32
33# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
34# We need to link against the correct version of these files. One
35# solution is to include SRCTOP/sys in the include path. This causes
36# problems when a header file in sys depends on a file in another
37# part of the tree, e.g. a machine dependent header.
38#
39SRCS+=		sys/elf_common.h
40CLEANDIRS=	sys
41CFLAGS+=	-I.
42sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
43	mkdir -p ${.OBJDIR}/sys
44	ln -sf ${.ALLSRC} ${.TARGET}
45
46.include <bsd.prog.mk>
47