Makefile revision 1.5
11.5Sjkoshy#	$NetBSD: Makefile,v 1.5 2025/12/24 15:34:16 jkoshy Exp $
21.1Sjkoshy
31.1SjkoshyHOSTLIB=	elf
41.1Sjkoshy
51.1Sjkoshy.include <bsd.hostinit.mk>
61.1Sjkoshy
71.5SjkoshySRCS=		elf.c							\
81.5Sjkoshy		elf_begin.c						\
91.1Sjkoshy		elf_cntl.c						\
101.1Sjkoshy		elf_data.c						\
111.5Sjkoshy		elf_end.c						\
121.5Sjkoshy		elf_errmsg.c						\
131.5Sjkoshy		elf_errno.c						\
141.5Sjkoshy		elf_fill.c						\
151.5Sjkoshy		elf_flag.c						\
161.5Sjkoshy		elf_getarhdr.c						\
171.5Sjkoshy		elf_getarsym.c						\
181.5Sjkoshy		elf_getbase.c						\
191.5Sjkoshy		elf_getident.c						\
201.1Sjkoshy		elf_hash.c						\
211.1Sjkoshy		elf_kind.c						\
221.1Sjkoshy		elf_memory.c						\
231.1Sjkoshy		elf_next.c						\
241.1Sjkoshy		elf_phnum.c						\
251.5Sjkoshy		elf_rand.c						\
261.5Sjkoshy		elf_rawfile.c						\
271.5Sjkoshy		elf_scn.c						\
281.5Sjkoshy		elf_shnum.c						\
291.5Sjkoshy		elf_shstrndx.c						\
301.5Sjkoshy		elf_strptr.c						\
311.1Sjkoshy		elf_update.c						\
321.1Sjkoshy		elf_version.c						\
331.1Sjkoshy		gelf_cap.c						\
341.1Sjkoshy		gelf_checksum.c						\
351.1Sjkoshy		gelf_dyn.c						\
361.1Sjkoshy		gelf_ehdr.c						\
371.5Sjkoshy		gelf_fsize.c						\
381.1Sjkoshy		gelf_getclass.c						\
391.1Sjkoshy		gelf_move.c						\
401.1Sjkoshy		gelf_phdr.c						\
411.5Sjkoshy		gelf_rela.c						\
421.5Sjkoshy		gelf_rel.c						\
431.5Sjkoshy		gelf_shdr.c						\
441.5Sjkoshy		gelf_sym.c						\
451.5Sjkoshy		gelf_syminfo.c						\
461.5Sjkoshy		gelf_symshndx.c						\
471.1Sjkoshy		gelf_xlate.c						\
481.5Sjkoshy		libelf_align.c						\
491.5Sjkoshy		libelf_allocate.c					\
501.5Sjkoshy		libelf_ar.c						\
511.1Sjkoshy		libelf_ar_util.c					\
521.1Sjkoshy		libelf_checksum.c					\
531.1Sjkoshy		libelf_data.c						\
541.5Sjkoshy		libelf_ehdr.c						\
551.2Schristos		libelf_elfmachine.c 					\
561.5Sjkoshy		libelf_extended.c					\
571.1Sjkoshy		libelf_memory.c						\
581.1Sjkoshy		libelf_open.c						\
591.1Sjkoshy		libelf_phdr.c						\
601.1Sjkoshy		libelf_shdr.c						\
611.1Sjkoshy		libelf_xlate.c						\
621.1Sjkoshy		${LIBELF_GENSRCS}
631.1Sjkoshy
641.1SjkoshyLIBELF_GENSRCS=	libelf_fsize.c libelf_msize.c libelf_convert.c
651.1Sjkoshy
661.1SjkoshyLIBELF_DIR=	${.CURDIR}/../../../external/bsd/elftoolchain/dist/libelf
671.1SjkoshyLIBELF_OBJDIR!=	cd ${.CURDIR} && ${PRINTOBJDIR}
681.1Sjkoshy
691.1SjkoshyCLEANFILES+=	${LIBELF_GENSRCS}
701.1SjkoshyCPPFLAGS+=	-I${.CURDIR}/../../compat
711.1SjkoshyCPPFLAGS+=	-I${LIBELF_DIR} -I${LIBELF_DIR}/../common
721.1SjkoshyCPPFLAGS+=	-I${LIBELF_OBJDIR}/../common
731.3SriastradCPPFLAGS+=	-I${TOOLDIR}/include
741.1Sjkoshy
751.1SjkoshyCPPFLAGS+=	-DLIBELF_TEST_HOOKS
761.1Sjkoshy
771.1Sjkoshylibelf_convert.c:	elf_types.m4 libelf_convert.m4
781.1Sjkoshylibelf_fsize.c:		elf_types.m4 libelf_fsize.m4
791.1Sjkoshylibelf_msize.c:		elf_types.m4 libelf_msize.m4
801.1Sjkoshy
811.1SjkoshyBUILD_OSTYPE!=  uname -s
821.1Sjkoshy
831.1Sjkoshy# Disable use of pre-compiled headers on Darwin.
841.1Sjkoshy.if ${BUILD_OSTYPE} == "Darwin"
851.1SjkoshyCPPFLAGS+=	-no-cpp-precomp
861.1Sjkoshy.endif
871.1Sjkoshy
881.1Sjkoshy# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
891.1Sjkoshy# other file ops, on many systems, without changing function names.
901.1Sjkoshy
911.1SjkoshyCPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
921.1Sjkoshy.ifndef NOCOMPATLIB
931.1SjkoshyCOMPATLIB_NO_LIB= yes # only the include files, not the library
941.1Sjkoshy.-include	"${TOOLDIR}/share/compat/defs.mk"
951.1Sjkoshy.endif
961.1Sjkoshy
971.1Sjkoshy.PATH:		${LIBELF_DIR}
981.1Sjkoshy
991.1SjkoshyHOST_CPPFLAGS:=	${CPPFLAGS} ${HOST_CPPFLAGS}
1001.1SjkoshyCPPFLAGS:=	# empty
1011.1Sjkoshy
1021.1Sjkoshy.include <bsd.hostlib.mk>
1031.1Sjkoshy
1041.1Sjkoshy# Keep the .SUFFIXES line after the include of bsd.hostlib.mk
1051.1SjkoshyM4OBJDIR!=	cd ${.CURDIR}/../../m4 && ${PRINTOBJDIR}
1061.1Sjkoshy.SUFFIXES:	.m4 .c
1071.1Sjkoshy.m4.c:
1081.4Sjkoshy	${M4OBJDIR}/m4 -D SRCDIR=${LIBELF_DIR} -I${LIBELF_DIR} \
1091.4Sjkoshy		${.IMPSRC} > ${.TARGET}
110