1# $NetBSD: Makefile,v 1.6 2025/12/24 21:03:25 jkoshy Exp $ 2 3HOSTLIB= elf 4 5.include <bsd.hostinit.mk> 6 7SRCS= elf.c \ 8 elf_begin.c \ 9 elf_cntl.c \ 10 elf_data.c \ 11 elf_end.c \ 12 elf_errmsg.c \ 13 elf_errno.c \ 14 elf_fill.c \ 15 elf_flag.c \ 16 elf_getarhdr.c \ 17 elf_getarsym.c \ 18 elf_getbase.c \ 19 elf_getident.c \ 20 elf_getversion.c \ 21 elf_hash.c \ 22 elf_kind.c \ 23 elf_memory.c \ 24 elf_next.c \ 25 elf_phnum.c \ 26 elf_rand.c \ 27 elf_rawfile.c \ 28 elf_scn.c \ 29 elf_shnum.c \ 30 elf_shstrndx.c \ 31 elf_strptr.c \ 32 elf_update.c \ 33 elf_version.c \ 34 gelf_cap.c \ 35 gelf_checksum.c \ 36 gelf_dyn.c \ 37 gelf_ehdr.c \ 38 gelf_fsize.c \ 39 gelf_getclass.c \ 40 gelf_move.c \ 41 gelf_phdr.c \ 42 gelf_rela.c \ 43 gelf_rel.c \ 44 gelf_shdr.c \ 45 gelf_sym.c \ 46 gelf_syminfo.c \ 47 gelf_symshndx.c \ 48 gelf_xlate.c \ 49 libelf_align.c \ 50 libelf_allocate.c \ 51 libelf_ar.c \ 52 libelf_ar_util.c \ 53 libelf_checksum.c \ 54 libelf_data.c \ 55 libelf_ehdr.c \ 56 libelf_elfmachine.c \ 57 libelf_extended.c \ 58 libelf_memory.c \ 59 libelf_open.c \ 60 libelf_phdr.c \ 61 libelf_shdr.c \ 62 libelf_xlate.c \ 63 ${LIBELF_GENSRCS} 64 65LIBELF_GENSRCS= libelf_fsize.c libelf_msize.c libelf_convert.c 66 67LIBELF_DIR= ${.CURDIR}/../../../external/bsd/elftoolchain/dist/libelf 68LIBELF_OBJDIR!= cd ${.CURDIR} && ${PRINTOBJDIR} 69 70CLEANFILES+= ${LIBELF_GENSRCS} 71CPPFLAGS+= -I${.CURDIR}/../../compat 72CPPFLAGS+= -I${LIBELF_DIR} -I${LIBELF_DIR}/../common 73CPPFLAGS+= -I${LIBELF_OBJDIR}/../common 74CPPFLAGS+= -I${TOOLDIR}/include 75 76CPPFLAGS+= -DLIBELF_TEST_HOOKS 77 78libelf_convert.c: elf_types.m4 libelf_convert.m4 79libelf_fsize.c: elf_types.m4 libelf_fsize.m4 80libelf_msize.c: elf_types.m4 libelf_msize.m4 81 82BUILD_OSTYPE!= uname -s 83 84# Disable use of pre-compiled headers on Darwin. 85.if ${BUILD_OSTYPE} == "Darwin" 86CPPFLAGS+= -no-cpp-precomp 87.endif 88 89# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and 90# other file ops, on many systems, without changing function names. 91 92CPPFLAGS+= -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 93.ifndef NOCOMPATLIB 94COMPATLIB_NO_LIB= yes # only the include files, not the library 95.-include "${TOOLDIR}/share/compat/defs.mk" 96.endif 97 98.PATH: ${LIBELF_DIR} 99 100HOST_CPPFLAGS:= ${CPPFLAGS} ${HOST_CPPFLAGS} 101CPPFLAGS:= # empty 102 103.include <bsd.hostlib.mk> 104 105# Keep the .SUFFIXES line after the include of bsd.hostlib.mk 106M4OBJDIR!= cd ${.CURDIR}/../../m4 && ${PRINTOBJDIR} 107.SUFFIXES: .m4 .c 108.m4.c: 109 ${M4OBJDIR}/m4 -D SRCDIR=${LIBELF_DIR} -I${LIBELF_DIR} \ 110 ${.IMPSRC} > ${.TARGET} 111