Makefile revision 270484
164562Sgshapiro# $FreeBSD: stable/10/gnu/lib/libgcc/Makefile 270484 2014-08-24 14:25:44Z des $
2261363Sgshapiro
364562SgshapiroGCCDIR=	${.CURDIR}/../../../contrib/gcc
464562SgshapiroGCCLIB=	${.CURDIR}/../../../contrib/gcclibs
564562Sgshapiro
664562SgshapiroSHLIB_NAME=	libgcc_s.so.1
764562SgshapiroSHLIBDIR?=	/lib
864562Sgshapiro
964562Sgshapiro.include <bsd.own.mk>
1064562Sgshapiro#
1164562Sgshapiro# libgcc is linked in last and thus cannot depend on ssp symbols coming
1264562Sgshapiro# from earlier libraries. Disable stack protection for this library.
1364562Sgshapiro#
1490792SgshapiroMK_SSP=	no
1590792Sgshapiro
1690792Sgshapiro.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
17261363Sgshapiro
1864562Sgshapiro.if ${TARGET_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no"
1964562SgshapiroCFLAGS+=	-DTARGET_ARM_EABI
2064562Sgshapiro.endif
2190792Sgshapiro
2264562Sgshapiro.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR}
23266692Sgshapiro
2464562SgshapiroCFLAGS+=	-DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
2577349Sgshapiro		-DHAVE_GTHR_DEFAULT \
2664562Sgshapiro		-I${GCCLIB}/include \
2764562Sgshapiro		-I${GCCDIR}/config -I${GCCDIR} -I. \
2864562Sgshapiro		-I${.CURDIR}/../../usr.bin/cc/cc_tools
2964562Sgshapiro
3064562SgshapiroLDFLAGS+=	-nodefaultlibs
3164562SgshapiroLDADD+=		-lc
3264562Sgshapiro
3364562SgshapiroOBJS=		# added to below in various ways depending on TARGET_CPUARCH
3490792Sgshapiro
3564562Sgshapiro#---------------------------------------------------------------------------
3690792Sgshapiro#
3790792Sgshapiro# Library members defined in libgcc2.c.
3864562Sgshapiro# When upgrading GCC, obtain the following list from mklibgcc.in
3990792Sgshapiro#
4064562SgshapiroLIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \
4164562Sgshapiro	_cmpdi2 _ucmpdi2 \
4264562Sgshapiro	_enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \
4364562Sgshapiro	_addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
4464562Sgshapiro	_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \
4564562Sgshapiro	_popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \
4664562Sgshapiro	_powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 \
4764562Sgshapiro	_divxc3 _divtc3 _bswapsi2 _bswapdi2
4864562Sgshapiro.if ${COMPILER_TYPE} != "clang" || ${TARGET_CPUARCH} != "arm"
49173340SgshapiroLIB2FUNCS+= _clear_cache
5064562Sgshapiro.endif
5164562Sgshapiro
5290792Sgshapiro# The floating-point conversion routines that involve a single-word integer.
5364562Sgshapiro.for mode in sf df xf
5464562SgshapiroLIB2FUNCS+= _fixuns${mode}si
5564562Sgshapiro.endfor
56168515Sgshapiro
57168515Sgshapiro# Likewise double-word routines.
58168515Sgshapiro.if ${TARGET_CPUARCH} != "arm" || ${MK_ARM_EABI} == "no"
59168515Sgshapiro# These are implemented in an ARM specific file but will not be filtered out
60168515Sgshapiro.for mode in sf df xf tf
61168515SgshapiroLIB2FUNCS+= _fix${mode}di _fixuns${mode}di
62168515SgshapiroLIB2FUNCS+= _floatdi${mode} _floatundi${mode}
63168515Sgshapiro.endfor
64168515Sgshapiro.endif
65168515Sgshapiro
6664562SgshapiroLIB2ADD = $(LIB2FUNCS_EXTRA)
6764562SgshapiroLIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
6864562Sgshapiro
6964562Sgshapiro# Additional sources to handle exceptions; overridden by targets as needed.
7064562SgshapiroLIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c gthr-gnat.c \
7164562Sgshapiro	unwind-c.c
7264562SgshapiroLIB2ADDEHSTATIC = $(LIB2ADDEH)
7364562SgshapiroLIB2ADDEHSHARED = $(LIB2ADDEH)
7464562Sgshapiro
7564562Sgshapiro# List of extra C and assembler files to add to static and shared libgcc2.
7664562Sgshapiro# Assembler files should have names ending in `.asm'.
7764562SgshapiroLIB2FUNCS_EXTRA =
7864562Sgshapiro
7964562Sgshapiro# List of extra C and assembler files to add to static libgcc2.
8064562Sgshapiro# Assembler files should have names ending in `.asm'.
8164562SgshapiroLIB2FUNCS_STATIC_EXTRA =
8264562Sgshapiro
8364562Sgshapiro# Defined in libgcc2.c, included only in the static library.
8464562Sgshapiro# KAN: Excluded _sf_to_tf and _df_to_tf as TPBIT_FUNCS are not
8564562Sgshapiro# built on any of our platforms.
8664562SgshapiroLIB2FUNCS_ST = _eprintf __gcc_bcmp
8764562Sgshapiro
8864562SgshapiroFPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
8964562Sgshapiro    _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
9064562Sgshapiro    _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
91141858Sgshapiro    _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf
9264562Sgshapiro
9390792SgshapiroDPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
9490792Sgshapiro    _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
9590792Sgshapiro    _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
9690792Sgshapiro    _df_to_sf _thenan_df _df_to_usi _usi_to_df
9790792Sgshapiro
9864562SgshapiroTPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
9990792Sgshapiro    _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
10090792Sgshapiro    _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
10190792Sgshapiro    _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
10290792Sgshapiro
10390792Sgshapiro# These might cause a divide overflow trap and so are compiled with
10490792Sgshapiro# unwinder info.
10590792SgshapiroLIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
10690792Sgshapiro
10790792Sgshapiro#-----------------------------------------------------------------------
10890792Sgshapiro#
10990792Sgshapiro#	Platform specific bits.
11066494Sgshapiro#	When upgrading GCC, get the following definitions from config/<cpu>/t-*
11190792Sgshapiro#
11266494Sgshapiro.if ${TARGET_CPUARCH} == "arm"
11366494Sgshapiro#	from config/arm/t-strongarm-elf
114141858SgshapiroCFLAGS+=	-Dinhibit_libc -fno-inline
115141858SgshapiroCFLAGS.clang+=	-fheinous-gnu-extensions
116141858Sgshapiro
117141858SgshapiroLIB1ASMSRC =	lib1funcs.asm
118141858SgshapiroLIB1ASMFUNCS =  _dvmd_tls _bb_init_func
119141858Sgshapiro.if ${MK_ARM_EABI} != "no"
120141858SgshapiroLIB2ADDEH =	unwind-arm.c libunwind.S pr-support.c unwind-c.c
121141858Sgshapiro# Some compilers generate __aeabi_ functions libgcc_s is missing
122141858SgshapiroDPADD+=		${LIBGCC}
12390792SgshapiroLDADD+=		-lgcc
12477349Sgshapiro.else
125141858SgshapiroLIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
126141858Sgshapiro.endif
127141858Sgshapiro.endif
128141858Sgshapiro
129141858Sgshapiro.if ${TARGET_CPUARCH} == mips
130141858SgshapiroLIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
131141858Sgshapiro# ABIs other than o32 need this
132141858Sgshapiro.if ${TARGET_ARCH} != "mips" && ${TARGET_ARCH} != "mipsel"
133141858SgshapiroLIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
134141858SgshapiroLIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
13590792SgshapiroLIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c
13690792SgshapiroLIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c
13764562Sgshapiro.endif
13864562Sgshapiro.endif
13964562Sgshapiro
14064562Sgshapiro.if ${TARGET_CPUARCH} == "ia64"
14164562Sgshapiro#	from config/ia64/t-ia64
14298121SgshapiroLIB1ASMSRC   = lib1funcs.asm
14398121SgshapiroLIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \
14490792Sgshapiro	__divdi3 __moddi3 __udivdi3 __umoddi3 \
14598121Sgshapiro	__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
14664562Sgshapiro	__nonlocal_goto __restore_stack_nonlocal __trampoline \
14764562Sgshapiro	_fixtfdi _fixunstfdi _floatditf
14864562SgshapiroLIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c
14966494Sgshapiro.endif
15064562Sgshapiro
15164562Sgshapiro.if ${TARGET_ARCH} == "powerpc"
15264562Sgshapiro#	from config/rs6000/t-ppccomm
15377349SgshapiroLIB2FUNCS_EXTRA = tramp.asm
15477349SgshapiroLIB2FUNCS_STATIC_EXTRA = eabi.asm
15590792Sgshapiro.endif
156203004Sgshapiro
15790792Sgshapiro.if ${TARGET_ARCH} == "powerpc64"
15864562Sgshapiro#	from config/rs6000/t-ppccomm
15964562SgshapiroLIB2FUNCS_EXTRA = tramp.asm
16064562Sgshapiro.endif
16164562Sgshapiro
16264562Sgshapiro.if ${TARGET_CPUARCH} == "sparc64"
16364562Sgshapiro#	from config/sparc/t-elf
16464562SgshapiroLIB1ASMSRC =   lb1spc.asm
16564562SgshapiroLIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
16664562Sgshapiro.endif
16764562Sgshapiro
16864562Sgshapiro#-----------------------------------------------------------------------
16964562Sgshapiro
17064562Sgshapiro# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
17164562Sgshapiro# defined as optimized assembly code in LIB1ASMFUNCS.
17290792Sgshapiro.if defined(LIB1ASMFUNCS)
17364562Sgshapiro.for sym in ${LIB1ASMFUNCS}
17464562SgshapiroLIB2FUNCS:=	${LIB2FUNCS:S/${sym}//g}
17590792SgshapiroLIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
17690792Sgshapiro.endfor
17764562Sgshapiro.endif
17864562Sgshapiro
17977349SgshapiroCOMMONHDRS=	tm.h tconfig.h options.h unwind.h gthr-default.h
18064562Sgshapiro
18177349Sgshapiro#-----------------------------------------------------------------------
18264562Sgshapiro#
18377349Sgshapiro# Helpful shortcuts for compiler invocations.
18464562Sgshapiro#
18564562SgshapiroHIDE =  -fvisibility=hidden -DHIDE_EXPORTS
18698121SgshapiroCC_T =	${CC} -c ${CFLAGS} ${HIDE} -fPIC
18790792SgshapiroCC_P =	${CC} -c ${CFLAGS} ${HIDE} -p -fPIC
18864562SgshapiroCC_S =	${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED
18964562Sgshapiro
19064562Sgshapiro#-----------------------------------------------------------------------
19164562Sgshapiro#
19298121Sgshapiro# Functions from libgcc2.c
19390792Sgshapiro#
19464562SgshapiroSTD_CFLAGS =
19564562SgshapiroDIV_CFLAGS =	-fexceptions -fnon-call-exceptions
19664562Sgshapiro
19764562SgshapiroSTD_FUNCS =	${LIB2FUNCS}
19864562SgshapiroDIV_FUNCS =	${LIB2_DIVMOD_FUNCS}
19964562Sgshapiro
20090792SgshapiroSTD_CFILE =	libgcc2.c
20164562SgshapiroDIV_CFILE =	libgcc2.c
20264562Sgshapiro
20364562SgshapiroOBJ_GRPS =	STD DIV
20464562Sgshapiro
20564562Sgshapiro#-----------------------------------------------------------------------
20664562Sgshapiro#
20764562Sgshapiro# Floating point emulation functions
20864562Sgshapiro#
20964562Sgshapiro.if ${TARGET_CPUARCH} == "armNOT_YET" || \
21064562Sgshapiro    ${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "sparc64"
21190792Sgshapiro
21290792SgshapiroFPBIT_CFLAGS =	-DFINE_GRAINED_LIBRARIES -DFLOAT
21390792SgshapiroDPBIT_CFLAGS =	-DFINE_GRAINED_LIBRARIES
21490792Sgshapiro
21577349SgshapiroFPBIT_CFILE =	config/fp-bit.c
21690792SgshapiroDPBIT_CFILE =	config/fp-bit.c
21764562Sgshapiro
21864562SgshapiroOBJ_GRPS +=	FPBIT DPBIT
21964562Sgshapiro.endif
22064562Sgshapiro
22164562Sgshapiro#-----------------------------------------------------------------------
22264562Sgshapiro#
22364562Sgshapiro# Generic build rules for object groups defined above
22464562Sgshapiro#
22598121Sgshapiro.for T in ${OBJ_GRPS}
22664562Sgshapiro${T}_OBJS_T =	${${T}_FUNCS:S/$/.o/}
22764562Sgshapiro${T}_OBJS_P =	${${T}_FUNCS:S/$/.po/}
22898121Sgshapiro${T}_OBJS_S =	${${T}_FUNCS:S/$/.So/}
22998121SgshapiroOBJS +=		${${T}_FUNCS:S/$/.o/}
23098121Sgshapiro
23198121Sgshapiro${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS}
23264562Sgshapiro	${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
23398121Sgshapiro${${T}_OBJS_P}: ${${T}_CFILE} ${COMMONHDRS}
23464562Sgshapiro	${CC_P} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
23564562Sgshapiro${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHDRS}
23664562Sgshapiro	${CC_S} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
23764562Sgshapiro.endfor
23864562Sgshapiro
23964562Sgshapiro#-----------------------------------------------------------------------
24090792Sgshapiro#
24190792Sgshapiro# Extra objects coming from separate files
24290792Sgshapiro#
24390792Sgshapiro.if !empty(LIB2ADD)
24464562SgshapiroOBJS  +=	${LIB2ADD:R:S/$/.o/}
24564562SgshapiroSOBJS +=	${LIB2ADD:R:S/$/.So/}
24664562SgshapiroPOBJS +=	${LIB2ADD:R:S/$/.po/}
24764562Sgshapiro.endif
24864562Sgshapiro
24964562Sgshapiro#-----------------------------------------------------------------------
25064562Sgshapiro#
25164562Sgshapiro# Objects that should be in static library only.
25264562Sgshapiro#
25364562SgshapiroSYMS_ST =	${LIB2FUNCS_ST}	${LIB2ADD_ST}
25464562SgshapiroSTAT_OBJS_T = 	${SYMS_ST:S/$/.o/}
25564562SgshapiroSTAT_OBJS_P = 	${SYMS_ST:S/$/.po/}
25690792SgshapiroSTATICOBJS  =	${SYMS_ST:S/$/.o/}
25764562Sgshapiro
25864562Sgshapiro${STAT_OBJS_T}:	${STD_CFILE} ${COMMONHDRS}
25964562Sgshapiro	${CC_T} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
26064562Sgshapiro${STAT_OBJS_P}:	${STD_CFILE} ${COMMONHDRS}
26164562Sgshapiro	${CC_P} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
26277349Sgshapiro
26390792Sgshapiro#-----------------------------------------------------------------------
26477349Sgshapiro#
26577349Sgshapiro# Assembler files.
26664562Sgshapiro#
26790792Sgshapiro.if defined(LIB1ASMSRC)
26864562SgshapiroASM_T =		${LIB1ASMFUNCS:S/$/.o/}
26964562SgshapiroASM_P =		${LIB1ASMFUNCS:S/$/.po/}
27064562SgshapiroASM_S =		${LIB1ASMFUNCS:S/$/.So/}
27190792SgshapiroASM_V =		${LIB1ASMFUNCS:S/$/.vis/}
27264562SgshapiroOBJS +=		${LIB1ASMFUNCS:S/$/.o/}
27364562Sgshapiro
27464562Sgshapiro${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis
27564562Sgshapiro	${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
27664562Sgshapiro	    -o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis}
27764562Sgshapiro${ASM_P}: ${LIB1ASMSRC} ${.PREFIX}.vis
27864562Sgshapiro	${CC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
27964562Sgshapiro	    -o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis}
28064562Sgshapiro${ASM_S}: ${LIB1ASMSRC}
28164562Sgshapiro	${CC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
28264562Sgshapiro	    -o ${.TARGET} ${.ALLSRC:N*.h}
28364562Sgshapiro${ASM_V}: ${LIB1ASMSRC}
28464562Sgshapiro	${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
28564562Sgshapiro	    -o ${.PREFIX}.vo ${.ALLSRC:N*.h}
28664562Sgshapiro	( ${NM} -pg ${.PREFIX}.vo | \
28766494Sgshapiro		awk 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t.hidden ", $$3 }'\
28864562Sgshapiro	) > ${.TARGET}
28964562Sgshapiro
29064562SgshapiroCLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo/}
29164562Sgshapiro.endif
29264562Sgshapiro
29364562Sgshapiro#-----------------------------------------------------------------------
29498121Sgshapiro#
29564562Sgshapiro# Exception handling / unwinding support.
29664562Sgshapiro#
29764562SgshapiroEH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/}
29864562SgshapiroEH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/}
29964562SgshapiroEH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/}
30066494SgshapiroEH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN
30164562SgshapiroSOBJS    += ${EH_OBJS_S}
302203004Sgshapiro
30377349Sgshapiro.for _src in ${LIB2ADDEHSTATIC}
30477349Sgshapiro${_src:R:S/$/.o/}: ${_src} ${COMMONHDRS}
30590792Sgshapiro	${CC_T} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC}
30690792Sgshapiro${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS}
30777349Sgshapiro	${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC}
30877349Sgshapiro.endfor
30990792Sgshapiro.for _src in ${LIB2ADDEHSHARED}
31090792Sgshapiro${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS}
31177349Sgshapiro	${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC}
31277349Sgshapiro.endfor
31377349Sgshapiro
31464562Sgshapiro
31577349Sgshapiro#-----------------------------------------------------------------------
31677349Sgshapiro#
317203004Sgshapiro# Generated headers
31877349Sgshapiro#
31977349Sgshapiro${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile
32077349Sgshapiro	${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
32177349Sgshapiro
32277349SgshapiroCLEANFILES += ${COMMONHDRS}
32377349SgshapiroCLEANFILES += cs-*.h option*
32477349Sgshapiro
32577349Sgshapiro#-----------------------------------------------------------------------
32690792Sgshapiro#
32777349Sgshapiro# Build symbol version map
32877349Sgshapiro#
32977349SgshapiroSHLIB_MKMAP      = ${GCCDIR}/mkmap-symver.awk
33064562SgshapiroSHLIB_MKMAP_OPTS =
33190792SgshapiroSHLIB_MAPFILES   = ${GCCDIR}/libgcc-std.ver
33290792Sgshapiro.if ${TARGET_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no"
33390792SgshapiroSHLIB_MAPFILES  += ${GCCDIR}/config/arm/libgcc-bpabi.ver
33490792Sgshapiro.endif
33594334SgshapiroVERSION_MAP      = libgcc.map
33690792Sgshapiro
33790792Sgshapirolibgcc.map: ${SHLIB_MKMAP} ${SHLIB_MAPFILES} ${SOBJS} ${OBJS:R:S/$/.So/}
33890792Sgshapiro	(  ${NM} -pg ${SOBJS};echo %% ; \
33990792Sgshapiro	  cat ${SHLIB_MAPFILES} \
34090792Sgshapiro	    | sed -e '/^[   ]*#/d' \
34177349Sgshapiro	          -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
34290792Sgshapiro	    | ${CC} ${CFLAGS} -E -xassembler-with-cpp -; \
34390792Sgshapiro	) | awk -f ${SHLIB_MKMAP} ${SHLIB_MKMAP_OPTS} > ${.TARGET}
34490792Sgshapiro
34590792SgshapiroCLEANFILES +=	libgcc.map
34690792Sgshapiro
347141858Sgshapiro#-----------------------------------------------------------------------
34890792Sgshapiro#
34990792Sgshapiro# Build additional static libgcc_eh[_p].a libraries.
35090792Sgshapiro#
35190792Sgshapirolibgcc_eh.a:	${EH_OBJS_T}
35290792Sgshapiro	@${ECHO} building static gcc_eh library
35390792Sgshapiro	@rm -f ${.TARGET}
35490792Sgshapiro	@${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q`
35590792Sgshapiro	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
35690792Sgshapiro
35790792Sgshapiroall:	libgcc_eh.a
35890792Sgshapiro
35990792Sgshapiro.if ${MK_PROFILE} != "no"
36090792Sgshapirolibgcc_eh_p.a:	${EH_OBJS_P}
361203004Sgshapiro	@${ECHO} building profiled gcc_eh library
36290792Sgshapiro	@rm -f ${.TARGET}
36390792Sgshapiro	@${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q`
36490792Sgshapiro	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
36590792Sgshapiroall:	libgcc_eh_p.a
36690792Sgshapiro.endif
36777349Sgshapiro
36877349Sgshapiro_libinstall: _lib-eh-install
36990792Sgshapiro
37090792Sgshapiro_lib-eh-install:
37190792Sgshapiro.if ${MK_INSTALLLIB} != "no"
37277349Sgshapiro	${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
37364562Sgshapiro		${_INSTALLFLAGS} libgcc_eh.a ${DESTDIR}${LIBDIR}
374203004Sgshapiro.endif
375203004Sgshapiro.if ${MK_PROFILE} != "no"
376203004Sgshapiro	${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
377203004Sgshapiro		${_INSTALLFLAGS} libgcc_eh_p.a ${DESTDIR}${LIBDIR}
378203004Sgshapiro.endif
379203004Sgshapiro
38064562SgshapiroCLEANFILES+=	libgcc_eh.a libgcc_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P}
38177349Sgshapiro
38277349Sgshapiro.include <bsd.lib.mk>
38377349Sgshapiro
38477349Sgshapiro.SUFFIXES: .vis .vo
38577349Sgshapiro