
ad udunits
module load emos
module load netcdf4
module load hdf5

set -xuve
date

DST=../bin; mkdir -p $DST


F90=gcc
F90FLAGS='-E -c -g  -DCOLOREDOUTPUT'

export DIR_UUID=../../../lib/
export CMOR=../../../lib/

$F90  $F90FLAGS  cmor-oce.F90 -o cmor-oce.exe \
      -L${CMOR}/lib -lcmor \
      -I${CMOR}/include \
      -L${DIR_UUID}/lib -luuid \
      -I${DIR_UUID}/include \
      -L${NETCDF4_DIR}/lib -lnetcdff -lnetcdf \
      -I${NETCDF4_DIR}/include \
      -L${UDUNITS_DIR}/lib -ludunits2 -lexpat \
      -I${UDUNITS_DIR}/include \
      -L${SZIP_DIR}/lib -lz \
      -I${SZIP_DIR}/include

mv cmor-oce.exe $DST/cmor-oce.exe

$F90  $F90FLAGS  cmor-atm.F90 -o cmor-atm.exe \
      -L${EMOS_DIR}/lib -lemos \
      -I{EMOS_DIR}/include \
      -L${CMOR}/lib -lcmor \
      -I${CMOR}/include \
      -L${DIR_UUID}/lib -luuid \
      -I${DIR_UUID}/include \
      -L${NETCDF4_DIR}/lib -lnetcdff -lnetcdf \
      -I${NETCDF4_DIR}/include \
      -L${UDUNITS_DIR}/lib -ludunits2 -lexpat \
      -I${UDUNITS_DIR}/include \
      -L${SZIP_DIR}/lib -lz \
      -I${SZIP_DIR}/include


mv cmor-atm.exe $DST/cmor-atm.exe
export LD_LIBRARY_PATH=${UDUNITS}/lib:${SZLIB}/lib:${ZLIB}/lib:${NetCDF}/lib:${LD_LIBRARY_PATH}

