RIP GNU patch.
[dragonfly.git] / gnu / lib / gcc3 / libgcc / Makefile
CommitLineData
6aa2dd31 1# $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.50 2003/07/11 05:29:11 kan Exp $
1397f94a 2# $DragonFly: src/gnu/lib/gcc3/libgcc/Attic/Makefile,v 1.4 2004/03/22 20:57:36 dillon Exp $
6aa2dd31 3
7db62ea6 4.include "../Makefile.inc"
6aa2dd31
JS
5.include "${.CURDIR}/../../../usr.bin/cc3/Makefile.tgt"
6
777b905f
JS
7.PATH: ${.OBJDIR}/../../../usr.bin/cc3/cc_int
8.PATH: ${.CURDIR}/../../../usr.bin/cc3/cc_int
7db62ea6 9.PATH: ${GCCDIR}/gcc/config/${GCC_CPU} ${GCCDIR}/gcc
6aa2dd31
JS
10
11# allow to be overridden for the a.out case
12.if !defined(LIB) || ${LIB} != "gcc_r"
13LIB= gcc
14.endif
15
16#SHLIB_MAJOR= 1
17
18# We need to install libgcc_pic.a as well, for use by shared libs.
19INSTALL_PIC_ARCHIVE= yes
20
21#
22# XXX This is a hack, but it seems to work.
23# libgcc2.a is meant to be compiled by *this* version of gcc.
24#
25# Normally, this does not make any difference, since we only have gcc, but
26# when bootstrapping from gcc-2.6.3, we have to use the freshly built 2.7.2
27# compiler for some of the libgcc2.c __attribute__ stuff.
28#
29# We now depend on a bootstrap pass (normally in `make world') to build
30# and install the new version of gcc before we get here. This makes
31# finding the new version (XCC) easy but may break finding the old version
32# (CC).
33#
34XCC= ${CC}
35XCXX= ${CXX}
36
37CFLAGS+= -fexceptions
38CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
39 -DFINE_GRAINED_LIBRARIES
40CFLAGS+= -D_PTHREADS -DGTHREAD_USE_WEAK
7db62ea6
MD
41CFLAGS+= -I. -I${CCTOOLS_SRC} -I${CCTOOLS_OBJ} \
42 -I${DFLYH} -I${GCCDIR}/include -I${GCCDIR}/gcc/config \
43 -I${GCCDIR}/gcc
6aa2dd31
JS
44
45OBJS= # added to below in various ways depending on TARGET_ARCH
46
47#---------------------------------------------------------------------------
48#
49# When upgrading GCC, get the following defintions straight from Makefile.in
50#
51
52# Library members defined in libgcc2.c.
53# Variable length limited to 255 charactes when passed to a shell script.
54LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \
55 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
56 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
57
58LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \
59 _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \
777b905f
JS
60 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
61 _stack_smash_handler
6aa2dd31
JS
62
63# Defined in libgcc2.c, included only in the static library.
64LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp
65
66FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
67 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
68 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
69 _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf
70
71DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
72 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
73 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
74 _df_to_sf _thenan_df _df_to_usi _usi_to_df
75
76# These might cause a divide overflow trap and so are compiled with
77# unwinder info.
78LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
79
80MACHMODE_H = machmode.h machmode.def
81
82LIB2ADD = $(LIB2FUNCS_EXTRA)
83LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
84
85# Additional sources to handle exceptions; overridden on ia64.
86LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c unwind-c.c
87
88#-----------------------------------------------------------------------
89#
90# Platform specific bits.
91# When upgrading GCC, get the following defintions from config/<cpu>/t-*
92#
93
94.if ${TARGET_ARCH} == "alpha"
95# from config/alpha/t-alpha
96LIB2FUNCS_EXTRA = qrnnd.asm
97.endif
98
99.if ${TARGET_ARCH} == "arm"
100# from config/arm/t-strongarm-elf
101LIB1ASMSRC = lib1funcs.asm
102LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
103# We want fine grained libraries, so use the new code to build the
104# floating point emulation libraries.
105XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform
106.endif
107
108.if ${TARGET_ARCH} == "ia64"
109# from config/ia64/t-ia64
110LIB1ASMSRC = lib1funcs.asm
111LIB1ASMFUNCS = __divtf3 __divdf3 __divsf3 \
112 __divdi3 __moddi3 __udivdi3 __umoddi3 \
113 __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
114 __nonlocal_goto __restore_stack_nonlocal __trampoline
115LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c
116.endif
117
118.if ${TARGET_ARCH} == "powerpc"
119# from config/rs6000/t-ppccomm
120LIB2FUNCS_EXTRA = tramp.asm
121# This one can't end up in shared libgcc
122LIB2FUNCS_STATIC_EXTRA = eabi.asm
123# We want fine grained libraries, so use the new code to build the
124# floating point emulation libraries.
125OBJS+= dp-bit.o fp-bit.o
126.endif
127
128.if ${TARGET_ARCH} == "sparc64"
129# from config/sparc/t-elf
130# We want fine grained libraries, so use the new code to build the
131# floating point emulation libraries.
132LIB1ASMSRC = lb1spc.asm
133LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
134OBJS+= dp-bit.o fp-bit.o
135.endif
136
137dp-bit.o: config/fp-bit.c
138 ${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
139
140dp-bit.So: config/fp-bit.c
141 ${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
142
143dp-bit.po: config/fp-bit.c
144 ${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
145
146fp-bit.o: config/fp-bit.c
147 ${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
148
149fp-bit.So: config/fp-bit.c
150 ${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
151
152fp-bit.po: config/fp-bit.c
153 ${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
154
155#-----------------------------------------------------------------------
156
157# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
158# defined as optimized assembly code in LIB1ASMFUNCS.
159.if defined(LIB1ASMFUNCS)
160.for sym in ${LIB1ASMFUNCS}
161LIB2FUNCS_1:= ${LIB2FUNCS_1:S/${sym}//g}
162LIB2FUNCS_2:= ${LIB2FUNCS_2:S/${sym}//g}
163LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
164.endfor
165.endif
166
167ASM_T= ${LIB1ASMFUNCS:S/$/.o/}
168ASM_P= ${LIB1ASMFUNCS:S/$/.po/}
169ASM_S= ${LIB1ASMFUNCS:S/$/.So/}
170
171SYMS= ${LIB2FUNCS_1} \
172 ${LIB2FUNCS_2} \
1397f94a
MD
173 ${LIB2_DIVMOD_FUNCS} \
174 ${LIB2ADDEH}
6aa2dd31
JS
175.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
176SYMS+= ${FPBIT_FUNCS} ${DPBIT_FUNCS}
177.endif
178SYMS_ST= ${LIB2FUNCS_ST} \
179 ${LIB2ADD_ST}
180OBJS+= ${SYMS:S/$/.o/} ${LIB1ASMFUNCS:S/$/.o/}
181OBJS_T= ${SYMS:S/$/.o/} ${SYMS_ST:S/$/.o/}
182OBJS_P= ${SYMS:S/$/.po/} ${SYMS_ST:S/$/.po/}
183OBJS_S= ${SYMS:S/$/.So/}
184STATICOBJS= ${SYMS_ST:S/$/.o/}
185SRCS= ${LIB2ADD} ${LIB2ADDEH}
186
187.if exists(${CCTOOLS_OBJ})
188TCONFIG_H = ${CCTOOLS_OBJ}/tconfig.h
189.else
190TCONFIG_H = ${CCTOOLS_SRC}/tconfig.h
191.endif
192
193${TCONFIG_H}: ${CCTOOLS_SRC}/Makefile
194 cd ${CCTOOLS_SRC} && make tconfig.h
195
196${OBJS} beforedepend: ${TCONFIG_H}
197
198${OBJS_T}: libgcc2.c
199 ${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
200
201.if !defined(NOPIC)
202${OBJS_S}: libgcc2.c
203 ${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
204.endif
205
206.if !defined(NOPROFILE)
207${OBJS_P}: libgcc2.c
208 ${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
209.endif
210
211.if defined(LIB1ASMSRC)
212.for _lib1asmsrc in ${LIB1ASMSRC}
213${ASM_T}: ${_lib1asmsrc}
214 ${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
215 -o ${.TARGET} ${.ALLSRC:N*.h}
216
217.if !defined(NOPIC)
218${ASM_S}: ${_lib1asmsrc}
219 ${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
220 -o ${.TARGET} ${.ALLSRC:N*.h}
221.endif
222
223.if !defined(NOPROFILE)
224${ASM_P}: ${_lib1asmsrc}
225 ${XCC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
226 -o ${.TARGET} ${.ALLSRC:N*.h}
227.endif
228.endfor
229.endif
230
231.include <bsd.lib.mk>