Makefile revision 21673
1#
2# $FreeBSD: head/gnu/lib/libgcc/Makefile 21673 1997-01-14 07:20:47Z jkh $
3#
4
5LIB=	gcc
6
7# Install libgcc_pic.a, since ld.so uses it.
8INSTALL_PIC_ARCHIVE=  yes
9
10#
11# XXX This is a hack, but it seems to work.  libgcc1.a is supposed to be
12# compiled by the native compiler, and libgcc2.a is meant to be compiled
13# by *this* version of gcc.
14#
15# Normally, this does not make any difference, since we only have gcc, but
16# when bootstrapping from gcc-2.6.3, we have to use the freshly built 2.7.2
17# compiler for some of the libgcc2.c __attribute__ stuff.
18#
19.if exists(${.OBJDIR}/../cc)
20XCC=	${.OBJDIR}/../cc/cc
21.else
22XCC=	${.CURDIR}/../cc/cc
23.endif
24
25.if exists(${.OBJDIR}/../cc1)
26XCC+=	-B${.OBJDIR}/../cc1/
27.else
28XCC+=	-B${.CURDIR}/../cc1/
29.endif
30
31.if exists(${.OBJDIR}/../cpp)
32XCC+=	-B${.OBJDIR}/../cpp/
33.else
34XCC+=	-B${.CURDIR}/../cpp/
35.endif
36
37# Members of libgcc1.a.
38LIB1FUNCS= _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
39	   _lshrsi3 _ashrsi3 _ashlsi3 \
40	   _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
41	   _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
42	   _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
43	   _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
44	   _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
45
46# Library members defined in libgcc2.c.
47LIB2FUNCS= _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
48	   _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
49	   _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
50	   _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
51	   _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
52	   _fixtfdi _fixunstfdi _floatditf \
53	   __gcc_bcmp _varargs _eprintf _op_new _op_vnew _new_handler \
54	   _op_delete \
55	   _op_vdel _bb _shtab _clear_cache _trampoline __main _exit _ctors \
56	   _eh _pure
57
58LIB1OBJS=${LIB1FUNCS:T:S@$@.o@}
59LIB2OBJS=${LIB2FUNCS:T:S@$@.o@}
60LIB1SOBJS=${LIB1FUNCS:T:S@$@.so@}
61LIB2SOBJS=${LIB2FUNCS:T:S@$@.so@}
62P1OBJS=${LIB1FUNCS:T:S@$@.po@}
63P2OBJS=${LIB2FUNCS:T:S@$@.po@}
64
65OBJS= ${LIB1OBJS} ${LIB2OBJS}
66
67${LIB1OBJS}: libgcc1.c
68	${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/libgcc1.c
69	@${LD} -O ${.TARGET} -x -r ${.TARGET}
70
71${LIB2OBJS}: libgcc2.c
72	${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/libgcc2.c
73	@${LD} -O ${.TARGET} -x -r ${.TARGET}
74
75.if !defined(NOPIC)
76${LIB1SOBJS}: libgcc1.c
77	${CC} -c -fpic ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/libgcc1.c
78	@${LD} -O ${.TARGET} -x -r ${.TARGET}
79
80${LIB2SOBJS}: libgcc2.c
81	${XCC} -c -fpic ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/libgcc2.c
82	@${LD} -O ${.TARGET} -x -r ${.TARGET}
83.endif
84
85.if !defined(NOPROFILE)
86${P1OBJS}: libgcc1.c
87	${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/libgcc1.c
88	@${LD} -O ${.TARGET} -X -r ${.TARGET}
89
90${P2OBJS}: libgcc2.c
91	${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/libgcc2.c
92	@${LD} -O ${.TARGET} -X -r ${.TARGET}
93.endif
94
95.include <bsd.lib.mk>
96