Home | History | Annotate | Line # | Download | only in liblto_plugin
      1 #	$NetBSD: Makefile,v 1.14 2025/09/19 22:53:02 mrg Exp $
      2 
      3 .include <bsd.init.mk>
      4 .include <bsd.shlib.mk>
      5 
      6 LIB=		liblto_plugin
      7 
      8 DIST=		${GCCDIST}
      9 GNUHOSTDIST=	${DIST}
     10 
     11 SRCS=		lto-plugin.c hashtab.c simple-object.c pex-unix.c \
     12 		pex-common.c argv.c make-temp-file.c concat.c \
     13 		simple-object-elf.c simple-object-mach-o.c \
     14 		simple-object-coff.c simple-object-xcoff.c \
     15 
     16 # libiberty
     17 SRCS+=		xstrerror.c xasprintf.c xvasprintf.c safe-ctype.c \
     18 		vprintf-support.c unlink-if-ordinary.c
     19 
     20 CPPFLAGS+=	-I${DIST}/include -I. 
     21 CPPFLAGS+=	-DHAVE_CONFIG_H
     22 CPPFLAGS+=	-Dxstrdup=strdup -Dxexit=exit
     23 CPPFLAGS+=	-Dxcalloc=calloc -Dxmalloc=malloc -Dxrealloc=realloc
     24 
     25 LIBISMODULE=	yes
     26 USE_SHLIBDIR=	yes
     27 REQUIRETOOLS=	yes
     28 NOLINT=		# defined
     29 
     30 # make this /usr/lib/gcc?
     31 LIBDIR=		/usr/libexec
     32 
     33 .if ${MKGCC} != "no"
     34 
     35 SHLIB_MAJOR=	0
     36 SHLIB_MINOR=	1
     37 
     38 # Yuck, we have to run configure to generate this one...
     39 CLEANFILES+=	config.h
     40 HOST_CFLAGS+= -I${.OBJDIR}
     41 DPSRCS+=	config.h
     42 config.h: Makefile
     43 	${_MKTARGET_CREATE}
     44 	rm -rf .ab && \
     45 	mkdir .ab && \
     46 	(cd .ab && \
     47 		AWK=${TOOL_AWK:Q} \
     48 		CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} \
     49 		CPPFLAGS=${HOST_CPPFLAGS:Q} \
     50 		MAKE=${MAKE:Q} \
     51 		CONFIG_SHELL=${HOST_SH:Q} \
     52 		${HOST_SH} ${DIST}/libiberty/configure \
     53 			--build=`${HOST_SH} ${GNUHOSTDIST}/config.guess` \
     54 			--host=`${HOST_SH} ${GNUHOSTDIST}/config.guess` \
     55 			--target=${MACHINE_GNU_PLATFORM} && \
     56 		mv ${.TARGET} ../${.TARGET}) && \
     57 	rm -rf .ab
     58 
     59 # Fetch ${G_version}
     60 GCCARCH=	${.CURDIR}/../../usr.bin/gcc/arch/${MACHINE_ARCH:S/earmv5/earm/}
     61 .include "${GCCARCH}/defs.mk"
     62 
     63 CPPFLAGS+=	-DBASE_VERSION=\"${G_version}\"
     64 
     65 .include <bsd.lib.mk>
     66 
     67 .PATH:	${DIST}/lto-plugin ${DIST}/libiberty
     68 COPTS.lto-plugin.c+= -Wno-missing-prototypes
     69 
     70 .else
     71 .include <bsd.prog.mk> # do nothing
     72 .endif
     73