1# $Id: Makefile 3608 2018-04-14 21:23:04Z jkoshy $ 2 3TOP= .. 4 5.include "${TOP}/mk/elftoolchain.components.mk" 6 7PROG= elfcopy 8 9SRCS= archive.c ascii.c binary.c main.c sections.c segments.c \ 10 symbols.c 11 12WARNS?= 5 13 14DPADD= ${LIBELF} ${LIBELFTC} 15LDADD= -lelf -lelftc 16 17.if !defined(LIBELF_AR) 18LDADD+= -larchive 19.endif 20 21.if defined(WITH_PE) && ${WITH_PE} == "yes" 22SRCS+= pe.c 23CFLAGS+= -DWITH_PE=1 24 25DPADD+= ${LIBPE} 26LDADD+= -lpe 27.endif 28 29MAN= elfcopy.1 mcs.1 strip.1 30MLINKS= elfcopy.1 objcopy.1 31 32NO_SHARED?= yes 33 34LINKS= ${BINDIR}/elfcopy ${BINDIR}/mcs \ 35 ${BINDIR}/elfcopy ${BINDIR}/objcopy \ 36 ${BINDIR}/elfcopy ${BINDIR}/strip 37 38EXTRA_TARGETS= mcs strip objcopy 39 40CLEANFILES+= ${EXTRA_TARGETS} 41 42# Create in-place symbolic links to "elfcopy" at build time. 43 44all: ${EXTRA_TARGETS} 45 46${EXTRA_TARGETS}: ${PROG} 47 ln -s ${PROG} ${.TARGET} 48 49.include "${TOP}/mk/elftoolchain.prog.mk" 50 51.if ${OS_HOST} == "OpenBSD" 52CFLAGS+= -I/usr/local/include 53LDFLAGS+= -L/usr/local/lib 54.elif ${OS_HOST} == "DragonFly" 55LDADD+= -lbz2 56.endif 57