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