1 # $NetBSD: Makefile,v 1.15 2021/04/25 23:12:54 christos Exp $ 2 3 REQUIRETOOLS= yes 4 NOLINT= # defined 5 UNSUPPORTED_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 13 DIST= ${GCCDIST} 14 GNUHOSTDIST= ${DIST} 15 GCCARCH= ${.CURDIR}/../../usr.bin/gcc/arch/${MACHINE_ARCH} 16 17 GALLCFLAGS= ${G_CRTSTUFF_CFLAGS} ${G_CRTSTUFF_T_CFLAGS} 18 19 CPPFLAGS+= -I${GCCARCH} ${GALLCFLAGS:M-D*} ${GALLCFLAGS:M-I*:N-I.*} 20 CPPFLAGS+= -I. -I${DIST}/libgcc -I${DIST}/gcc -I${DIST}/include 21 CPPFLAGS+= -DIN_GCC 22 COPTS+= -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 31 GCFLAGS= ${GALLCFLAGS:N-D*:N-I*:N-i*:N./*} 32 33 DPSRCS+= ${.CURDIR}/arch/${MACHINE_ARCH}.mk tconfig.h 34 35 .include "${.CURDIR}/arch/${MACHINE_ARCH}.mk" 36 37 SRCS+= crtbegin.c crtend.c 38 OBJS+= crtbegin.o crtend.o 39 .if ${MKPIC} != "no" 40 SRCS+= crtbeginS.c crtendS.c 41 OBJS+= crtbeginS.o crtendS.o # for shared libraries 42 CPPFLAGS.crtbeginS.o+= -fPIC -DPIC 43 CPPFLAGS.crtendS.o+= -fPIC -DPIC 44 SRCS+= crtbeginT.c 45 OBJS+= crtbeginT.o # for -static links 46 .endif 47 48 realall: ${OBJS} 49 50 FILES=${OBJS} 51 FILESDIR=${LIBDIR} 52 53 .PATH: ${DIST}/libgcc ${DIST}/libgcc/config 54 55 .include "../Makefile.tconfigh" 56 EXTRA_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 75 CPUFLAGS+=-Wa,--no-warn 76 .endif 77 78 .else 79 80 .include <bsd.prog.mk> # do nothing 81 82 .endif # ! EXTERNAL_TOOLCHAIN && MKGCC != no 83