#! /bin/csh

setenv  CC /usr/local/bin/gcc
setenv  FC /usr/local/bin/gfortran
setenv F90 /usr/local/bin/gfortran
setenv CXX /usr/local/bin/g++

setenv PREFIX /usr/local
setenv HDFDIR /opt/local

if ( -d ${PREFIX} ) then
   echo "Installing into ${PREFIX} at "`date`
else   
   mkdir -p ${PREFIX}
   echo "Installing into ${PREFIX} at "`date`
endif

make clean
make distclean

rm -fv macros.make config.status config.log config.cache

./configure CC=${CC} FC=${FC} F90=${F90} CXX=${CXX} \
            CPPFLAGS="-gdwarf-2 -I$HDFDIR/include" \
             LDFLAGS="-gdwarf-2 -L$HDFDIR/lib" \
              FFLAGS="-gdwarf-2" \
              CFLAGS="-gdwarf-2" \
             --with-hdf5=$HDFDIR \
                --prefix=${PREFIX} || exit 1

make         || exit 2
make test    || exit 3
make check   || exit 4
make install || exit 5

echo "Finished at "`date`
