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