#! /bin/sh
#
# Author      : Olivier.Sirol@lip6.fr
# Date        : dec 1998
# Description : builds alliance distrib 
# Usage       : 
#
# (C) Czo 1998,99
# This code is released under GPL
# $Id: build,v 1.10 2000/01/27 17:40:00 czo Exp $
#

MYDIR=`pwd`

cd ../share/etc

echo "Configuring..."
./configure
if [ $? -ne 0 ] ; then echo "Error, exiting" ; exit 4 ; fi

echo "Sourcing env..."
. ./alc_env.sh
if [ $? -ne 0 ] ; then echo "Error, exiting" ; exit 4 ; fi

cd "$MYDIR"

echo "Making links..."
./mklinks "$ALLIANCE_OS"
if [ $? -ne 0 ] ; then echo "Error, exiting" ; exit 4 ; fi

echo "Compiling..."
make "ALLIANCE_INSTALL_DIR=$ALLIANCE_TOP"

if [ $? -ne 0 ]
then 
        echo "Errors have occured, please run:"
        echo ". $ALLIANCE_TOP/etc/alc_env.sh"
        echo "or"
        echo "source $ALLIANCE_TOP/etc/alc_env.csh"
        echo "cd $MYDIR"
        echo "make ALLIANCE_INSTALL_DIR=$ALLIANCE_TOP" 
        exit 4
else
        echo "done..."
        echo "Remember to link $ALLIANCE_TOP/etc/alc_env.{c}sh to /etc/profile.d"
        echo "or to source this environment each time you want to use Alliance."
        echo ""
        echo "Alliance compilation OK."
fi

