Initial import from FreeBSD RELENG_4:
[dragonfly.git] / gnu / lib / libgcc / Makefile
1 # $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.31.2.2 2002/06/20 23:13:29 obrien Exp $
2
3 GCCDIR= ${.CURDIR}/../../../contrib/gcc
4
5 .PATH: ${GCCDIR}/cp ${GCCDIR}
6
7 # allow to be overridden for the a.out case
8 .if !defined(LIB) || ${LIB} != "gcc_r"
9 LIB=    gcc
10 .endif
11
12 .if ${OBJFORMAT} == aout
13 # Install libgcc_pic.a, since ld.so uses it.
14 INSTALL_PIC_ARCHIVE=  yes
15 .endif
16
17 #
18 # XXX This is a hack, but it seems to work.  libgcc1.a is supposed to be
19 # compiled by the native compiler, and libgcc2.a is meant to be compiled
20 # by *this* version of gcc.
21 #
22 # Normally, this does not make any difference, since we only have gcc, but
23 # when bootstrapping from gcc-2.6.3, we have to use the freshly built 2.7.2
24 # compiler for some of the libgcc2.c __attribute__ stuff.
25 #
26 # We now depend on a bootstrap pass (normally in `make world') to build
27 # and install the new version of gcc before we get here.  This makes
28 # finding the new version (XCC) easy but may break finding the old version
29 # (CC).
30 #
31 XCC=    ${CC}
32 XCXX=   ${CXX}
33
34 # Members of libgcc1.a.
35 LIB1FUNCS= _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
36            _lshrsi3 _ashrsi3 _ashlsi3 \
37            _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
38            _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
39            _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
40            _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
41            _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
42
43 # Library members defined in libgcc2.c.
44 LIB2FUNCS= _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
45            _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
46            _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
47            _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
48            _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
49            _fixtfdi _fixunstfdi _floatditf \
50            __gcc_bcmp _varargs __dummy _eprintf \
51            _bb _shtab _clear_cache _trampoline __main _exit _ctors \
52            _eh _pure
53
54 # Library members defined in new1.cc.
55 NEW1FUNCS= _op_new _op_newnt 
56
57 # Library members defined in new2.cc.
58 NEW2FUNCS= _op_vnew _op_vnewnt _op_delete _op_delnt _op_vdel _op_vdelnt 
59
60 SRCS=   frame.c tinfo.cc tinfo2.cc new.cc exception.cc
61
62 CFLAGS+=        -fexceptions
63 CFLAGS+=        -DIN_GCC
64 .if ${OBJFORMAT} != aout
65 CFLAGS+=        -D_PTHREADS -DGTHREAD_USE_WEAK
66 .endif
67 CFLAGS+=        -I${GCCDIR}/config -I${GCCDIR} -I.
68 CXXFLAGS+=      -I${GCCDIR}/cp/inc
69 CXXFLAGS+=      -nostdinc++
70
71 COMMONHDRS=     config.h tconfig.h tm.h
72 CLEANFILES+=    ${COMMONHDRS}
73 SRCS+=          ${COMMONHDRS}
74
75 LIB1OBJS=       ${LIB1FUNCS:S/$/.o/}
76 LIB2OBJS=       ${LIB2FUNCS:S/$/.o/}
77 LIB1SOBJS=      ${LIB1FUNCS:S/$/.So/}
78 LIB2SOBJS=      ${LIB2FUNCS:S/$/.So/}
79 LIB1POBJS=      ${LIB1FUNCS:S/$/.po/}
80 LIB2POBJS=      ${LIB2FUNCS:S/$/.po/}
81 NEW1OBJS=       ${NEW1FUNCS:S/$/.o/}
82 NEW2OBJS=       ${NEW2FUNCS:S/$/.o/}
83 NEW1SOBJS=      ${NEW1FUNCS:S/$/.So/}
84 NEW2SOBJS=      ${NEW2FUNCS:S/$/.So/}
85 NEW1POBJS=      ${NEW1FUNCS:S/$/.po/}
86 NEW2POBJS=      ${NEW2FUNCS:S/$/.po/}
87
88 OBJS=   ${LIB1OBJS} ${LIB2OBJS} ${NEW1OBJS} ${NEW2OBJS}
89
90 config.h:
91         echo '#include <${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h>'  > ${.TARGET}
92         echo '#include <xm-freebsd.h>'                          >> ${.TARGET}
93
94 tconfig.h:
95         echo '#include "gansidecl.h"'                           > ${.TARGET}
96         echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"'  >> ${.TARGET}
97
98 #       KEEP THIS IN SYNC with src/gcc/usr.bin/cc/cc_tools/Makefile !!
99 tm.h:
100         echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"'     > ${.TARGET}
101 .if ${MACHINE_ARCH} == "i386"
102         echo '#include "${MACHINE_ARCH}/att.h"'                 >> ${.TARGET}
103 .endif
104         echo '#include <freebsd.h>'                             >> ${.TARGET}
105         echo '#include "${MACHINE_ARCH}/freebsd.h"'             >> ${.TARGET}
106 .if ${MACHINE_ARCH} == "i386"
107         echo '#include "${MACHINE_ARCH}/perform.h"'             >> ${.TARGET}
108 .endif
109
110 ${OBJS}: ${COMMONHDRS}
111
112 ${LIB1OBJS}: libgcc1.c
113         ${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
114         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
115         @mv ${.TARGET}.tmp ${.TARGET}
116
117 ${LIB2OBJS}: libgcc2.c
118         ${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
119         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
120         @mv ${.TARGET}.tmp ${.TARGET}
121
122 ${NEW1OBJS}: new1.cc
123         ${XCXX} -c ${CXXFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.cc}
124         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
125         @mv ${.TARGET}.tmp ${.TARGET}
126
127 ${NEW2OBJS}: new2.cc
128         ${CXX} -c ${CXXFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.cc}
129         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
130         @mv ${.TARGET}.tmp ${.TARGET}
131
132 .if !defined(NOPIC)
133 ${LIB1SOBJS}: libgcc1.c
134         ${CC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
135         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
136         @mv ${.TARGET}.tmp ${.TARGET}
137
138 ${LIB2SOBJS}: libgcc2.c
139         ${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
140         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
141         @mv ${.TARGET}.tmp ${.TARGET}
142
143 ${NEW1SOBJS}: new1.cc
144         ${XCXX} -c ${PICFLAG} ${CXXFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.cc}
145         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
146         @mv ${.TARGET}.tmp ${.TARGET}
147
148 ${NEW2SOBJS}: new2.cc
149         ${CXX} -c ${PICFLAG} ${CXXFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.cc}
150         @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
151         @mv ${.TARGET}.tmp ${.TARGET}
152 .endif
153
154 .if !defined(NOPROFILE)
155 ${LIB1POBJS}: libgcc1.c
156         ${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
157         @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
158         @mv ${.TARGET}.tmp ${.TARGET}
159
160 ${LIB2POBJS}: libgcc2.c
161         ${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
162         @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
163         @mv ${.TARGET}.tmp ${.TARGET}
164
165 ${NEW1POBJS}: new1.cc
166         ${XCXX} -c -p ${CXXFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.cc}
167         @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
168         @mv ${.TARGET}.tmp ${.TARGET}
169
170 ${NEW2POBJS}: new2.cc
171         ${CXX} -c -p ${CXXFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.cc}
172         @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
173         @mv ${.TARGET}.tmp ${.TARGET}
174 .endif
175
176 .include <bsd.lib.mk>