#! /bin/sh
#
#ident	"@(#)nightly_clobber.sh	1.6	92/11/03 SMI"
#
# Copyright (c) 1991 by Sun Microsystems, Inc.
#
USAGE='	usage: nightly_clobber <env_file>'
#

# test that the path to the environment-setting file was given
if [ $# -ne 1 ]
then
	echo "$USAGE"
	exit 1
fi

# 	Setup environmental variables
. $1
#
#
#PATH="/opt/teamware/ParallelMake/bin:/usr/ccs/bin:/usr/bin:/usr/bin:/opt/SUNWspro:/opt/onbld/bin/install:/usr/sbin"
#
#automount map for generic tools: teamware/onbld/ongk
TOOLPATH=/shared/ON/tools
 
#Locally mounted compiler always has precedence 
#Impt for Sustaining work to freeze construction set by mounting locally
#
if [ -d /opt/SUNWspro/bin ]; then
        SP=/opt/SUNWspro/bin
else
        if [ "$SPRO_BIN" ]; then
                SP=${SPRO_BIN}
        else
                echo "Error: SPRO_BIN undefined in env" && exit 1
        fi
fi
[ ! -d $SP ] && echo "${SP} not found!" && exit 1
 
if [ -d /opt/onbld/bin ]; then
        BLD="/opt/onbld/bin"
else
        BLD="${TOOLPATH}/onbld/bin"
fi
if [ -d /opt/teamware/ParallelMake ]; then
        MK="/opt/teamware/ParallelMake/bin"
else
        MK="${TOOLPATH}/teamware/ParallelMake/bin"
fi
PATH="${MK}:/usr/ccs/bin:/usr/bin:/usr/bin:${SP}:${BLD}/install:/usr/sbin"

#
export PATH
cd $SRC
make -ek clobber >> $LOGFILE 2>&1 
rm -rf $ROOT
