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