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