#! /bin/sh
S=${S-Splus}
RM=/bin/rm
PLATFORM=`$S PLATFORM`
VERSION=`$S VERSION | sed -f version.sed`
VER_MAJOR=`echo $VERSION | sed -e "s/S-PLUS //"  -e s/\.[0-9]//g`
if [ $VER_MAJOR -ne 6 ]
then
  echo "This version is for S-PLUS 6.x only"
  exit 1
fi

if [ $# -gt 0 ] 
then
  if [ $1 = "tidy" ]; then
    ${RM} -rf */s6 */sgml */win
    ${RM} -rf MASS/modified MASS/data
    ${RM} -f */Ins* */makefile */Win.csh */README.txt
    ${RM} -f Makefile Install INS version.sed
    exit
  fi
  if [ $1 = "clean" ]; then
    ${RM} -rf */.Data
    ${RM} -f */*.o */*.so */makefile
    exit
  fi
fi

echo Installing on a version $VERSION system on a $PLATFORM platform

for name in MASS nnet spatial class;
    do
       (cd ${name}; echo; echo  -----  $name; ./Ins6 $PLATFORM)
    done
