1# $NetBSD: Makefile,v 1.10 2023/02/20 02:11:57 mrg Exp $ 2 3REQUIRETOOLS= yes 4NOLINT= # defined 5UNSUPPORTED_COMPILER.clang= # defined 6 7.include <bsd.init.mk> 8 9# If using an external toolchain, we expect crtbegin/crtend to be 10# supplied by that toolchain's run-time support. 11.if !defined(EXTERNAL_TOOLCHAIN) && ${MKGCC} != "no" 12 13DIST= ${GCCDIST} 14GNUHOSTDIST= ${DIST} 15GCCARCH= ${.CURDIR}/../../usr.bin/gcc/arch/${MACHINE_ARCH} 16 17GALLCFLAGS= ${G_CRTSTUFF_CFLAGS} ${G_CRTSTUFF_T_CFLAGS} 18 19CPPFLAGS+= -I${GCCARCH} ${GALLCFLAGS:M-D*} ${GALLCFLAGS:M-I*:N-I.*} 20CPPFLAGS+= -I. -I${DIST}/libgcc -I${DIST}/gcc -I${DIST}/include 21CPPFLAGS+= -DIN_GCC 22COPTS+= -finhibit-size-directive \ 23 -fno-inline \ 24 -fno-exceptions \ 25 -fno-zero-initialized-in-bss \ 26 -fno-toplevel-reorder \ 27 -fno-tree-vectorize \ 28 -fno-omit-frame-pointer \ 29 -fno-asynchronous-unwind-tables 30 31GCFLAGS= ${GALLCFLAGS:N-D*:N-I*:N-i*:N./*} 32 33DPSRCS+= ${.CURDIR}/arch/${MACHINE_ARCH}.mk tconfig.h 34 35.include "${.CURDIR}/arch/${MACHINE_ARCH}.mk" 36 37SRCS+= crtbegin.c crtend.c 38OBJS+= crtbegin.o crtend.o 39.if ${MKPIC} != "no" 40SRCS+= crtbeginS.c crtendS.c 41OBJS+= crtbeginS.o crtendS.o # for shared libraries 42CPPFLAGS.crtbeginS.o+= -fPIC -DPIC 43CPPFLAGS.crtendS.o+= -fPIC -DPIC 44SRCS+= crtbeginT.c 45OBJS+= crtbeginT.o # for -static links 46.endif 47 48realall: ${OBJS} 49 50FILES=${OBJS} 51FILESDIR=${LIBDIR} 52 53.PATH: ${DIST}/libgcc ${DIST}/libgcc/config 54 55.include "../Makefile.tconfigh" 56EXTRA_FAKEHEADERS= options.h libgcc_tm.h 57.include "../Makefile.hacks" 58 59${OBJS}: ${DPSRCS} 60 61.include <bsd.prog.mk> 62 63# Override the default .c -> .o rule. 64.c.o: 65 ${_MKTARGET_COMPILE} 66 ${CC} ${CPPFLAGS} ${CPPFLAGS.${.TARGET}} ${GCFLAGS} ${COPTS} ${COPTS.${.TARGET}} ${CPUFLAGS} -c ${.IMPSRC} -o ${.TARGET}.o 67 mv ${.TARGET}.o ${.TARGET} 68 69.if ${MACHINE_MIPS64} 70# Turn off as(1) warnings on MIPS, since warnings are fatal with WARNS>0 71# and GCC configury passes -finhibit-size-directive which causes mips-gas 72# to barf. Don't know what the real fix for this is... 73# 74# XXX should be COPTS, but that's too early 75CPUFLAGS+=-Wa,--no-warn 76.endif 77 78.else 79 80.include <bsd.prog.mk> # do nothing 81 82.endif # ! EXTERNAL_TOOLCHAIN && MKGCC != no 83