xref: /netbsd-src/external/gpl3/gcc.old/lib/crtstuff/Makefile (revision f14316bcbc544b96a93e884bc5c2b15fd60e22ae)
1#	$NetBSD: Makefile,v 1.1.1.2 2014/02/26 10:57:30 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=	${EXTERNAL_GCC_SUBDIR}/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.
21COPTS+=		-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
30GCFLAGS=	${GALLCFLAGS:N-D*:N-I*:N-i*:N./*}
31
32DPSRCS+=	${.CURDIR}/arch/${MACHINE_ARCH}.mk tconfig.h
33
34.include "${.CURDIR}/arch/${MACHINE_ARCH}.mk"
35
36SRCS+=		crtbegin.c crtend.c
37OBJS+=		crtbegin.o crtend.o
38.if ${MKPIC} != "no"
39SRCS+=		crtbeginS.c crtendS.c
40OBJS+=		crtbeginS.o crtendS.o	# for shared libraries
41CPPFLAGS.crtbeginS.o+=	-fPIC -DPIC
42CPPFLAGS.crtendS.o+=	-fPIC -DPIC
43SRCS+=		crtbeginT.c
44OBJS+=		crtbeginT.o		# for -static links
45.endif
46
47realall: ${OBJS}
48
49FILES=${OBJS}
50FILESDIR=${LIBDIR}
51
52.PATH: ${DIST}/gcc ${DIST}/gcc/config ${G_CONFIGDIR}
53
54.include "../Makefile.tconfigh"
55EXTRA_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
74CPUFLAGS+=-Wa,--no-warn
75.endif
76
77.else
78
79.include <bsd.prog.mk>			# do nothing
80
81.endif	# ! EXTERNAL_TOOLCHAIN && MKGCC != no
82