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