#! /bin/sh

######################################################################
#
# Sample generic script for compiling GCSI sample program
#
# Norm Green
# GemStone Systems Inc.
# September 14, 2009
#
######################################################################

osName=`uname`

# Better to use gmake if we have it
`gmake -v >/dev/null 2>&1`
if [ $? -eq 0 ]; then
  MAKE=gmake
  echo "Using gmake"
else
  MAKE=make
  echo "Using make"
fi

if [ "$GEMSTONE" = "" ]; then
  echo "Error: GEMSTONE not set"
  exit 1
fi

if [ "$osName" = "Linux" ]; then
  $MAKE -f makefile.linux
  exit 0
fi

if [ "$osName" = "AIX" ]; then
  $MAKE -f makefile.aix
  exit 0
fi

if [ "$osName" = "Darwin" ]; then
  $MAKE -f makefile.darwin
  exit 0
fi

echo "unsupported operating system: $osName"
exit 1
