1# $NetBSD: Makefile,v 1.3 2024/04/01 18:33:24 riastradh Exp $ 2 3HOSTLIB= elf 4 5.include <bsd.hostinit.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 elf.c \ 35 libelf_align.c libelf_allocate.c libelf_ar.c \ 36 libelf_ar_util.c \ 37 libelf_checksum.c \ 38 libelf_data.c \ 39 libelf_ehdr.c libelf_extended.c \ 40 libelf_elfmachine.c \ 41 libelf_memory.c \ 42 libelf_open.c \ 43 libelf_phdr.c \ 44 libelf_shdr.c \ 45 libelf_xlate.c \ 46 ${LIBELF_GENSRCS} 47 48LIBELF_GENSRCS= libelf_fsize.c libelf_msize.c libelf_convert.c 49 50LIBELF_DIR= ${.CURDIR}/../../../external/bsd/elftoolchain/dist/libelf 51LIBELF_OBJDIR!= cd ${.CURDIR} && ${PRINTOBJDIR} 52 53CLEANFILES+= ${LIBELF_GENSRCS} 54CPPFLAGS+= -I${.CURDIR}/../../compat 55CPPFLAGS+= -I${LIBELF_DIR} -I${LIBELF_DIR}/../common 56CPPFLAGS+= -I${LIBELF_OBJDIR}/../common 57CPPFLAGS+= -I${TOOLDIR}/include 58 59CPPFLAGS+= -DLIBELF_TEST_HOOKS 60 61libelf_convert.c: elf_types.m4 libelf_convert.m4 62libelf_fsize.c: elf_types.m4 libelf_fsize.m4 63libelf_msize.c: elf_types.m4 libelf_msize.m4 64 65BUILD_OSTYPE!= uname -s 66 67# Disable use of pre-compiled headers on Darwin. 68.if ${BUILD_OSTYPE} == "Darwin" 69CPPFLAGS+= -no-cpp-precomp 70.endif 71 72# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and 73# other file ops, on many systems, without changing function names. 74 75CPPFLAGS+= -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 76.ifndef NOCOMPATLIB 77COMPATLIB_NO_LIB= yes # only the include files, not the library 78.-include "${TOOLDIR}/share/compat/defs.mk" 79.endif 80 81.PATH: ${LIBELF_DIR} 82 83HOST_CPPFLAGS:= ${CPPFLAGS} ${HOST_CPPFLAGS} 84CPPFLAGS:= # empty 85 86.include <bsd.hostlib.mk> 87 88# Keep the .SUFFIXES line after the include of bsd.hostlib.mk 89M4OBJDIR!= cd ${.CURDIR}/../../m4 && ${PRINTOBJDIR} 90.SUFFIXES: .m4 .c 91.m4.c: 92 ${M4OBJDIR}/m4 -D SRCDIR=${LIBELF_DIR} ${.IMPSRC} > ${.TARGET} 93