#	$Id: bld-one,v 1.11 2002/11/12 22:03:23 mrustad Exp $
# Build one thing, configure, make and install
#
# Arg 1 = directory of thing to build

echo bld-one: arg1=$1, confopt=${confopt[@]}, makeopt=${makeopt[@]}
echo bld-one: confopt=$confopt, makeopt=$makeopt

rm -rf build-${1%%-*}
rm -rf conf-${1%%-*}.out make-${1%%-*}.out inst-${1%%-*}.out
mkdir -p build-${1%%-*}
cd build-${1%%-*}

../${1}/configure --target=${target} \
	--prefix=${prefix} \
	--program-prefix=${targetcpuarch}- \
	--enable-multilib \
	--with-headers=${headers} \
	"${confopt[@]}" \
	--with-gcc --with-gnu-as --with-gnu-ld \
	--disable-shared \
	| tee ../conf-${1%%-*}.out

if test "${PIPESTATUS[0]}" != "0" ; then
	echo +=+=+= ${1} not configured +=+=+=+=
	exit 1
fi

echo +=+=+= ${1} configured +=+=+=+=

make "${makeopt[@]}" | tee ../make-${1%%-*}.out

if test "${PIPESTATUS[0]}" != "0" ; then
	echo +=+=+= ${1} not made +=+=+=
	exit 1
fi

echo +=+=+= ${1} made +=+=+=+

make install | tee ../inst-${1%%-*}.out

if test "${PIPESTATUS[0]}" != "0" ; then
	echo +=+=+= ${1} not installed +=+=+=
	exit 1
fi

echo =+=+=+= ${1} installed =+=+=+

cd ..

# End of bld-one
