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