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