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