summaryrefslogtreecommitdiffstats
path: root/usr.bin/elfcopy/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/elfcopy/Makefile')
-rw-r--r--usr.bin/elfcopy/Makefile46
1 files changed, 46 insertions, 0 deletions
diff --git a/usr.bin/elfcopy/Makefile b/usr.bin/elfcopy/Makefile
new file mode 100644
index 0000000..3ffc0d5
--- /dev/null
+++ b/usr.bin/elfcopy/Makefile
@@ -0,0 +1,46 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+ELFCOPYDIR= ${ELFTCDIR}/elfcopy
+
+.PATH: ${ELFCOPYDIR}
+
+.if ${MK_ELFCOPY_AS_OBJCOPY} != "no"
+PROG= objcopy
+objcopy.1: elfcopy.1
+ sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
+ -e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET}
+CLEANFILES+= objcopy.1
+.else
+PROG= elfcopy
+.endif
+
+SRCS= archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c
+
+WARNS?= 5
+
+LIBADD= archive elftc elf pe
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
+CFLAGS+=-DWITH_PE=1
+
+MAN= ${PROG}.1 strip.1
+
+LINKS= ${BINDIR}/${PROG} ${BINDIR}/strip
+
+# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
+# We need to link against the correct version of these files. One
+# solution is to include ../../sys in the include path. This causes
+# problems when a header file in sys depends on a file in another
+# part of the tree, e.g. a machine dependent header.
+#
+SRCS+= sys/elf_common.h
+CLEANDIRS= sys
+CFLAGS+= -I.
+sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
+ mkdir -p ${.OBJDIR}/sys
+ ln -sf ${.ALLSRC} ${.TARGET}
+
+.include <bsd.prog.mk>
OpenPOWER on IntegriCloud