#!/bin/csh -f
# 
# This shell script invokes the Gofer compiler `gofc' to produce a C file,
# followed by the `cc' C compiler to produce an executable. Arguments are as
# for `gofer' and `gofc'. Like `gofc', it uses the last argument to form the
# program name, but ensures that this has an extension to avoid overwriting.
#
# Ian Holyer,  March 1993

set program=$argv[$#argv]
switch ($program)
   case *.gs:
   case *.gof:
   case *.lgs:
   case *.gp:
   case *.prj
   case *.prelude
   case *.hs:
   case *.has:
   case *.lhs:
   case *.lit:
   case *.verb:
      breaksw
   default:
      echo The source program $program does not have one of the standard
      echo extensions for Gofer or Haskell program or project files:
      echo '(.gs .gof .lgs .gp .prj .prelude .hs .has .lhs .lit or .verb)'
      exit
endsw

setenv GOFER /usr/local/lib/Gofer/standard.prelude
/usr/local/lib/Gofer/gofc $*
set prog=$program:r
echo '[Compiling with cc]'
cc -o $prog -O $prog.c /usr/local/lib/Gofer/runtime.o -lm
/bin/strip $prog

