File:  [DragonFly] / src / gnu / lib / gcc3 / libgcc / Attic / Makefile
Revision 1.4: download - view: text, annotated - select for diffs
Mon Mar 22 20:57:36 2004 UTC (11 years, 4 months ago) by dillon
Branches: MAIN
CVS tags: HEAD, DragonFly_Snap29Sep2004, DragonFly_Snap13Sep2004, DragonFly_1_0_REL, DragonFly_1_0_RC1, DragonFly_1_0A_REL
This represents a major update to the buildworld subsystem.

    Compartmentalize the bootstrap/buildtools, the cross-build setup,
    and the world stage.  /usr/obj/usr/src is now far more readable
    (e.g. /usr/obj/usr/src/{btools_i386,ctools_i386_i386,world_i386}).

    Use a completely private command path for the world stage of the build.
    The bootstrap/buildtools stage compiles all required system programs
    (like rm, ln, chmod, etc).   At the moment the build compiles everything
    it needs, but this can be augmented later to 'cp' the required binaries
    into btools_<arch> instead of building them, including potentially copying
    the compiler binaries so the ctools_<arch> build could use a private
    path too).

    The 'buildworld' target now properly removes all object modules for
    all major stages.  Several new targets have been added to reduce
    build times, the most useful of which is 'quickworld', which skips
    the btools and ctools stages (they must have already been built). has been augmented to support .nx binaries and .no object
    modules, which are built using ${NXCC} and friends, which always uses
    the system's native compiler rather then potentially using the
    cross-build compiler, for generating helper programs during the build.
    This way we do not have to special-case building the helper programs in
    an earlier stage as FreeBSD does.

    Fix a bug in 'wmake', which simulates the buildworld environment for
    piecemeal compilation/testing.  It was not using /usr/src/share/mk.

    Add additional .ORDER: constraints to better support make -j N
    (incomplete).  Note that recent changes to the DragonFly scheduler make
    it more likely for buildworld to trip over parallel make races.

    TOOLS_PREFIX was used to generate cross-compiler directory targets
    for exec'd utility binaries and access to libraries and include
    files.  However, in the new compartmentalized breakdown the cross
    compiler's utility binaries will reside in ctools_* while the
    include files and libraries are expected to be installed and accessed
    in world_*.  Add a USRDATA_PREFIX which defaults to TOOLS_PREFIX to
    allow the cross compilation stage to separate the two entities.

# $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.50 2003/07/11 05:29:11 kan Exp $
# $DragonFly: src/gnu/lib/gcc3/libgcc/Makefile,v 1.4 2004/03/22 20:57:36 dillon Exp $

.include "../"
.include "${.CURDIR}/../../../usr.bin/cc3/Makefile.tgt"

.PATH: ${.OBJDIR}/../../../usr.bin/cc3/cc_int
.PATH: ${.CURDIR}/../../../usr.bin/cc3/cc_int
.PATH: ${GCCDIR}/gcc/config/${GCC_CPU} ${GCCDIR}/gcc

# allow to be overridden for the a.out case
.if !defined(LIB) || ${LIB} != "gcc_r"
LIB=	gcc


# We need to install libgcc_pic.a as well, for use by shared libs.

# XXX This is a hack, but it seems to work.
# libgcc2.a is meant to be compiled by *this* version of gcc.
# Normally, this does not make any difference, since we only have gcc, but
# when bootstrapping from gcc-2.6.3, we have to use the freshly built 2.7.2
# compiler for some of the libgcc2.c __attribute__ stuff.
# We now depend on a bootstrap pass (normally in `make world') to build
# and install the new version of gcc before we get here.  This makes
# finding the new version (XCC) easy but may break finding the old version
# (CC).
XCC=	${CC}

CFLAGS+=	-fexceptions
		-I${DFLYH} -I${GCCDIR}/include -I${GCCDIR}/gcc/config \

OBJS=		# added to below in various ways depending on TARGET_ARCH

# When upgrading GCC, get the following defintions straight from

# Library members defined in libgcc2.c.
# Variable length limited to 255 charactes when passed to a shell script.
LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \
    _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
    _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi

LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \
    _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \
    _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \

# Defined in libgcc2.c, included only in the static library.
LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp

FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
    _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
    _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
    _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf

DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
    _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
    _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
    _df_to_sf _thenan_df _df_to_usi _usi_to_df

# These might cause a divide overflow trap and so are compiled with
# unwinder info.
LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4

MACHMODE_H = machmode.h machmode.def


# Additional sources to handle exceptions; overridden on ia64.
LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c unwind-c.c

#	Platform specific bits.
#	When upgrading GCC, get the following defintions from config/<cpu>/t-*

.if ${TARGET_ARCH} == "alpha"
#	from config/alpha/t-alpha
LIB2FUNCS_EXTRA = qrnnd.asm

.if ${TARGET_ARCH} == "arm"
#	from config/arm/t-strongarm-elf
LIB1ASMSRC = lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform

.if ${TARGET_ARCH} == "ia64"
#	from config/ia64/t-ia64
LIB1ASMSRC    = lib1funcs.asm
LIB1ASMFUNCS  = __divtf3 __divdf3 __divsf3 \
	__divdi3 __moddi3 __udivdi3 __umoddi3 \
	__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
	__nonlocal_goto __restore_stack_nonlocal __trampoline
LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c

.if ${TARGET_ARCH} == "powerpc"
#	from config/rs6000/t-ppccomm
LIB2FUNCS_EXTRA = tramp.asm
# This one can't end up in shared libgcc
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
OBJS+=	dp-bit.o fp-bit.o

.if ${TARGET_ARCH} == "sparc64"
#	from config/sparc/t-elf
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
LIB1ASMSRC = lb1spc.asm
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
OBJS+=	dp-bit.o fp-bit.o

dp-bit.o: config/fp-bit.c
	${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}

dp-bit.So: config/fp-bit.c
	${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}

dp-bit.po: config/fp-bit.c
	${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}

fp-bit.o: config/fp-bit.c
	${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}

fp-bit.So: config/fp-bit.c
	${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}

fp-bit.po: config/fp-bit.c
	${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}


# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
# defined as optimized assembly code in LIB1ASMFUNCS.
.if defined(LIB1ASMFUNCS)
.for sym in ${LIB1ASMFUNCS}
LIB2FUNCS_1:=	${LIB2FUNCS_1:S/${sym}//g}
LIB2FUNCS_2:=	${LIB2FUNCS_2:S/${sym}//g}

ASM_P=		${LIB1ASMFUNCS:S/$/.po/}

SYMS=		${LIB2FUNCS_1}		\
		${LIB2FUNCS_2}		\
.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
OBJS+=		${SYMS:S/$/.o/} ${LIB1ASMFUNCS:S/$/.o/}
OBJS_T=		${SYMS:S/$/.o/}  ${SYMS_ST:S/$/.o/}
OBJS_P=		${SYMS:S/$/.po/} ${SYMS_ST:S/$/.po/}
OBJS_S=		${SYMS:S/$/.So/}

.if exists(${CCTOOLS_OBJ})
TCONFIG_H = ${CCTOOLS_OBJ}/tconfig.h
TCONFIG_H = ${CCTOOLS_SRC}/tconfig.h

	cd ${CCTOOLS_SRC} && make tconfig.h

${OBJS} beforedepend: ${TCONFIG_H}

${OBJS_T}: libgcc2.c
	${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}

.if !defined(NOPIC)
${OBJS_S}: libgcc2.c
	${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}

.if !defined(NOPROFILE)
${OBJS_P}: libgcc2.c
	${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}

.if defined(LIB1ASMSRC)
.for _lib1asmsrc in ${LIB1ASMSRC}
${ASM_T}: ${_lib1asmsrc}
	${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
	    -o ${.TARGET} ${.ALLSRC:N*.h}

.if !defined(NOPIC)
${ASM_S}: ${_lib1asmsrc}
	${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
	    -o ${.TARGET} ${.ALLSRC:N*.h}

.if !defined(NOPROFILE)
${ASM_P}: ${_lib1asmsrc}
	${XCC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
	    -o ${.TARGET} ${.ALLSRC:N*.h}

.include <>