#! /bin/csh -f
#
#  make sure this is executed from the $NEMO directory
#
#  linux:   src/scripts/quickps
#  sol:     src/scripts/quickps cc=gcc f77=f77          ok
#           src/scripts/quickps cc=gcc f77=g77          bad --
#           src/scripts/quickps cc=cc                   ok, but FORLIBS missing sunmath
#           src/scripts/quickps cc=gcc                  
#
#  sgi:     src/scripts/quickps cc=cc  f77=f90          ok, but potlist problems
#

#			set defaults for command line arguments
set cc=""
set f77=""

#			parse command line
foreach arg ($*)
  set $arg
end

#			can only run from $NEMO
if (! -e nemo_end) then
   exit 1
endif

#			set compilers defaults via environment variables
if ("x$cc" != "x") setenv CC $cc
if ("x$f77" != "x") setenv F77 $f77



set log=quick.log

echo "### Start:"
echo "quickps $*"                 >& $log
echo "### Running configure..."
if (-e Makefile) then
  make cleanall                  >>& $log 
endif
./configure --with-yapp=ps       >>& $log 
if ($?NEMO) then
  source nemo_end                >>& $log
endif
source nemo_start		 >>& $log 
echo "### Installing scripts..."
make dirs config_extra scripts   >>& $log 
source NEMORC.local              >>& $log 
rehash
echo "### Making library..."
make libs                        >>& $log 
echo "### Running testsuite..."
src/scripts/testsuite -b         >>& $log 
echo "### Done:"
grep TESTSUITE: $log | grep -v OK
