#! /bin/sh

# this shell script is for building programs
# that were transformed by buddha
# it requires ghc version >= 5.04
# author: Bernie Pope

# if the first argument is "silent" then this will not
# cause any (verbose) output from ghc or the script itself

ghc=/usr/local/bin/ghc

ghcArgs="-O --make -w -package-conf /usr/local/lib/buddha-0.6/buddha.pkg.conf -prof -package buddha -package buddhaHsBase -package lang -package posix -fglasgow-exts -fno-implicit-prelude -fno-cse -o debug Main.hs"

if [ $# -eq 0 ]; then
   $ghc $ghcArgs
   exit 0
fi

if [ $# -gt 0 ]; then
   if [ $1 = "silent" ]; then
      $ghc -v0 $ghcArgs 
   else
      $ghc $ghcArgs
   fi
fi

exit 0
