11.3Sriastrad#	$NetBSD: Makefile,v 1.3 2024/04/01 18:33:24 riastradh Exp $
21.1Sjkoshy
31.1SjkoshyHOSTLIB=	elf
41.1Sjkoshy
51.1Sjkoshy.include <bsd.hostinit.mk>
61.1Sjkoshy
71.1SjkoshySRCS=		elf_begin.c						\
81.1Sjkoshy		elf_cntl.c						\
91.1Sjkoshy		elf_end.c elf_errmsg.c elf_errno.c			\
101.1Sjkoshy		elf_data.c						\
111.1Sjkoshy		elf_fill.c elf_flag.c					\
121.1Sjkoshy		elf_getarhdr.c elf_getarsym.c elf_getbase.c		\
131.1Sjkoshy		    elf_getident.c					\
141.1Sjkoshy		elf_hash.c						\
151.1Sjkoshy		elf_kind.c						\
161.1Sjkoshy		elf_memory.c						\
171.1Sjkoshy		elf_next.c						\
181.1Sjkoshy		elf_rand.c elf_rawfile.c				\
191.1Sjkoshy		elf_phnum.c						\
201.1Sjkoshy		elf_shnum.c elf_shstrndx.c elf_scn.c elf_strptr.c	\
211.1Sjkoshy		elf_update.c						\
221.1Sjkoshy		elf_version.c						\
231.1Sjkoshy		gelf_cap.c						\
241.1Sjkoshy		gelf_checksum.c						\
251.1Sjkoshy		gelf_dyn.c						\
261.1Sjkoshy		gelf_ehdr.c						\
271.1Sjkoshy		gelf_getclass.c						\
281.1Sjkoshy		gelf_fsize.c						\
291.1Sjkoshy		gelf_move.c						\
301.1Sjkoshy		gelf_phdr.c						\
311.1Sjkoshy		gelf_rel.c gelf_rela.c					\
321.1Sjkoshy		gelf_shdr.c gelf_sym.c gelf_syminfo.c gelf_symshndx.c	\
331.1Sjkoshy		gelf_xlate.c						\
341.1Sjkoshy		elf.c							\
351.1Sjkoshy		libelf_align.c libelf_allocate.c libelf_ar.c		\
361.1Sjkoshy		libelf_ar_util.c					\
371.1Sjkoshy		libelf_checksum.c					\
381.1Sjkoshy		libelf_data.c						\
391.1Sjkoshy		libelf_ehdr.c libelf_extended.c				\
401.2Schristos		libelf_elfmachine.c 					\
411.1Sjkoshy		libelf_memory.c						\
421.1Sjkoshy		libelf_open.c						\
431.1Sjkoshy		libelf_phdr.c						\
441.1Sjkoshy		libelf_shdr.c						\
451.1Sjkoshy		libelf_xlate.c						\
461.1Sjkoshy		${LIBELF_GENSRCS}
471.1Sjkoshy
481.1SjkoshyLIBELF_GENSRCS=	libelf_fsize.c libelf_msize.c libelf_convert.c
491.1Sjkoshy
501.1SjkoshyLIBELF_DIR=	${.CURDIR}/../../../external/bsd/elftoolchain/dist/libelf
511.1SjkoshyLIBELF_OBJDIR!=	cd ${.CURDIR} && ${PRINTOBJDIR}
521.1Sjkoshy
531.1SjkoshyCLEANFILES+=	${LIBELF_GENSRCS}
541.1SjkoshyCPPFLAGS+=	-I${.CURDIR}/../../compat
551.1SjkoshyCPPFLAGS+=	-I${LIBELF_DIR} -I${LIBELF_DIR}/../common
561.1SjkoshyCPPFLAGS+=	-I${LIBELF_OBJDIR}/../common
571.3SriastradCPPFLAGS+=	-I${TOOLDIR}/include
581.1Sjkoshy
591.1SjkoshyCPPFLAGS+=	-DLIBELF_TEST_HOOKS
601.1Sjkoshy
611.1Sjkoshylibelf_convert.c:	elf_types.m4 libelf_convert.m4
621.1Sjkoshylibelf_fsize.c:		elf_types.m4 libelf_fsize.m4
631.1Sjkoshylibelf_msize.c:		elf_types.m4 libelf_msize.m4
641.1Sjkoshy
651.1SjkoshyBUILD_OSTYPE!=  uname -s
661.1Sjkoshy
671.1Sjkoshy# Disable use of pre-compiled headers on Darwin.
681.1Sjkoshy.if ${BUILD_OSTYPE} == "Darwin"
691.1SjkoshyCPPFLAGS+=	-no-cpp-precomp
701.1Sjkoshy.endif
711.1Sjkoshy
721.1Sjkoshy# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
731.1Sjkoshy# other file ops, on many systems, without changing function names.
741.1Sjkoshy
751.1SjkoshyCPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
761.1Sjkoshy.ifndef NOCOMPATLIB
771.1SjkoshyCOMPATLIB_NO_LIB= yes # only the include files, not the library
781.1Sjkoshy.-include	"${TOOLDIR}/share/compat/defs.mk"
791.1Sjkoshy.endif
801.1Sjkoshy
811.1Sjkoshy.PATH:		${LIBELF_DIR}
821.1Sjkoshy
831.1SjkoshyHOST_CPPFLAGS:=	${CPPFLAGS} ${HOST_CPPFLAGS}
841.1SjkoshyCPPFLAGS:=	# empty
851.1Sjkoshy
861.1Sjkoshy.include <bsd.hostlib.mk>
871.1Sjkoshy
881.1Sjkoshy# Keep the .SUFFIXES line after the include of bsd.hostlib.mk
891.1SjkoshyM4OBJDIR!=	cd ${.CURDIR}/../../m4 && ${PRINTOBJDIR}
901.1Sjkoshy.SUFFIXES:	.m4 .c
911.1Sjkoshy.m4.c:
921.1Sjkoshy	${M4OBJDIR}/m4 -D SRCDIR=${LIBELF_DIR} ${.IMPSRC} > ${.TARGET}
93