1 # $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.50 2003/07/11 05:29:11 kan Exp $
2 # $DragonFly: src/gnu/lib/gcc3/libgcc/Attic/Makefile,v 1.3 2004/03/05 21:38:44 joerg Exp $
4 .include "../Makefile.inc"
5 .include "${.CURDIR}/../../../usr.bin/cc3/Makefile.tgt"
7 .PATH: ${.OBJDIR}/../../../usr.bin/cc3/cc_int
8 .PATH: ${.CURDIR}/../../../usr.bin/cc3/cc_int
9 .PATH: ${GCCDIR}/gcc/config/${GCC_CPU} ${GCCDIR}/gcc
11 # allow to be overridden for the a.out case
12 .if !defined(LIB) || ${LIB} != "gcc_r"
18 # We need to install libgcc_pic.a as well, for use by shared libs.
19 INSTALL_PIC_ARCHIVE= yes
22 # XXX This is a hack, but it seems to work.
23 # libgcc2.a is meant to be compiled by *this* version of gcc.
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.
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
38 CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
39 -DFINE_GRAINED_LIBRARIES
40 CFLAGS+= -D_PTHREADS -DGTHREAD_USE_WEAK
41 CFLAGS+= -I. -I${CCTOOLS_SRC} -I${CCTOOLS_OBJ} \
42 -I${DFLYH} -I${GCCDIR}/include -I${GCCDIR}/gcc/config \
45 OBJS= # added to below in various ways depending on TARGET_ARCH
47 #---------------------------------------------------------------------------
49 # When upgrading GCC, get the following defintions straight from Makefile.in
52 # Library members defined in libgcc2.c.
53 # Variable length limited to 255 charactes when passed to a shell script.
54 LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \
55 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
56 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
58 LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \
59 _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \
60 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
63 # Defined in libgcc2.c, included only in the static library.
64 LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp
66 FPBIT_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
71 DPBIT_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
76 # These might cause a divide overflow trap and so are compiled with
78 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
80 MACHMODE_H = machmode.h machmode.def
82 LIB2ADD = $(LIB2FUNCS_EXTRA)
83 LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
85 # Additional sources to handle exceptions; overridden on ia64.
86 LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c unwind-c.c
88 #-----------------------------------------------------------------------
90 # Platform specific bits.
91 # When upgrading GCC, get the following defintions from config/<cpu>/t-*
94 .if ${TARGET_ARCH} == "alpha"
95 # from config/alpha/t-alpha
96 LIB2FUNCS_EXTRA = qrnnd.asm
99 .if ${TARGET_ARCH} == "arm"
100 # from config/arm/t-strongarm-elf
101 LIB1ASMSRC = lib1funcs.asm
102 LIB1ASMFUNCS = _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.
105 XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform
108 .if ${TARGET_ARCH} == "ia64"
109 # from config/ia64/t-ia64
110 LIB1ASMSRC = lib1funcs.asm
111 LIB1ASMFUNCS = __divtf3 __divdf3 __divsf3 \
112 __divdi3 __moddi3 __udivdi3 __umoddi3 \
113 __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
114 __nonlocal_goto __restore_stack_nonlocal __trampoline
115 LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c
118 .if ${TARGET_ARCH} == "powerpc"
119 # from config/rs6000/t-ppccomm
120 LIB2FUNCS_EXTRA = tramp.asm
121 # This one can't end up in shared libgcc
122 LIB2FUNCS_STATIC_EXTRA = eabi.asm
123 # We want fine grained libraries, so use the new code to build the
124 # floating point emulation libraries.
125 OBJS+= dp-bit.o fp-bit.o
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.
132 LIB1ASMSRC = lb1spc.asm
133 LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
134 OBJS+= dp-bit.o fp-bit.o
137 dp-bit.o: config/fp-bit.c
138 ${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
140 dp-bit.So: config/fp-bit.c
141 ${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
143 dp-bit.po: config/fp-bit.c
144 ${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
146 fp-bit.o: config/fp-bit.c
147 ${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
149 fp-bit.So: config/fp-bit.c
150 ${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
152 fp-bit.po: config/fp-bit.c
153 ${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
155 #-----------------------------------------------------------------------
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}
161 LIB2FUNCS_1:= ${LIB2FUNCS_1:S/${sym}//g}
162 LIB2FUNCS_2:= ${LIB2FUNCS_2:S/${sym}//g}
163 LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
167 ASM_T= ${LIB1ASMFUNCS:S/$/.o/}
168 ASM_P= ${LIB1ASMFUNCS:S/$/.po/}
169 ASM_S= ${LIB1ASMFUNCS:S/$/.So/}
171 SYMS= ${LIB2FUNCS_1} \
174 .if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
175 SYMS+= ${FPBIT_FUNCS} ${DPBIT_FUNCS}
177 SYMS_ST= ${LIB2FUNCS_ST} \
179 OBJS+= ${SYMS:S/$/.o/} ${LIB1ASMFUNCS:S/$/.o/}
180 OBJS_T= ${SYMS:S/$/.o/} ${SYMS_ST:S/$/.o/}
181 OBJS_P= ${SYMS:S/$/.po/} ${SYMS_ST:S/$/.po/}
182 OBJS_S= ${SYMS:S/$/.So/}
183 STATICOBJS= ${SYMS_ST:S/$/.o/}
184 SRCS= ${LIB2ADD} ${LIB2ADDEH}
186 .if exists(${CCTOOLS_OBJ})
187 TCONFIG_H = ${CCTOOLS_OBJ}/tconfig.h
189 TCONFIG_H = ${CCTOOLS_SRC}/tconfig.h
192 ${TCONFIG_H}: ${CCTOOLS_SRC}/Makefile
193 cd ${CCTOOLS_SRC} && make tconfig.h
195 ${OBJS} beforedepend: ${TCONFIG_H}
198 ${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
202 ${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
205 .if !defined(NOPROFILE)
207 ${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
210 .if defined(LIB1ASMSRC)
211 .for _lib1asmsrc in ${LIB1ASMSRC}
212 ${ASM_T}: ${_lib1asmsrc}
213 ${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
214 -o ${.TARGET} ${.ALLSRC:N*.h}
217 ${ASM_S}: ${_lib1asmsrc}
218 ${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
219 -o ${.TARGET} ${.ALLSRC:N*.h}
222 .if !defined(NOPROFILE)
223 ${ASM_P}: ${_lib1asmsrc}
224 ${XCC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
225 -o ${.TARGET} ${.ALLSRC:N*.h}
230 .include <bsd.lib.mk>