Makefile revision 1.7
11.7Sjkoshy#	$NetBSD: Makefile,v 1.7 2025/12/31 20:56:07 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.6Sjkoshy		elf_getversion.c					\
211.1Sjkoshy		elf_hash.c						\
221.1Sjkoshy		elf_kind.c						\
231.1Sjkoshy		elf_memory.c						\
241.1Sjkoshy		elf_next.c						\
251.1Sjkoshy		elf_phnum.c						\
261.5Sjkoshy		elf_rand.c						\
271.5Sjkoshy		elf_rawfile.c						\
281.5Sjkoshy		elf_scn.c						\
291.5Sjkoshy		elf_shnum.c						\
301.5Sjkoshy		elf_shstrndx.c						\
311.5Sjkoshy		elf_strptr.c						\
321.1Sjkoshy		elf_update.c						\
331.1Sjkoshy		elf_version.c						\
341.1Sjkoshy		gelf_cap.c						\
351.1Sjkoshy		gelf_checksum.c						\
361.1Sjkoshy		gelf_dyn.c						\
371.1Sjkoshy		gelf_ehdr.c						\
381.5Sjkoshy		gelf_fsize.c						\
391.1Sjkoshy		gelf_getclass.c						\
401.1Sjkoshy		gelf_move.c						\
411.1Sjkoshy		gelf_phdr.c						\
421.5Sjkoshy		gelf_rela.c						\
431.5Sjkoshy		gelf_rel.c						\
441.5Sjkoshy		gelf_shdr.c						\
451.5Sjkoshy		gelf_sym.c						\
461.5Sjkoshy		gelf_syminfo.c						\
471.5Sjkoshy		gelf_symshndx.c						\
481.1Sjkoshy		gelf_xlate.c						\
491.5Sjkoshy		libelf_align.c						\
501.5Sjkoshy		libelf_allocate.c					\
511.5Sjkoshy		libelf_ar.c						\
521.1Sjkoshy		libelf_ar_util.c					\
531.1Sjkoshy		libelf_checksum.c					\
541.1Sjkoshy		libelf_data.c						\
551.5Sjkoshy		libelf_ehdr.c						\
561.2Schristos		libelf_elfmachine.c 					\
571.5Sjkoshy		libelf_extended.c					\
581.1Sjkoshy		libelf_memory.c						\
591.1Sjkoshy		libelf_open.c						\
601.1Sjkoshy		libelf_phdr.c						\
611.1Sjkoshy		libelf_shdr.c						\
621.1Sjkoshy		libelf_xlate.c						\
631.1Sjkoshy		${LIBELF_GENSRCS}
641.1Sjkoshy
651.1SjkoshyLIBELF_GENSRCS=	libelf_fsize.c libelf_msize.c libelf_convert.c
661.1Sjkoshy
671.1SjkoshyLIBELF_DIR=	${.CURDIR}/../../../external/bsd/elftoolchain/dist/libelf
681.1SjkoshyLIBELF_OBJDIR!=	cd ${.CURDIR} && ${PRINTOBJDIR}
691.1Sjkoshy
701.1SjkoshyCLEANFILES+=	${LIBELF_GENSRCS}
711.1SjkoshyCPPFLAGS+=	-I${.CURDIR}/../../compat
721.1SjkoshyCPPFLAGS+=	-I${LIBELF_DIR} -I${LIBELF_DIR}/../common
731.1SjkoshyCPPFLAGS+=	-I${LIBELF_OBJDIR}/../common
741.3SriastradCPPFLAGS+=	-I${TOOLDIR}/include
751.1Sjkoshy
761.1SjkoshyCPPFLAGS+=	-DLIBELF_TEST_HOOKS
771.1Sjkoshy
781.1Sjkoshylibelf_convert.c:	elf_types.m4 libelf_convert.m4
791.1Sjkoshylibelf_fsize.c:		elf_types.m4 libelf_fsize.m4
801.1Sjkoshylibelf_msize.c:		elf_types.m4 libelf_msize.m4
811.1Sjkoshy
821.1SjkoshyBUILD_OSTYPE!=  uname -s
831.1Sjkoshy
841.1Sjkoshy# Disable use of pre-compiled headers on Darwin.
851.1Sjkoshy.if ${BUILD_OSTYPE} == "Darwin"
861.1SjkoshyCPPFLAGS+=	-no-cpp-precomp
871.1Sjkoshy.endif
881.1Sjkoshy
891.1Sjkoshy# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
901.1Sjkoshy# other file ops, on many systems, without changing function names.
911.1Sjkoshy
921.1SjkoshyCPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
931.1Sjkoshy.ifndef NOCOMPATLIB
941.1SjkoshyCOMPATLIB_NO_LIB= yes # only the include files, not the library
951.1Sjkoshy.-include	"${TOOLDIR}/share/compat/defs.mk"
961.1Sjkoshy.endif
971.1Sjkoshy
981.1Sjkoshy.PATH:		${LIBELF_DIR}
991.1Sjkoshy
1001.1SjkoshyHOST_CPPFLAGS:=	${CPPFLAGS} ${HOST_CPPFLAGS}
1011.1SjkoshyCPPFLAGS:=	# empty
1021.1Sjkoshy
1031.1Sjkoshy.include <bsd.hostlib.mk>
1041.1Sjkoshy
1051.1Sjkoshy# Keep the .SUFFIXES line after the include of bsd.hostlib.mk
1061.1SjkoshyM4OBJDIR!=	cd ${.CURDIR}/../../m4 && ${PRINTOBJDIR}
1071.1Sjkoshy.SUFFIXES:	.m4 .c
1081.1Sjkoshy.m4.c:
1091.7Sjkoshy	${M4OBJDIR}/m4 -I${LIBELF_DIR} ${.IMPSRC} > ${.TARGET}
110