#!/bin/sh

UNAME=`uname`
REV=`uname -r`

CCPIPE='CCPIPE=-pipe'
case $UNAME in
  SunOS) case $REV in
           4.1*) echo This looks like a SunOS 4.1 through 4.1.4 system
             ARCH='SUNOS4=-DSUNOS4=1 HPUX= SOLARIS= ULTRIX= AIX= LINUX= OSF1=';;
           5.*) echo This looks like a Solaris 2.x system
             ARCH='SUNOS4= HPUX= SOLARIS=-DSOLARIS=1 ULTRIX= AIX= LINUX= OSF1=';;
        esac;;
  HP-UX) case $REV in
           A.09.*) echo This looks like an HP-UX machine running 9.x
             ARCH='SUNOS4= HPUX=-DHPUX=1 SOLARIS= ULTRIX= AIX= LINUX= OSF1=';;
           *) echo This is an unfamiliar version of HP-UX. Good luck
             ARCH='SUNOS4= HPUX=-DHPUX=1 SOLARIS= ULTRIX= AIX= LINUX= OSF1=';;
        esac;;
  AIX) case $REV in
           *) echo This is AIX
             ARCH='SUNOS4= HPUX= SOLARIS= ULTRIX= AIX=-DAIX=1 LINUX= OSF1=';;
        esac;;
  ULTRIX) case $REV in
           *) echo This is Ultrix
             CCPIPE='CCPIPE='
             ARCH='SUNOS4= HPUX= SOLARIS= ULTRIX=-DULTRIX=1 AIX= LINUX= OSF1=';;
        esac;;
  Linux) case $REV in
           *) echo This is Linux
             ARCH='SUNOS4= HPUX= SOLARIS= ULTRIX= AIX= LINUX=-DLINUX=1 OSF1=';;
        esac;;
  
  *) echo I have no idea what OS this is. You are on your own.;;

  
esac
  


if [ -f Blind.c ] ; then
  make clean  # Start fresh
  # Comment me out if you want a non-forecast blind.dbg
  make $CCPIPE $ARCH PREPROC=-DPREPROC FORECAST=-DFORECAST dbg-plus
  # Uncomment me if you want a non-forecast blind.dbg
  # make PREPROC=-DPREPROC SMART=-DSMART blind.dbg
  make clean # Do this so that the .KEEP_STATE stuff doesn't screw us
  make $CCPIPE $ARCH PREPROC=  FORECAST= Blind
else
  echo "Run me from the source directory!"
  exit 1
fi
