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