xref: /freebsd/usr.bin/readelf/Makefile (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5PACKAGE=	elftoolchain
6
7ELFTCDIR=	${SRCTOP}/contrib/elftoolchain
8READELFDIR=	${ELFTCDIR}/readelf
9
10.PATH: ${READELFDIR}
11
12PROG=	readelf
13SRCS=	readelf.c
14
15LIBADD=	dwarf elftc elf z
16
17.if ${MK_CASPER} != "no"
18LIBADD+=	casper
19LIBADD+=	cap_fileargs
20CFLAGS+=	-DWITH_CASPER
21.endif
22
23CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
24
25# This same hack is in lib/libelf/Makefile and lib/libdwarf/Makefile
26# We need to link against the correct version of these files. One
27# solution is to include SRCTOP/sys in the include path. This causes
28# problems when a header file in sys depends on a file in another
29# part of the tree, e.g. a machine dependent header.
30#
31SRCS+=		sys/elf32.h sys/elf64.h sys/elf_common.h
32CLEANDIRS=	sys
33CFLAGS+=	-I.
34sys/elf32.h sys/elf64.h sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
35	mkdir -p ${.OBJDIR}/sys
36	ln -sf ${.ALLSRC} ${.TARGET}
37
38.include <bsd.prog.mk>
39