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