#!/bin/sh

top_srcdir=$PWD
BUILD_ROOT=${top_srcdir}/BUILD_ROOT

rm -fR $BUILD_ROOT
mkdir -p $BUILD_ROOT

pushd $BUILD_ROOT

INSTALL_ROOT=$BUILD_ROOT/INSTALL_ROOT

CFLAGS="-g -ggdb3"

if test ! -f $top_srcdir/configure -o ! -d $top_srcdir/config; then
    $top_srcdir/autogen.sh \
	--prefix=$INSTALL_ROOT \
	$@
fi &&

$top_srcdir/configure \
	--prefix=$INSTALL_ROOT \
	$@ \
&&

if [ -z "$CFLAGS" ]; then
    make -s -j4
else
    make -s -j4 CFLAGS="$CFLAGS"
fi &&

make install

popd
