#!/bin/csh -x

      ./configure
source .configure
if ( ! $?ARCH ) setenv ARCH `uname`
#setenv GFIODIR /home/dao_ops/GEOSdas-2_1_4/GEOSadas

set fname = flat2hdf

/bin/rm ${fname}_${ARCH}.x
/bin/rm test.o
/bin/rm test.F
cat $fname.F > test.F


# SGI Compilation
# ---------------
if( ${ARCH} == 'IRIX64' ) then

     f90 -c -fixedform -extend_source -O3 -64 -r8 -i4 -mips4 -I $BASEDIR/include -Dopenmp -mp test.F
     f90 -o  test.x                   -O3 -64 -r8 -i4 -mips4 -I . -mp test.o -L$GFIODIR/$ARCH/lib \
                                                                             -L$BASEDIR/lib \
                                                                             -lgfio -lmfhdf -ldf -lz
endif


# Linux Compilation
# -----------------
if( ${ARCH} == 'Linux' ) then
     set gfio = GMAO_gfio_r4
     set cfio = MAPL_cfio_r4
     set hdf  = GMAO_mfhdf3

#    ifort -o test.x -extend_source -assume byterecl                     -O3 -I. test.F \
     ifort -o test.x -extend_source -assume byterecl -convert big_endian -O3 -I. test.F \
           -L$GFIODIR/$ARCH/lib -l$cfio -l$gfio -l$hdf \
           -L$BASEDIR/$ARCH/lib -lmfhdf -ldf -lhdfjpeg -lhdfz -lsz
endif


/bin/rm test.F
/bin/rm test.o
/bin/mv test.x ${fname}_${ARCH}.x
             ./${fname}_${ARCH}.x
