#!/bin/sh

. config/options

$SCRIPTS/install ccache
$SCRIPTS/build binutils
$SCRIPTS/build gmp
$SCRIPTS/build mpfr
$SCRIPTS/build mpc
$SCRIPTS/build ppl
$SCRIPTS/build cloog-ppl
$SCRIPTS/build libelf
$SCRIPTS/unpack gcc

setup_toolchain host

cd $BUILD/gcc*
mkdir -p objdir-$1
cd objdir-$1
LDFLAGS="-Wl,-rpath,$ROOT/$TOOLCHAIN/lib" \
../configure --host=$HOST_NAME \
             --build=$HOST_NAME \
             --target=$TARGET_NAME \
             --prefix=$ROOT/$TOOLCHAIN \
             --with-sysroot=$SYSROOT_PREFIX \
             --with-gmp=$ROOT/$TOOLCHAIN \
             --with-mpfr=$ROOT/$TOOLCHAIN \
             --with-mpc=$ROOT/$TOOLCHAIN \
             --with-ppl=$ROOT/$TOOLCHAIN \
             --with-cloog=$ROOT/$TOOLCHAIN \
             --with-libelf=$ROOT/$TOOLCHAIN \
             --enable-languages=c \
             --disable-__cxa_atexit \
             --disable-libada \
             --disable-libmudflap \
             --disable-libssp \
             --disable-libgomp \
             --disable-shared \
             --disable-multilib \
             --disable-threads \
             --without-headers \
             --with-newlib \
             --disable-decimal-float \
             --disable-nls

make all-gcc all-target-libgcc
make install-gcc install-target-libgcc

