xref: /minix/external/gpl3/gcc/lib/libgcc/libgcc/Makefile (revision 0a6a1f1d)
1#	$NetBSD: Makefile,v 1.23 2014/11/02 14:54:27 matt Exp $
2
3REQUIRETOOLS=	yes
4NOLINT=		# defined
5NOPIC=		# defined
6NOPROFILE=	# defined
7
8LIB=		gcc
9
10.include "../../../Makefile.gcc_path"
11.include <bsd.own.mk>
12
13.if ${MKGCC} != "no"
14
15.include <bsd.init.mk>
16
17.cc: # disable .cc->NULL transform
18
19# XXX handle this better?  GCC 4.8 moved them.
20.if ${MACHINE} == "emips"
21G_LIB2ADD_HACK+=	${GNUHOSTDIST}/gcc/config/floatunsidf.c \
22			${GNUHOSTDIST}/gcc/config/floatunsisf.c
23.endif
24
25SRCS+=		${LIB2FUNCS} ${LIB2FUNCS_ST} ${LIB2DIVMOD} \
26		${G_LIB2ADD:T:S/.asm/.S/} ${G_LIB2ADD_HACK:T:S/.asm/.S/} \
27		${G_LIB2ADD_ST:T} ${LIB1ASMFUNCS}
28.if ${MKPIC} == "no"
29.if empty(LIBGCC_MACHINE_ARCH:Mearm*)
30SRCS+=		${LIB2_EH} ${LIB2_EHASM}
31.endif
32PICFLAGS=
33.else
34CPPFLAGS+=	-DPIC
35.endif
36
37# Force building libgcc.a.  It will be PIC from -DPIC above and also
38# the -fpic/-FPIC present in ${G_LIBGCC2_CFLAGS}.
39MKPIC:= no
40
41COPTS.unwind-dw2.c = -Wno-stack-protector
42
43.include <bsd.lib.mk>
44
45
46CLEANFILES+=	${SOBJS:=.tmp1} ${SOBJS:=.tmp2}
47
48.c.o:
49	${_MKTARGET_COMPILE}
50	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp1
51	${NM} -pg ${.TARGET}.tmp1 | \
52	    ${TOOL_AWK} 'NF == 3 { print "\t.hidden", $$3 }' | \
53	    ${CC} ${COPTS} -r -nostdinc -nostdlib ${CPUFLAGS} -o ${.TARGET}.tmp2 ${.TARGET}.tmp1 -xassembler -
54	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.tmp2
55.if defined(COPTS) && !empty(COPTS:M*-g*)
56	mv ${.TARGET}.tmp2 ${.TARGET}
57.else
58	${LD} -r ${.TARGET}.tmp2 -o ${.TARGET}
59	rm -f ${.TARGET}.tmp2
60.endif
61	rm -f ${.TARGET}.tmp1
62
63.S.o .s.o:
64	${_MKTARGET_COMPILE}
65	${COMPILE.S} ${PICFLAGS} ${CFLAGS:M-[ID]*} ${.IMPSRC} -o ${.TARGET}.tmp1
66	${NM} -pg ${.TARGET}.tmp1 | \
67	    ${TOOL_AWK} 'NF == 3 { print "\t.hidden", $$3 }' | \
68	    ${CC} ${COPTS} -r -nostdinc -nostdlib -o ${.TARGET}.tmp2 ${.TARGET}.tmp1 -xassembler -
69	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.tmp2
70.if defined(COPTS) && !empty(COPTS:M*-g*)
71	mv ${.TARGET}.tmp2 ${.TARGET}
72.else
73	${LD} -r ${.TARGET}.tmp2 -o ${.TARGET}
74	rm -f ${.TARGET}.tmp2
75.endif
76	rm -f ${.TARGET}.tmp1
77
78.else
79.include <bsd.prog.mk> # do nothing
80.endif
81