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