#! /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.15 2002/02/25 14:09:23 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..."
# WARNING : modifying CFLAGS on make command line
# (make CFLAGS="-g -D$ALLIANCE_OS") leads in the loss
# of Linux.mk included value of CFLAGS
# STRIP=echo

MAKEOP="ALLIANCE_INSTALL_DIR=$ALLIANCE_TOP $*"
echo make $MAKEOP
make $MAKEOP
# on strip ici tous les exe
cd  "$ALLIANCE_TOP/bin"
strip *
cd "$MYDIR"

if [ $? -ne 0 ]
then 
echo "In csh, you can run :"
echo "source $ALLIANCE_TOP/etc/alc_env.csh"
echo "cd $MYDIR"
echo "make $MAKEOP" 
echo "" 
        echo "Errors have occured"
        exit 4
else
echo "In csh, you can run :"
echo "source $ALLIANCE_TOP/etc/alc_env.csh"
echo "cd $MYDIR"
echo "make $MAKEOP" 
echo "" 
        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



