#!/bin/sh
#
#ident	"@(#)bldenv.sh	1.1	93/04/15 SMI"
#
# Copyright (c) 1993 by Sun Microsystems, Inc.
#
# Uses supplied "env" file, based on /opt/ongk/etc/env, to set shell variables
# before spawning a C shell for doing a release-style builds interactively
# and incrementally.
#
USAGE='  usage: bldenv <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

# 	Set PATH for a build
#PATH="/opt/onbld/bin:/usr/sbin:/opt/SUNWspro/bin:/usr/ccs/bin:/opt/teamware/bin:/usr/bin"

#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/bin ]; then
        TW="/opt/teamware/bin"
else
        TW="${TOOLPATH}/teamware/bin"
fi
PATH="${BLD}:/usr/sbin:${SP}:/usr/ccs/bin:${TW}:/usr/bin"

CH=
TMPDIR="/tmp"
export	PATH CH TMPDIR
unset	CFLAGS LD_LIBRARY_PATH

# a la ws
ENVLDLIBS1=
ENVLDLIBS2=
ENVLDLIBS3=
ENVCPPFLAGS1=
ENVCPPFLAGS2=
ENVCPPFLAGS3=
ENVCPPFLAGS4=

ENVLDLIBS1="-L$ROOT/usr/lib -L$ROOT/usr/ccs/lib"
ENVCPPFLAGS1="-I$ROOT/usr/include"
MAKEFLAGS=e

export ENVLDLIBS1 ENVLDLIBS2 ENVLDLIBS3 \
	ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 \
	ENVCPPFLAGS4 MAKEFLAGS

echo "RELEASE      is  $RELEASE"
echo "VERSION      is  $VERSION"
echo "RELEASE_DATE is  $RELEASE_DATE"
echo ""
echo "The following csh will be invoked with -f by design."
echo "Manually set your history, aliases, and other customizations with care."
exec csh -f
