Home | History | Annotate | Line # | Download | only in crtstuff
Makefile revision 1.9
      1 #	$NetBSD: Makefile,v 1.9 2014/03/01 10:00:31 mrg Exp $
      2 
      3 REQUIRETOOLS=	yes
      4 NOLINT=		# defined
      5 UNSUPPORTED_COMPILER.clang=	# defined
      6 
      7 .include <bsd.own.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=		${NETBSDSRCDIR}/external/gpl3/gcc/dist
     14 GNUHOSTDIST=	${DIST}
     15 GCCARCH=	${NETBSDSRCDIR}/external/gpl3/gcc/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.
     21 COPTS+=		-finhibit-size-directive \
     22 		-fno-inline \
     23 		-fno-exceptions \
     24 		-fno-zero-initialized-in-bss \
     25 		-fno-toplevel-reorder \
     26 		-fno-tree-vectorize \
     27 		-fno-omit-frame-pointer \
     28 		-fno-asynchronous-unwind-tables
     29 
     30 GCFLAGS=	${GALLCFLAGS:N-D*:N-I*:N-i*:N./*}
     31 
     32 DPSRCS+=	${.CURDIR}/arch/${MACHINE_ARCH}.mk tconfig.h
     33 
     34 .include "${.CURDIR}/arch/${MACHINE_ARCH}.mk"
     35 
     36 SRCS+=		crtbegin.c crtend.c
     37 OBJS+=		crtbegin.o crtend.o
     38 .if ${MKPIC} != "no"
     39 SRCS+=		crtbeginS.c crtendS.c
     40 OBJS+=		crtbeginS.o crtendS.o	# for shared libraries
     41 CPPFLAGS.crtbeginS.o+=	-fPIC -DPIC
     42 CPPFLAGS.crtendS.o+=	-fPIC -DPIC
     43 SRCS+=		crtbeginT.c
     44 OBJS+=		crtbeginT.o		# for -static links
     45 .endif
     46 
     47 realall: ${OBJS}
     48 
     49 FILES=${OBJS}
     50 FILESDIR=${LIBDIR}
     51 
     52 .PATH: ${DIST}/gcc ${DIST}/gcc/config ${G_CONFIGDIR}
     53 
     54 .include "../Makefile.tconfigh"
     55 EXTRA_FAKEHEADERS= options.h
     56 .include "../Makefile.hacks"
     57 
     58 ${OBJS}: ${DPSRCS}
     59 
     60 .include <bsd.prog.mk>
     61 
     62 # Override the default .c -> .o rule.
     63 .c.o:
     64 	${_MKTARGET_COMPILE}
     65 	${CC} ${CPPFLAGS} ${CPPFLAGS.${.TARGET}} ${GCFLAGS} ${COPTS} ${COPTS.${.TARGET}} ${CPUFLAGS} -c ${.IMPSRC} -o ${.TARGET}.o
     66 	mv ${.TARGET}.o ${.TARGET}
     67 
     68 .if (${MACHINE_ARCH} == "mips64eb") || (${MACHINE_ARCH} == "mips64el")
     69 # Turn off as(1) warnings on MIPS, since warnings are fatal with WARNS>0
     70 # and GCC configury passes -finhibit-size-directive which causes mips-gas
     71 # to barf.  Don't know what the real fix for this is...
     72 #
     73 # XXX should be COPTS, but that's too early
     74 CPUFLAGS+=-Wa,--no-warn
     75 .endif
     76 
     77 .else
     78 
     79 .include <bsd.prog.mk>			# do nothing
     80 
     81 .endif	# ! EXTERNAL_TOOLCHAIN && MKGCC != no
     82