1#	$NetBSD: Makefile,v 1.4 2010/06/19 23:11:10 riz Exp $
2
3HOSTLIB=	elf
4
5.include <bsd.own.mk>
6
7SRCS=		elf_begin.c						\
8		elf_cntl.c						\
9		elf_end.c elf_errmsg.c elf_errno.c			\
10		elf_data.c						\
11		elf_fill.c elf_flag.c					\
12		elf_getarhdr.c elf_getarsym.c elf_getbase.c		\
13		    elf_getident.c					\
14		elf_hash.c						\
15		elf_kind.c						\
16		elf_memory.c						\
17		elf_next.c						\
18		elf_rand.c elf_rawfile.c				\
19		elf_phnum.c						\
20		elf_shnum.c elf_shstrndx.c elf_scn.c elf_strptr.c	\
21		elf_update.c						\
22		elf_version.c						\
23		gelf_cap.c						\
24		gelf_checksum.c						\
25		gelf_dyn.c						\
26		gelf_ehdr.c						\
27		gelf_getclass.c						\
28		gelf_fsize.c						\
29		gelf_move.c						\
30		gelf_phdr.c						\
31		gelf_rel.c gelf_rela.c					\
32		gelf_shdr.c gelf_sym.c gelf_syminfo.c gelf_symshndx.c	\
33		gelf_xlate.c						\
34		libelf.c						\
35		libelf_align.c libelf_allocate.c libelf_ar.c		\
36		libelf_checksum.c					\
37		libelf_data.c						\
38		libelf_ehdr.c libelf_extended.c				\
39		libelf_phdr.c						\
40		libelf_shdr.c						\
41		libelf_xlate.c						\
42		${LIBELF_GENSRCS}
43
44LIBELF_GENSRCS=	libelf_fsize.c libelf_msize.c libelf_convert.c
45
46LIBELF_DIR=	${.CURDIR}/../../external/bsd/libelf/dist
47
48CLEANFILES+=	${LIBELF_GENSRCS}
49CPPFLAGS+=	-I${.CURDIR}/../compat -I${LIBELF_DIR}
50CPPFLAGS+=	-I${TOOLDIR}/include/nbinclude
51
52CPPFLAGS+=	-DLIBELF_TEST_HOOKS
53
54libelf_convert.c:	elf_types.m4 libelf_convert.m4
55libelf_fsize.c:		elf_types.m4 libelf_fsize.m4
56libelf_msize.c:		elf_types.m4 libelf_msize.m4
57
58BUILD_OSTYPE!=  uname -s
59
60# Disable use of pre-compiled headers on Darwin.
61.if ${BUILD_OSTYPE} == "Darwin"
62CPPFLAGS+=	-no-cpp-precomp
63.endif
64
65# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
66# other file ops, on many systems, without changing function names.
67
68CPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
69.ifndef NOCOMPATLIB
70COMPATOBJ!=     cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
71CPPFLAGS+=	-I${COMPATOBJ}
72.endif
73
74.PATH:		${LIBELF_DIR}
75
76HOST_CPPFLAGS:=	${CPPFLAGS}
77CPPFLAGS:=	# empty
78
79.include "${.CURDIR}/../Makefile.nbincludes"
80.include <bsd.hostlib.mk>
81
82# Keep the .SUFFIXES line after the include of bsd.hostlib.mk
83M4OBJDIR!=	cd ${.CURDIR}/../m4 && ${PRINTOBJDIR}
84.SUFFIXES:	.m4 .c
85.m4.c:
86	${M4OBJDIR}/m4 -D SRCDIR=${LIBELF_DIR} ${.IMPSRC} > ${.TARGET}
87