Makefile revision 96846
1# $FreeBSD: head/gnu/lib/libgcc/Makefile 96846 2002-05-18 09:21:42Z phk $ 2 3.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" 4 5GCCDIR= ${.CURDIR}/../../../contrib/gcc 6.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR} 7 8# allow to be overridden for the a.out case 9.if !defined(LIB) || ${LIB} != "gcc_r" 10LIB= gcc 11.endif 12 13#SHLIB_MAJOR= 1 14#SHLIB_MINOR= 0 15 16.if ${OBJFORMAT} == aout 17# Install libgcc_pic.a, since ld.so uses it. 18INSTALL_PIC_ARCHIVE= yes 19.endif 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 40.if ${OBJFORMAT} != aout 41CFLAGS+= -D_PTHREADS -DGTHREAD_USE_WEAK 42.endif 43CFLAGS+= -I${.CURDIR}/../../usr.bin/cc/cc_tools \ 44 -I${GCCDIR}/config -I${GCCDIR} -I. 45LDFLAGS= -nostdlib 46 47OBJS= # added to below in various ways depending on TARGET_ARCH 48 49#--------------------------------------------------------------------------- 50# 51# When upgrading GCC, get the following defintions straight from Makefile.in 52# 53 54# Library members defined in libgcc2.c. 55# Variable length limited to 255 charactes when passed to a shell script. 56LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \ 57 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \ 58 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi 59 60LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \ 61 _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \ 62 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors 63 64# Defined in libgcc2.c, included only in the static library. 65LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp 66 67FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ 68 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ 69 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \ 70 _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf 71 72DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \ 73 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \ 74 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \ 75 _df_to_sf _thenan_df _df_to_usi _usi_to_df 76 77# These might cause a divide overflow trap and so are compiled with 78# unwinder info. 79LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4 80 81MACHMODE_H = machmode.h machmode.def 82 83LIB2ADD = $(LIB2FUNCS_EXTRA) 84LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA) 85 86# Additional sources to handle exceptions; overridden on ia64. 87LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c 88 89#----------------------------------------------------------------------- 90# 91# Platform specific bits. 92# When upgrading GCC, get the following defintions from config/<cpu>/t-* 93# 94 95.if ${TARGET_ARCH} == "alpha" 96# from config/alpha/t-alpha 97LIB2FUNCS_EXTRA = qrnnd.asm 98.endif 99 100.if ${TARGET_ARCH} == "arm" 101# from config/arm/t-strongarm-elf 102LIB1ASMSRC = arm/lib1funcs.asm 103LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func 104# We want fine grained libraries, so use the new code to build the 105# floating point emulation libraries. 106XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform 107.endif 108 109.if ${TARGET_ARCH} == "ia64" 110# from config/ia64/t-ia64 111LIB1ASMSRC = ia64/lib1funcs.asm 112LIB1ASMFUNCS = __divtf3 __divdf3 __divsf3 \ 113 __divdi3 __moddi3 __udivdi3 __umoddi3 \ 114 __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ 115 __nonlocal_goto __restore_stack_nonlocal __trampoline 116LIB2ADDEH = unwind-ia64.c unwind-sjlj.c 117.endif 118 119.if ${TARGET_ARCH} == "powerpc" 120# from config/rs6000/t-ppccomm 121LIB2FUNCS_EXTRA = tramp.asm 122# This one can't end up in shared libgcc 123LIB2FUNCS_STATIC_EXTRA = eabi.asm 124# We want fine grained libraries, so use the new code to build the 125# floating point emulation libraries. 126OBJS+= dp-bit.o fp-bit.o 127.endif 128 129.if ${TARGET_ARCH} == "sparc64" 130# from config/sparc/t-elf 131# We want fine grained libraries, so use the new code to build the 132# floating point emulation libraries. 133LIB1ASMSRC = sparc/lb1spc.asm 134LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 135OBJS+= dp-bit.o fp-bit.o 136.endif 137 138dp-bit.o: config/fp-bit.c 139 ${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*} 140 141dp-bit.So: config/fp-bit.c 142 ${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*} 143 144dp-bit.po: config/fp-bit.c 145 ${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*} 146 147fp-bit.o: config/fp-bit.c 148 ${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*} 149 150fp-bit.So: config/fp-bit.c 151 ${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*} 152 153fp-bit.po: config/fp-bit.c 154 ${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*} 155 156#----------------------------------------------------------------------- 157 158# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are 159# defined as optimized assembly code in LIB1ASMFUNCS. 160.if defined(LIB1ASMFUNCS) 161.for sym in ${LIB1ASMFUNCS} 162LIB2FUNCS_1:= ${LIB2FUNCS_1:S/${sym}//g} 163LIB2FUNCS_2:= ${LIB2FUNCS_2:S/${sym}//g} 164LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g} 165.endfor 166.endif 167 168ASM_T= ${LIB1ASMFUNCS:S/$/.o/} 169ASM_P= ${LIB1ASMFUNCS:S/$/.po/} 170ASM_S= ${LIB1ASMFUNCS:S/$/.So/} 171 172SYMS= ${LIB2FUNCS_1} \ 173 ${LIB2FUNCS_2} \ 174 ${LIB2_DIVMOD_FUNCS} 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 187COMMONHDRS= tconfig.h 188SRCS+= ${COMMONHDRS} 189CLEANFILES+= ${COMMONHDRS} 190 191tconfig.h: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile 192 ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET} 193 194${OBJS} beforedepend: ${COMMONHDRS} 195 196${OBJS_T}: libgcc2.c 197 ${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 198 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} 199 @mv ${.TARGET}.tmp ${.TARGET} 200 201.if !defined(NOPIC) 202${OBJS_S}: libgcc2.c 203 ${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 204 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} 205 @mv ${.TARGET}.tmp ${.TARGET} 206.endif 207 208.if !defined(NOPROFILE) 209${OBJS_P}: libgcc2.c 210 ${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 211 @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} 212 @mv ${.TARGET}.tmp ${.TARGET} 213.endif 214 215.if defined(LIB1ASMSRC) 216${ASM_T}: ${LIB1ASMSRC} 217 ${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/config/${LIB1ASMSRC} 218 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} 219 @mv ${.TARGET}.tmp ${.TARGET} 220 221.if !defined(NOPIC) 222${ASM_S}: ${LIB1ASMSRC} 223 ${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/config/${LIB1ASMSRC} 224 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} 225 @mv ${.TARGET}.tmp ${.TARGET} 226.endif 227 228.if !defined(NOPROFILE) 229${ASM_P}: ${LIB1ASMSRC} 230 ${XCC} -x assembler-with-cpp -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${GCCDIR}/config/${LIB1ASMSRC} 231 @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} 232 @mv ${.TARGET}.tmp ${.TARGET} 233.endif 234.endif 235 236.include <bsd.lib.mk> 237