#!/bin/sh
# @(#)MAKE version 3.46 created 4/16/96
# @(#)Copyright (c), 1987, 1996 StatSci, Inc.  All rights reserved.
PLATFORM=`$SHOME/cmd/PLATFORM`
tmpdir=${TMPDIR:-/tmp}
OpSys=${OpSys-"ATT"}
export OpSys
#
# Make sure some envars that could affect the builds are unset.
unset LD_LIBRARY_PATH
unset LD_RUN_PATH
# Make sure LD_LIBRARY_PATH is set to default search path + our lib dir
# Otherwise, FORTRAN libraries will not be found.
LD_LIBRARY_PATH=/opt/SUNWspro/lib:/usr/openwin/lib:/usr/lib:$SHOME/newfun/lib
export LD_LIBRARY_PATH
if [ "$CPP_FLAGS" != "" ]
then
	echo "Warning: \$CPP_FLAGS is set to $CPP_FLAGS"
fi
if test -f Smake.cpp
then
    if test -f Smakefile
    then SMAKEFILE=Smakefile
    else SMAKEFILE=
    fi
	make PLATFORM=$PLATFORM SHOME=$SHOME -f $SHOME/cmd/makehead ${SMAKEFILE:+-f} $SMAKEFILE -f $SHOME/cmd/smakedep smake
fi
if test -r Smakefile
then
	if grep -s "^NO_S_TAIL" Smakefile
	then
		# Do not include the maketail with these
		make PLATFORM=$PLATFORM SHOME=$SHOME -f $SHOME/cmd/makehead -f Smakefile ${1+"$@"}
	else
		make PLATFORM=$PLATFORM SHOME=$SHOME -f $SHOME/cmd/makehead -f Smakefile -f $SHOME/cmd/maketail ${1+"$@"}
	fi
else
	make PLATFORM=$PLATFORM SHOME=$SHOME -f $SHOME/cmd/makehead -f $SHOME/cmd/maketail ${1+"$@"}
fi ||(echo "Any files containing compile errors are in directory $tmpdir"; exit 1)
