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