1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2006-03-18 21:37:05 +00:00
|
|
|
.include <bsd.own.mk>
|
2002-05-12 14:05:58 +00:00
|
|
|
.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
GCCDIR= ${.CURDIR}/../../../contrib/gcc
|
2002-05-12 14:05:58 +00:00
|
|
|
.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}
|
1999-03-31 06:40:40 +00:00
|
|
|
|
2001-01-06 06:16:31 +00:00
|
|
|
# allow to be overridden for the a.out case
|
1999-10-03 02:43:20 +00:00
|
|
|
.if !defined(LIB) || ${LIB} != "gcc_r"
|
1994-08-02 20:15:59 +00:00
|
|
|
LIB= gcc
|
1999-10-03 02:43:20 +00:00
|
|
|
.endif
|
1996-09-21 14:27:38 +00:00
|
|
|
|
2002-05-10 08:54:50 +00:00
|
|
|
#SHLIB_MAJOR= 1
|
2002-05-07 00:55:51 +00:00
|
|
|
|
2003-06-13 22:07:39 +00:00
|
|
|
# We need to install libgcc_pic.a as well, for use by shared libs.
|
2004-10-24 15:33:08 +00:00
|
|
|
INSTALL_PIC_ARCHIVE=
|
2003-06-13 22:07:39 +00:00
|
|
|
|
1996-09-19 15:53:53 +00:00
|
|
|
#
|
2002-05-07 00:55:51 +00:00
|
|
|
# XXX This is a hack, but it seems to work.
|
|
|
|
# libgcc2.a is meant to be compiled by *this* version of gcc.
|
1996-09-19 15:53:53 +00:00
|
|
|
#
|
|
|
|
# Normally, this does not make any difference, since we only have gcc, but
|
|
|
|
# when bootstrapping from gcc-2.6.3, we have to use the freshly built 2.7.2
|
1998-07-08 00:45:50 +00:00
|
|
|
# compiler for some of the libgcc2.c __attribute__ stuff.
|
1996-09-19 15:53:53 +00:00
|
|
|
#
|
1998-07-08 00:45:50 +00:00
|
|
|
# We now depend on a bootstrap pass (normally in `make world') to build
|
|
|
|
# and install the new version of gcc before we get here. This makes
|
|
|
|
# finding the new version (XCC) easy but may break finding the old version
|
|
|
|
# (CC).
|
|
|
|
#
|
|
|
|
XCC= ${CC}
|
1999-04-04 16:36:35 +00:00
|
|
|
XCXX= ${CXX}
|
1996-09-19 15:53:53 +00:00
|
|
|
|
2002-05-10 09:32:39 +00:00
|
|
|
CFLAGS+= -fexceptions
|
2002-05-07 00:55:51 +00:00
|
|
|
CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
|
|
|
|
-DFINE_GRAINED_LIBRARIES
|
2001-01-06 06:16:31 +00:00
|
|
|
CFLAGS+= -D_PTHREADS -DGTHREAD_USE_WEAK
|
2002-05-07 00:55:51 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../../usr.bin/cc/cc_tools \
|
|
|
|
-I${GCCDIR}/config -I${GCCDIR} -I.
|
|
|
|
|
2002-05-17 04:18:33 +00:00
|
|
|
OBJS= # added to below in various ways depending on TARGET_ARCH
|
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
#---------------------------------------------------------------------------
|
2001-12-18 03:05:22 +00:00
|
|
|
#
|
|
|
|
# When upgrading GCC, get the following defintions straight from Makefile.in
|
|
|
|
#
|
|
|
|
# Library members defined in libgcc2.c.
|
2004-07-28 05:27:21 +00:00
|
|
|
LIB2FUNCS = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \
|
|
|
|
_cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
|
|
|
|
_fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi \
|
|
|
|
_floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache \
|
|
|
|
_enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \
|
|
|
|
_addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
|
|
|
|
_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \
|
|
|
|
_popcountsi2 _popcountdi2 _paritysi2 _paritydi2
|
2001-12-18 03:05:22 +00:00
|
|
|
|
|
|
|
# Defined in libgcc2.c, included only in the static library.
|
2004-07-28 05:27:21 +00:00
|
|
|
LIB2FUNCS_ST = _eprintf __gcc_bcmp
|
1998-03-23 12:23:13 +00:00
|
|
|
|
2001-12-18 03:05:22 +00:00
|
|
|
FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
|
|
|
|
_fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
|
|
|
|
_lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
|
2004-07-28 05:27:21 +00:00
|
|
|
_sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf
|
2001-12-18 03:05:22 +00:00
|
|
|
|
|
|
|
DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
|
|
|
|
_fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
|
|
|
|
_lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
|
2004-07-28 05:27:21 +00:00
|
|
|
_df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df
|
|
|
|
|
|
|
|
TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
|
|
|
|
_fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
|
|
|
|
_lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
|
|
|
|
_tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
|
2001-12-18 03:05:22 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
# These might cause a divide overflow trap and so are compiled with
|
|
|
|
# unwinder info.
|
|
|
|
LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
|
|
|
|
|
2001-12-18 03:05:22 +00:00
|
|
|
LIB2ADD = $(LIB2FUNCS_EXTRA)
|
|
|
|
LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
|
|
|
|
|
2004-07-28 05:27:21 +00:00
|
|
|
# Additional sources to handle exceptions; overridden by targets as needed.
|
|
|
|
LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c gthr-gnat.c unwind-c.c
|
2001-12-18 03:05:22 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
#-----------------------------------------------------------------------
|
2001-12-18 03:05:22 +00:00
|
|
|
#
|
2002-05-07 00:55:51 +00:00
|
|
|
# Platform specific bits.
|
|
|
|
# When upgrading GCC, get the following defintions from config/<cpu>/t-*
|
2001-12-18 03:05:22 +00:00
|
|
|
#
|
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
.if ${TARGET_ARCH} == "alpha"
|
|
|
|
# from config/alpha/t-alpha
|
|
|
|
LIB2FUNCS_EXTRA = qrnnd.asm
|
1999-04-04 20:47:33 +00:00
|
|
|
.endif
|
2001-12-18 03:05:22 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
.if ${TARGET_ARCH} == "arm"
|
|
|
|
# from config/arm/t-strongarm-elf
|
2004-07-28 05:27:21 +00:00
|
|
|
CFLAGS+= -Dinhibit_libc -fno-inline
|
|
|
|
LIB1ASMSRC = lib1funcs.asm
|
2006-10-12 16:43:15 +00:00
|
|
|
LIB1ASMFUNCS = _dvmd_tls _bb_init_func
|
2004-07-28 05:27:21 +00:00
|
|
|
OBJS+= dp-bit.o fp-bit.o
|
2002-05-07 00:55:51 +00:00
|
|
|
# We want fine grained libraries, so use the new code to build the
|
|
|
|
# floating point emulation libraries.
|
2002-05-10 08:54:50 +00:00
|
|
|
XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform
|
1999-04-04 20:41:50 +00:00
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
.if ${TARGET_ARCH} == "ia64"
|
|
|
|
# from config/ia64/t-ia64
|
2002-05-18 09:46:12 +00:00
|
|
|
LIB1ASMSRC = lib1funcs.asm
|
2004-07-28 05:27:21 +00:00
|
|
|
LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \
|
|
|
|
__divdi3 __moddi3 __udivdi3 __umoddi3 \
|
|
|
|
__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
|
|
|
|
__nonlocal_goto __restore_stack_nonlocal __trampoline __compat
|
|
|
|
LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c gthr-gnat.c
|
2002-05-07 00:55:51 +00:00
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
.if ${TARGET_ARCH} == "powerpc"
|
|
|
|
# from config/rs6000/t-ppccomm
|
2002-05-17 03:08:15 +00:00
|
|
|
LIB2FUNCS_EXTRA = tramp.asm
|
2002-05-07 00:55:51 +00:00
|
|
|
# This one can't end up in shared libgcc
|
2002-05-17 03:08:15 +00:00
|
|
|
LIB2FUNCS_STATIC_EXTRA = eabi.asm
|
2002-05-07 00:55:51 +00:00
|
|
|
# We want fine grained libraries, so use the new code to build the
|
|
|
|
# floating point emulation libraries.
|
|
|
|
OBJS+= dp-bit.o fp-bit.o
|
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
.if ${TARGET_ARCH} == "sparc64"
|
|
|
|
# from config/sparc/t-elf
|
|
|
|
# We want fine grained libraries, so use the new code to build the
|
|
|
|
# floating point emulation libraries.
|
2002-05-18 09:46:12 +00:00
|
|
|
LIB1ASMSRC = lb1spc.asm
|
2002-05-07 00:55:51 +00:00
|
|
|
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
|
|
|
OBJS+= dp-bit.o fp-bit.o
|
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
dp-bit.o: config/fp-bit.c
|
|
|
|
${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
dp-bit.So: config/fp-bit.c
|
|
|
|
${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
dp-bit.po: config/fp-bit.c
|
|
|
|
${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
fp-bit.o: config/fp-bit.c
|
|
|
|
${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
|
|
|
|
|
|
|
|
fp-bit.So: config/fp-bit.c
|
|
|
|
${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
|
|
|
|
|
|
|
|
fp-bit.po: config/fp-bit.c
|
|
|
|
${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
2002-05-12 12:44:04 +00:00
|
|
|
# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
|
|
|
|
# defined as optimized assembly code in LIB1ASMFUNCS.
|
|
|
|
.if defined(LIB1ASMFUNCS)
|
|
|
|
.for sym in ${LIB1ASMFUNCS}
|
2004-08-04 03:13:51 +00:00
|
|
|
LIB2FUNCS:= ${LIB2FUNCS:S/${sym}//g}
|
2002-05-12 12:44:04 +00:00
|
|
|
LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2002-05-12 14:05:58 +00:00
|
|
|
ASM_T= ${LIB1ASMFUNCS:S/$/.o/}
|
|
|
|
ASM_P= ${LIB1ASMFUNCS:S/$/.po/}
|
|
|
|
ASM_S= ${LIB1ASMFUNCS:S/$/.So/}
|
|
|
|
|
2004-08-04 03:13:51 +00:00
|
|
|
SYMS= ${LIB2FUNCS} \
|
2002-05-12 12:44:04 +00:00
|
|
|
${LIB2_DIVMOD_FUNCS}
|
|
|
|
.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
|
|
|
|
SYMS+= ${FPBIT_FUNCS} ${DPBIT_FUNCS}
|
|
|
|
.endif
|
|
|
|
SYMS_ST= ${LIB2FUNCS_ST} \
|
|
|
|
${LIB2ADD_ST}
|
2002-05-17 08:59:13 +00:00
|
|
|
OBJS+= ${SYMS:S/$/.o/} ${LIB1ASMFUNCS:S/$/.o/}
|
2002-05-12 12:44:04 +00:00
|
|
|
OBJS_T= ${SYMS:S/$/.o/} ${SYMS_ST:S/$/.o/}
|
|
|
|
OBJS_P= ${SYMS:S/$/.po/} ${SYMS_ST:S/$/.po/}
|
|
|
|
OBJS_S= ${SYMS:S/$/.So/}
|
|
|
|
STATICOBJS= ${SYMS_ST:S/$/.o/}
|
|
|
|
SRCS= ${LIB2ADD} ${LIB2ADDEH}
|
|
|
|
|
2004-07-28 05:27:21 +00:00
|
|
|
COMMONHDRS= tm.h tconfig.h
|
2002-05-07 00:55:51 +00:00
|
|
|
SRCS+= ${COMMONHDRS}
|
|
|
|
CLEANFILES+= ${COMMONHDRS}
|
|
|
|
|
2004-07-28 05:27:21 +00:00
|
|
|
${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile
|
2002-05-07 00:55:51 +00:00
|
|
|
${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
|
|
|
|
|
|
|
|
${OBJS} beforedepend: ${COMMONHDRS}
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
${OBJS_T}: libgcc2.c
|
|
|
|
${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2004-12-21 09:33:47 +00:00
|
|
|
.if !defined(NO_PIC)
|
2002-05-07 00:55:51 +00:00
|
|
|
${OBJS_S}: libgcc2.c
|
|
|
|
${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
1994-08-02 20:15:59 +00:00
|
|
|
.endif
|
|
|
|
|
2006-03-18 21:37:05 +00:00
|
|
|
.if ${MK_PROFILE} != "no"
|
2002-05-07 00:55:51 +00:00
|
|
|
${OBJS_P}: libgcc2.c
|
1998-07-08 00:45:50 +00:00
|
|
|
${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
1994-08-02 20:15:59 +00:00
|
|
|
.endif
|
|
|
|
|
2002-05-12 14:05:58 +00:00
|
|
|
.if defined(LIB1ASMSRC)
|
2002-05-18 09:46:12 +00:00
|
|
|
.for _lib1asmsrc in ${LIB1ASMSRC}
|
|
|
|
${ASM_T}: ${_lib1asmsrc}
|
|
|
|
${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
|
|
|
|
-o ${.TARGET} ${.ALLSRC:N*.h}
|
2002-05-12 14:05:58 +00:00
|
|
|
|
2004-12-21 09:33:47 +00:00
|
|
|
.if !defined(NO_PIC)
|
2002-05-18 09:46:12 +00:00
|
|
|
${ASM_S}: ${_lib1asmsrc}
|
|
|
|
${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
|
|
|
|
-o ${.TARGET} ${.ALLSRC:N*.h}
|
2002-05-12 14:05:58 +00:00
|
|
|
.endif
|
|
|
|
|
2006-03-18 21:37:05 +00:00
|
|
|
.if ${MK_PROFILE} != "no"
|
2002-05-18 09:46:12 +00:00
|
|
|
${ASM_P}: ${_lib1asmsrc}
|
|
|
|
${XCC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
|
|
|
|
-o ${.TARGET} ${.ALLSRC:N*.h}
|
2002-05-12 14:05:58 +00:00
|
|
|
.endif
|
2002-05-18 09:46:12 +00:00
|
|
|
.endfor
|
2002-05-12 14:05:58 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-02 20:15:59 +00:00
|
|
|
.include <bsd.lib.mk>
|