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