Home | History | Annotate | Line # | Download | only in crtstuff
Makefile revision 1.1
      1 #	$NetBSD: Makefile,v 1.1 2011/06/21 06:02:25 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}/gnu/dist/gcc4
     13 GNUHOSTDIST=	${DIST}
     14 GCCARCH=	${NETBSDSRCDIR}/gnu/usr.bin/gcc4/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 
     21 GCFLAGS=	${GALLCFLAGS:N-D*:N-I*:N-i*:N./*}
     22 
     23 DPSRCS+=	${.CURDIR}/arch/${MACHINE_ARCH}.mk tconfig.h
     24 CLEANFILES+=	cs-tconfig.h tconfig.h
     25 
     26 .include "${.CURDIR}/arch/${MACHINE_ARCH}.mk"
     27 
     28 SRCS+=		crtbegin.c crtend.c
     29 OBJS+=		crtbegin.o crtend.o
     30 .if ${MKPIC} != "no"
     31 SRCS+=		crtbeginS.c crtendS.c
     32 OBJS+=		crtbeginS.o crtendS.o	# for shared libraries
     33 SRCS+=		crtbeginT.c
     34 OBJS+=		crtbeginT.o		# for -static links
     35 .endif
     36 
     37 realall: ${OBJS}
     38 
     39 FILES=${OBJS}
     40 FILESDIR=${LIBDIR}
     41 
     42 .PATH: ${DIST}/gcc ${DIST}/gcc/config ${G_CONFIGDIR}
     43 
     44 tconfig.h:
     45 	${_MKTARGET_CREATE}
     46 	TM_DEFINES="$(G_tm_defines)" \
     47 	HEADERS="$(G_xm_file)" XM_DEFINES="$(G_xm_defines)" \
     48 	TARGET_CPU_DEFAULT="" \
     49 	${HOST_SH} $(GNUHOSTDIST)/gcc/mkconfig.sh tconfig.h
     50 
     51 # these aren't necessary but are #include'd
     52 FAKEHEADERS=options.h insn-flags.h insn-constants.h
     53 ${FAKEHEADERS}:
     54 	${_MKTARGET_CREATE}
     55 	touch ${.TARGET}
     56 DPSRCS+=	${FAKEHEADERS}
     57 CLEANFILES+=	${FAKEHEADERS}
     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} ${GCFLAGS} ${CPUFLAGS} -c ${.IMPSRC} -o ${.TARGET}.o
     67 	mv ${.TARGET}.o ${.TARGET}
     68 
     69 .if (${MACHINE_ARCH} == "mips64eb") || (${MACHINE_ARCH} == "mips64el")
     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