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