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 (10 years, 7 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).

    sys.mk 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.

    1: # $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.50 2003/07/11 05:29:11 kan Exp $
    2: # $DragonFly: src/gnu/lib/gcc3/libgcc/Makefile,v 1.4 2004/03/22 20:57:36 dillon Exp $
    3: 
    4: .include "../Makefile.inc"
    5: .include "${.CURDIR}/../../../usr.bin/cc3/Makefile.tgt"
    6: 
    7: .PATH: ${.OBJDIR}/../../../usr.bin/cc3/cc_int
    8: .PATH: ${.CURDIR}/../../../usr.bin/cc3/cc_int
    9: .PATH: ${GCCDIR}/gcc/config/${GCC_CPU} ${GCCDIR}/gcc
   10: 
   11: # allow to be overridden for the a.out case
   12: .if !defined(LIB) || ${LIB} != "gcc_r"
   13: LIB=	gcc
   14: .endif
   15: 
   16: #SHLIB_MAJOR=	1
   17: 
   18: # We need to install libgcc_pic.a as well, for use by shared libs.
   19: INSTALL_PIC_ARCHIVE=    yes     
   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: #
   34: XCC=	${CC}
   35: XCXX=	${CXX}
   36: 
   37: CFLAGS+=	-fexceptions
   38: CFLAGS+=	-DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
   39: 		-DFINE_GRAINED_LIBRARIES
   40: CFLAGS+=	-D_PTHREADS -DGTHREAD_USE_WEAK
   41: CFLAGS+=	-I. -I${CCTOOLS_SRC} -I${CCTOOLS_OBJ} \
   42: 		-I${DFLYH} -I${GCCDIR}/include -I${GCCDIR}/gcc/config \
   43: 		-I${GCCDIR}/gcc
   44: 
   45: OBJS=		# added to below in various ways depending on TARGET_ARCH
   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.
   54: LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \
   55:     _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
   56:     _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
   57: 
   58: LIB2FUNCS_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:     _stack_smash_handler
   62: 
   63: # Defined in libgcc2.c, included only in the static library.
   64: LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp
   65: 
   66: FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
   67:     _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
   68:     _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
   69:     _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf
   70: 
   71: DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
   72:     _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
   73:     _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
   74:     _df_to_sf _thenan_df _df_to_usi _usi_to_df
   75: 
   76: # These might cause a divide overflow trap and so are compiled with
   77: # unwinder info.
   78: LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
   79: 
   80: MACHMODE_H = machmode.h machmode.def
   81: 
   82: LIB2ADD = $(LIB2FUNCS_EXTRA)
   83: LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
   84: 
   85: # Additional sources to handle exceptions; overridden on ia64.
   86: LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c unwind-c.c
   87: 
   88: #-----------------------------------------------------------------------
   89: #
   90: #	Platform specific bits.
   91: #	When upgrading GCC, get the following defintions from config/<cpu>/t-*
   92: #
   93: 
   94: .if ${TARGET_ARCH} == "alpha"
   95: #	from config/alpha/t-alpha
   96: LIB2FUNCS_EXTRA = qrnnd.asm
   97: .endif
   98: 
   99: .if ${TARGET_ARCH} == "arm"
  100: #	from config/arm/t-strongarm-elf
  101: LIB1ASMSRC = lib1funcs.asm
  102: LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
  103: # We want fine grained libraries, so use the new code to build the
  104: # floating point emulation libraries.
  105: XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform
  106: .endif
  107: 
  108: .if ${TARGET_ARCH} == "ia64"
  109: #	from config/ia64/t-ia64
  110: LIB1ASMSRC    = lib1funcs.asm
  111: LIB1ASMFUNCS  = __divtf3 __divdf3 __divsf3 \
  112: 	__divdi3 __moddi3 __udivdi3 __umoddi3 \
  113: 	__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
  114: 	__nonlocal_goto __restore_stack_nonlocal __trampoline
  115: LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c
  116: .endif
  117: 
  118: .if ${TARGET_ARCH} == "powerpc"
  119: #	from config/rs6000/t-ppccomm
  120: LIB2FUNCS_EXTRA = tramp.asm
  121: # This one can't end up in shared libgcc
  122: LIB2FUNCS_STATIC_EXTRA = eabi.asm
  123: # We want fine grained libraries, so use the new code to build the
  124: # floating point emulation libraries.
  125: OBJS+=	dp-bit.o fp-bit.o
  126: .endif
  127: 
  128: .if ${TARGET_ARCH} == "sparc64"
  129: #	from config/sparc/t-elf
  130: # We want fine grained libraries, so use the new code to build the
  131: # floating point emulation libraries.
  132: LIB1ASMSRC = lb1spc.asm
  133: LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
  134: OBJS+=	dp-bit.o fp-bit.o
  135: .endif
  136: 
  137: dp-bit.o: config/fp-bit.c
  138: 	${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  139: 
  140: dp-bit.So: config/fp-bit.c
  141: 	${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  142: 
  143: dp-bit.po: config/fp-bit.c
  144: 	${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  145: 
  146: fp-bit.o: config/fp-bit.c
  147: 	${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  148: 
  149: fp-bit.So: config/fp-bit.c
  150: 	${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  151: 
  152: fp-bit.po: config/fp-bit.c
  153: 	${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  154: 
  155: #-----------------------------------------------------------------------
  156: 
  157: # Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
  158: # defined as optimized assembly code in LIB1ASMFUNCS.
  159: .if defined(LIB1ASMFUNCS)
  160: .for sym in ${LIB1ASMFUNCS}
  161: LIB2FUNCS_1:=	${LIB2FUNCS_1:S/${sym}//g}
  162: LIB2FUNCS_2:=	${LIB2FUNCS_2:S/${sym}//g}
  163: LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
  164: .endfor
  165: .endif
  166: 
  167: ASM_T=		${LIB1ASMFUNCS:S/$/.o/}
  168: ASM_P=		${LIB1ASMFUNCS:S/$/.po/}
  169: ASM_S=		${LIB1ASMFUNCS:S/$/.So/}
  170: 
  171: SYMS=		${LIB2FUNCS_1}		\
  172: 		${LIB2FUNCS_2}		\
  173: 		${LIB2_DIVMOD_FUNCS}	\
  174: 		${LIB2ADDEH}
  175: .if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
  176: SYMS+=		${FPBIT_FUNCS} ${DPBIT_FUNCS}
  177: .endif
  178: SYMS_ST=	${LIB2FUNCS_ST}		\
  179: 		${LIB2ADD_ST}
  180: OBJS+=		${SYMS:S/$/.o/} ${LIB1ASMFUNCS:S/$/.o/}
  181: OBJS_T=		${SYMS:S/$/.o/}  ${SYMS_ST:S/$/.o/}
  182: OBJS_P=		${SYMS:S/$/.po/} ${SYMS_ST:S/$/.po/}
  183: OBJS_S=		${SYMS:S/$/.So/}
  184: STATICOBJS=	${SYMS_ST:S/$/.o/}
  185: SRCS=		${LIB2ADD} ${LIB2ADDEH}
  186: 
  187: .if exists(${CCTOOLS_OBJ})
  188: TCONFIG_H = ${CCTOOLS_OBJ}/tconfig.h
  189: .else
  190: TCONFIG_H = ${CCTOOLS_SRC}/tconfig.h
  191: .endif
  192: 
  193: ${TCONFIG_H}: ${CCTOOLS_SRC}/Makefile
  194: 	cd ${CCTOOLS_SRC} && make tconfig.h
  195: 
  196: ${OBJS} beforedepend: ${TCONFIG_H}
  197: 
  198: ${OBJS_T}: libgcc2.c
  199: 	${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
  200: 
  201: .if !defined(NOPIC)
  202: ${OBJS_S}: libgcc2.c
  203: 	${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
  204: .endif
  205: 
  206: .if !defined(NOPROFILE)
  207: ${OBJS_P}: libgcc2.c
  208: 	${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
  209: .endif
  210: 
  211: .if defined(LIB1ASMSRC)
  212: .for _lib1asmsrc in ${LIB1ASMSRC}
  213: ${ASM_T}: ${_lib1asmsrc}
  214: 	${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
  215: 	    -o ${.TARGET} ${.ALLSRC:N*.h}
  216: 
  217: .if !defined(NOPIC)
  218: ${ASM_S}: ${_lib1asmsrc}
  219: 	${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
  220: 	    -o ${.TARGET} ${.ALLSRC:N*.h}
  221: .endif
  222: 
  223: .if !defined(NOPROFILE)
  224: ${ASM_P}: ${_lib1asmsrc}
  225: 	${XCC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
  226: 	    -o ${.TARGET} ${.ALLSRC:N*.h}
  227: .endif
  228: .endfor
  229: .endif
  230: 
  231: .include <bsd.lib.mk>