Makefile revision 42450
1#
2# $Id: Makefile,v 1.18 1998/10/06 11:28:29 peter Exp $
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# We now depend on a bootstrap pass (normally in `make world') to build
20# and install the new version of gcc before we get here.  This makes
21# finding the new version (XCC) easy but may break finding the old version
22# (CC).
23#
24XCC=	${CC}
25
26# Members of libgcc1.a.
27LIB1FUNCS= _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
28	   _lshrsi3 _ashrsi3 _ashlsi3 \
29	   _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
30	   _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
31	   _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
32	   _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
33	   _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
34
35# Library members defined in libgcc2.c.
36LIB2FUNCS= _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
37	   _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
38	   _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
39	   _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
40	   _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
41	   _fixtfdi _fixunstfdi _floatditf \
42	   __gcc_bcmp _varargs _eprintf _op_new _op_vnew _new_handler \
43	   _op_delete \
44	   _op_vdel _bb _shtab _clear_cache _trampoline __main _exit _ctors \
45	   _eh _pure
46
47COMMONHDRS=	config.h tconfig.h tm.h
48CFLAGS+=	-I.
49CLEANFILES+=	${COMMONHDRS}
50
51LIB1OBJS=	${LIB1FUNCS:S/$/.o/}
52LIB2OBJS=	${LIB2FUNCS:S/$/.o/}
53LIB1SOBJS=	${LIB1FUNCS:S/$/.So/}
54LIB2SOBJS=	${LIB2FUNCS:S/$/.So/}
55LIB1POBJS=	${LIB1FUNCS:S/$/.po/}
56LIB2POBJS=	${LIB2FUNCS:S/$/.po/}
57
58OBJS=		${LIB1OBJS} ${LIB2OBJS}
59
60config.h tconfig.h:
61	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > ${.TARGET}
62
63tm.h:
64	echo '#include "${MACHINE_ARCH}/freebsd.h"' > ${.TARGET}
65
66${OBJS}: ${COMMONHDRS}
67
68${LIB1OBJS}: libgcc1.c
69	${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
70	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
71	@mv ${.TARGET}.tmp ${.TARGET}
72
73${LIB2OBJS}: libgcc2.c
74	${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
75	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
76	@mv ${.TARGET}.tmp ${.TARGET}
77
78.if !defined(NOPIC)
79${LIB1SOBJS}: libgcc1.c
80	${CC} -c -fpic ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
81	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
82	@mv ${.TARGET}.tmp ${.TARGET}
83
84${LIB2SOBJS}: libgcc2.c
85	${XCC} -c -fpic ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
86	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
87	@mv ${.TARGET}.tmp ${.TARGET}
88.endif
89
90.if !defined(NOPROFILE)
91${LIB1POBJS}: libgcc1.c
92	${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
93	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
94	@mv ${.TARGET}.tmp ${.TARGET}
95
96${LIB2POBJS}: libgcc2.c
97	${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
98	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
99	@mv ${.TARGET}.tmp ${.TARGET}
100.endif
101
102.include <bsd.lib.mk>
103