xref: /minix/external/gpl3/gcc/lib/libgcc/libgcc/Makefile (revision ebfedea0)
1#	$NetBSD: Makefile,v 1.16 2013/10/02 18:25:43 christos Exp $
2
3REQUIRETOOLS=	yes
4NOLINT=		# defined
5NOPIC=		# defined
6NOPROFILE=	# defined
7
8LIB=		gcc
9
10.include <bsd.own.mk>
11
12.if ${MKGCC} != "no"
13
14.include <bsd.init.mk>
15
16.cc: # disable .cc->NULL transform
17
18# XXX handle this better?
19.if ${MACHINE} == "emips"
20G_LIB2ADD_HACK+=	${GNUHOSTDIST}/gcc/config/floatunsidf.c \
21			${GNUHOSTDIST}/gcc/config/floatunsisf.c
22.endif
23
24SRCS+=		${LIB2FUNCS} ${LIB2FUNCS_ST} ${LIB2DIVMOD} \
25		${G_LIB2ADD_HACK:T:S/.asm/.S/} ${G_LIB2ADD:T:S/.asm/.S/} \
26		${G_LIB2ADD_ST} ${LIB1ASMFUNCS}
27.if ${MKPIC} == "no"
28.if empty(LIBGCC_MACHINE_ARCH:Mearm*)
29SRCS+=		${LIB2_EH} ${LIB2_EHASM}
30.endif
31PICFLAGS=
32.else
33CPPFLAGS+=	-DPIC
34.endif
35
36# These usually just have "foo.S", we need to link from the
37# gcc/config/$PLATFORM/foo.asm to it.  So far, only rs6000 uses it,
38# so we hack it for now.
39#.for file in ${G_LIB2ADD_ST}
40.   if ${LIBGCC_MACHINE_ARCH} == "powerpc"  # XXX XXX why does the above work?*
41.for file in crtsavfpr.S crtresfpr.S crtsavgpr.S crtresgpr.S crtresxfpr.S crtresxgpr.S
42BUILDSYMLINKS+=	${GNUHOSTDIST}/gcc/config/rs6000/${file:S/.S$/.asm/} ${file}
43.endfor
44.   endif
45
46# Force building libgcc.a.  It will be PIC from -DPIC above and also
47# the -fpic/-FPIC present in ${G_LIBGCC2_CFLAGS}.
48MKPIC:= no
49
50COPTS.unwind-dw2.c = -Wno-stack-protector
51
52.include <bsd.lib.mk>
53
54
55CLEANFILES+=	${SOBJS:=.tmp1} ${SOBJS:=.tmp2}
56
57.c.o:
58	${_MKTARGET_COMPILE}
59	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp1
60	${NM} -pg ${.TARGET}.tmp1 | \
61	    ${TOOL_AWK} 'NF == 3 { print "\t.hidden", $$3 }' | \
62	    ${CC} ${COPTS} -Wl,-x -r -nostdinc -nostdlib ${CPUFLAGS} -o ${.TARGET}.tmp2 ${.TARGET}.tmp1 -xassembler -
63.if defined(COPTS) && !empty(COPTS:M*-g*)
64	mv ${.TARGET}.tmp2 ${.TARGET}
65.else
66	${LD} -x -r ${.TARGET}.tmp2 -o ${.TARGET}
67	rm -f ${.TARGET}.tmp2
68.endif
69	rm -f ${.TARGET}.tmp1
70
71.S.o .s.o:
72	${_MKTARGET_COMPILE}
73	${COMPILE.S} ${PICFLAGS} ${CFLAGS:M-[ID]*} ${.IMPSRC} -o ${.TARGET}.tmp1
74	${NM} -pg ${.TARGET}.tmp1 | \
75	    ${TOOL_AWK} 'NF == 3 { print "\t.hidden", $$3 }' | \
76	    ${CC} ${COPTS} -Wl,-x -r -nostdinc -nostdlib -o ${.TARGET}.tmp2 ${.TARGET}.tmp1 -xassembler -
77.if defined(COPTS) && !empty(COPTS:M*-g*)
78	mv ${.TARGET}.tmp2 ${.TARGET}
79.else
80	${LD} -x -r ${.TARGET}.tmp2 -o ${.TARGET}
81	rm -f ${.TARGET}.tmp2
82.endif
83	rm -f ${.TARGET}.tmp1
84
85.else
86.include <bsd.prog.mk> # do nothing
87.endif
88