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