#!/bin/sh

host=i386-lucent-plan9
build=$host

CC_FOR_BUILD=gcc
CXX_FOR_BUILD=gcc

CC=$host-gcc
AR=$host-ar
RANLIB=$host-ranlib
AS=$host-as

CC_FOR_TARGET=$host-gcc
GCC_FOR_TARGET=$host-gcc
CXX_FOR_TARGET=$host-gcc

AS_FOR_TARGET=$host-as
LD_FOR_TARGET=$host-ld
NM_FOR_TARGET=$host-nm
AR_FOR_TARGET=$host-ar
RANLIB_FOR_TARGET=$host-ranlib
export CC_FOR_BUILD CXX_FOR_BUILD CC AR RANLIB AS

rm config.cache; CC="$CC" AR="$AR" RANLIB="$RANLIB" AS="$AS" ./configure --prefix=$HOME/gnu2 --host=$host --target=$host --build=$build --enable-languages="c,c++"

gmake -w \
	CC_FOR_BUILD="$CC_FOR_BUILD" \
	CXX_FOR_BUILD="$CXX_FOR_BUILD" \
	CC="$CC" \
	AR="$AR" \
	RANLIB="$RANLIB" \
	AS="$AS" \
	CC_FOR_TARGET="$CC_FOR_TARGET" \
	GCC_FOR_TARGET="$GCC_FOR_TARGET" \
	CXX_FOR_TARGET="$CXX_FOR_TARGET" \
	AS_FOR_TARGET="$AS_FOR_TARGET" \
	LD_FOR_TARGET="$LD_FOR_TARGET" \
	NM_FOR_TARGET="$NM_FOR_TARGET" \
	AR_FOR_TARGET="$AR_FOR_TARGET" \
	RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET"
