# This config file contains the compile options for compilation
# of the GSI code on the NOAA HPCS.

# ----------------------------------
# Redefine variables for WCOSS
# ----------------------------------

# WRF locations
WRFPATH=${BASE}/rap_wrfarw.fd/WRFV3.8.1
LIBwrfio_int    = $(WRFPATH)/external/io_int/libwrfio_int.a
LIBwrfio_netcdf = $(WRFPATH)/external/io_netcdf/libwrfio_nf.a
OBJwrf_frame_pk = $(WRFPATH)/frame/pack_utils.o
OBJwrf_sizeof_int = $(WRFPATH)/frame/module_machine.o
WRFLIB = $(LIBwrfio_int) $(LIBwrfio_netcdf) $(OBJwrf_frame_pk) $(OBJwrf_sizeof_int)

GSIDIR = ${BASE}/rap_gsi.fd
GSILIB = -L$(GSIDIR) -lgsi

# Empty out definition of libs use by GMAO GSI building structure
LIBtransf = #-L$(CORELIB) -ltransf
LIBhermes = #-L$(CORELIB) -lhermes
LIBgfio   = #-L$(CORELIB) -lgfio
INChdf    = #-I$(BASEDIR)/$(ARCH)/include/hdf
LIBhdf    = #-L$(BASEDIR)/$(ARCH)/lib  -lmfhdf -ldf -lhdfjpeg -lhdfz -lsz


# ---------------------------
# General targets/definitions
# ---------------------------

  AR     = ar -v

# ----------------------------
# Fortran compiler and options
# ----------------------------

  CF            = mpxlf90_r
  FC            = $(CF)

  COREINC   = ${HOME}/LongRun/nwprod/lib/incmod
  CRTM_INC   = $(COREINC)/crtm_2.2.3
  CRTM_LIB   = ${HOME}/LongRun/nwprod/lib/libCRTM_2.2.3.a
#--- Normal mode options
  PROF= #-pg
  OMP = -qsmp=noauto

  FFLAGS_F90    = -WF,-D_REAL8_,-DWRF,-DRR_CLOUDANALYSIS

  FFLAGS_COM_N  = -I./ -I$(GSIDIR) -I$(CRTM_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) \
  		-I$(NEMSIO_INC) -I$(NETCDF)/include -I$(W3EMC_INCd) \
                -O3 -qstrict \
                $(OMP)

  FFLAGS_COM_N_NOSWAP  = -I./ -I$(CRTM_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) \
  		       -I$(NEMSIO_INC) -I$(NETCDF)/include -I$(W3EMC_INCd) \
                       -O3 -qstrict \
                       $(OMP)

  FFLAGS_N  = $(FFLAGS_F90) $(FFLAGS_COM_N) $(PROF) 
  FFLAGS_NOSWAP_N  = $(FFLAGS_F90) $(FFLAGS_COM_N_NOSWAP) $(PROF) 
  FFLAGS_f  = $(FFLAGS_COM_N) $(PROF) 
  FFLAGS    = $(FFLAGS_N) $(PROF) 


#--- Debug mode options
  FFLAGS_COM_D  =  -I./ -I$(CRTM_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) \
  		-I$(NEMSIO_INC) -I$(NETCDF)/include -I$(W3EMC_INCd) \
  		-O0  \
		-g
  FFLAGS_COM_NOSWAP_D  =  -I./ -I$(CRTM_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) \
  		       -I$(NEMSIO_INC) -I$(NETCDF)/include -I$(W3EMC_INCd) \
  		       -O0 \
		       -g
  FFLAGS_D  = $(FFLAGS_F90) $(FFLAGS_COM_D)
  FFLAGS_NOSWAP_D = $(FFLAGS_F90) $(FFLAGS_COM_NOSWAP_D)



# ----------------------
# C Compiler and options
# ----------------------

  CC            = xlc_r

#--- Normal mode options

  CFLAGS_N      = -DLINUX -Dfunder -I./ -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 $(OMP)

#--- Debug mode options

  CFLAGS_D      = -DLINUX -Dfunder -I./ -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g


# ------------------
# Linker and options
# ------------------

  LD            = $(CF)

#--- Normal mode options

  LIBS_N        = $(GSILIB) $(SP_LIBd) $(NEMSIO_LIB) $(BACIO_LIB4) $(SIGIO_LIB4) \
  		$(SFCIO_LIB4) $(BUFR_LIBd) $(W3NCO_LIBd) $(W3EMC_LIBd) \
  		$(CRTM_LIB) $(WRFLIB) -L$(NETCDF)/lib -lnetcdff -lnetcdf \
#               -L../lib/GSD/gsdcloud4nmmb -lgsdcloud

  LDFLAGS_N     = -lessl_r $(OMP)

  LDFLAGS       = $(LDFLAGS_N)

#--- Debug mode options

  LIBS_D        = $(LIBS_N)

  LDFLAGS_D     = -lessl_r

#--- Empty out mpi library definition: embedded in compiler

  LIBmpi	= 
