| 1 | # svn $Id$
|
|---|
| 2 | #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|---|
| 3 | # Copyright (c) 2002-2019 The ROMS/TOMS Group :::
|
|---|
| 4 | # Licensed under a MIT/X style license :::
|
|---|
| 5 | # See License_ROMS.txt :::
|
|---|
| 6 | #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|---|
| 7 | #
|
|---|
| 8 | # Include file for CRAY ftn compiler with PrgEnv-intel
|
|---|
| 9 | # -------------------------------------------------------------------------
|
|---|
| 10 | #
|
|---|
| 11 | # ARPACK_LIBDIR ARPACK libary directory
|
|---|
| 12 | # FC Name of the fortran compiler to use
|
|---|
| 13 | # FFLAGS Flags to the fortran compiler
|
|---|
| 14 | # CPP Name of the C-preprocessor
|
|---|
| 15 | # CPPFLAGS Flags to the C-preprocessor
|
|---|
| 16 | # HDF5_INCDIR HDF5 include directory
|
|---|
| 17 | # HDF5_LIBDIR HDF5 library directory
|
|---|
| 18 | # HDF5_LIBS HDF5 library switches
|
|---|
| 19 | # NF_CONFIG NetCDF Fortran configuration script
|
|---|
| 20 | # NETCDF_INCDIR NetCDF include directory
|
|---|
| 21 | # NETCDF_LIBDIR NetCDF library directory
|
|---|
| 22 | # NETCDF_LIBS NetCDF library switches
|
|---|
| 23 | # LD Program to load the objects into an executable
|
|---|
| 24 | # LDFLAGS Flags to the loader
|
|---|
| 25 | # RANLIB Name of ranlib command
|
|---|
| 26 | # MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
|
|---|
| 27 | #
|
|---|
| 28 | # First the defaults
|
|---|
| 29 | #
|
|---|
| 30 | FC := ftn
|
|---|
| 31 | FFLAGS := -heap-arrays -fp-model precise
|
|---|
| 32 | FIXEDFLAGS := -nofree
|
|---|
| 33 | FREEFLAGS := -free
|
|---|
| 34 | CPP := /usr/bin/cpp
|
|---|
| 35 | CPPFLAGS := -P -traditional -w
|
|---|
| 36 | INCDIR := /usr/include /usr/local/bin
|
|---|
| 37 | SLIBS := -L/usr/local/lib -L/usr/lib
|
|---|
| 38 | ULIBS :=
|
|---|
| 39 | LIBS :=
|
|---|
| 40 | MOD_SUFFIX := mod
|
|---|
| 41 | LD := $(FC)
|
|---|
| 42 | LDFLAGS :=
|
|---|
| 43 | AR := ar
|
|---|
| 44 | ARFLAGS := -r
|
|---|
| 45 | MKDIR := mkdir -p
|
|---|
| 46 | CP := cp -p -v
|
|---|
| 47 | RM := rm -f
|
|---|
| 48 | RANLIB := ranlib
|
|---|
| 49 | PERL := perl
|
|---|
| 50 | TEST := test
|
|---|
| 51 |
|
|---|
| 52 | #--------------------------------------------------------------------------
|
|---|
| 53 | # Compiling flags for ROMS Applications.
|
|---|
| 54 | #--------------------------------------------------------------------------
|
|---|
| 55 |
|
|---|
| 56 | ifdef USE_ROMS
|
|---|
| 57 | ifdef USE_DEBUG
|
|---|
| 58 | FFLAGS += -g
|
|---|
| 59 | FFLAGS += -check all,noarg_temp_created
|
|---|
| 60 | FFLAGS += -traceback
|
|---|
| 61 | FFLAGS += -warn interfaces,nouncalled
|
|---|
| 62 | FFLAGS += -gen-interfaces
|
|---|
| 63 | else
|
|---|
| 64 | FFLAGS += -ip -O3
|
|---|
| 65 | endif
|
|---|
| 66 | MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)
|
|---|
| 67 | endif
|
|---|
| 68 |
|
|---|
| 69 | #--------------------------------------------------------------------------
|
|---|
| 70 | # Compiling flags for CICE Applications.
|
|---|
| 71 | #--------------------------------------------------------------------------
|
|---|
| 72 |
|
|---|
| 73 | ifdef CICE_APPLICATION
|
|---|
| 74 | CPPDEFS := -DLINUS $(MY_CPP_FLAGS)
|
|---|
| 75 | ifdef USE_DEBUG
|
|---|
| 76 | FFLAGS += -g
|
|---|
| 77 | FFLAGS += -check all
|
|---|
| 78 | else
|
|---|
| 79 | FFLAGS := -ip -O3
|
|---|
| 80 | endif
|
|---|
| 81 | endif
|
|---|
| 82 |
|
|---|
| 83 | #--------------------------------------------------------------------------
|
|---|
| 84 | # Coupled models. Notice Linux needs the libraries repeated for
|
|---|
| 85 | # dependencies for some of the coupled components.
|
|---|
| 86 | #--------------------------------------------------------------------------
|
|---|
| 87 |
|
|---|
| 88 | ifdef USE_COAMPS
|
|---|
| 89 | LIBS += $(COAMPS_LIB_DIR)/coamps_driver.a
|
|---|
| 90 | LIBS += $(COAMPS_LIB_DIR)/libaa.a
|
|---|
| 91 | LIBS += $(COAMPS_LIB_DIR)/libam.a
|
|---|
| 92 | LIBS += $(COAMPS_LIB_DIR)/libashare.a
|
|---|
| 93 | LIBS += $(COAMPS_LIB_DIR)/libcoamps.a
|
|---|
| 94 | LIBS += $(COAMPS_LIB_DIR)/libfnoc.a
|
|---|
| 95 | LIBS += $(COAMPS_LIB_DIR)/libaa.a
|
|---|
| 96 | LIBS += $(COAMPS_LIB_DIR)/libam.a
|
|---|
| 97 | LIBS += $(COAMPS_LIB_DIR)/libashare.a
|
|---|
| 98 | LIBS += $(COAMPS_LIB_DIR)/libcoamps.a
|
|---|
| 99 | LIBS += $(COAMPS_LIB_DIR)/libfnoc.a
|
|---|
| 100 | LIBS += $(COAMPS_LIB_DIR)/libfishpak.a
|
|---|
| 101 | LIBS += $(COAMPS_LIB_DIR)/libtracer.a
|
|---|
| 102 | endif
|
|---|
| 103 |
|
|---|
| 104 | ifdef USE_WRF
|
|---|
| 105 | LIBS += $(WRF_LIB_DIR)/module_wrf_top.o
|
|---|
| 106 | LIBS += $(WRF_LIB_DIR)/libwrflib.a
|
|---|
| 107 | LIBS += $(WRF_LIB_DIR)/libfftpack.a
|
|---|
| 108 | LIBS += $(WRF_LIB_DIR)/libio_grib1.a
|
|---|
| 109 | LIBS += $(WRF_LIB_DIR)/libio_grib_share.a
|
|---|
| 110 | LIBS += $(WRF_LIB_DIR)/libwrfio_int.a
|
|---|
| 111 | LIBS += $(WRF_LIB_DIR)/libesmf_time.a
|
|---|
| 112 | LIBS += $(WRF_LIB_DIR)/librsl_lite.a
|
|---|
| 113 | LIBS += $(WRF_LIB_DIR)/module_internal_header_util.o
|
|---|
| 114 | LIBS += $(WRF_LIB_DIR)/pack_utils.o
|
|---|
| 115 | LIBS += $(WRF_LIB_DIR)/libwrfio_nf.a
|
|---|
| 116 | endif
|
|---|
| 117 |
|
|---|
| 118 | ifdef CICE_APPLICATION
|
|---|
| 119 | SLIBS := $(LIBS) $(SLIBS)
|
|---|
| 120 | endif
|
|---|
| 121 |
|
|---|
| 122 | #--------------------------------------------------------------------------
|
|---|
| 123 | # Library locations, can be overridden by environment variables.
|
|---|
| 124 | #--------------------------------------------------------------------------
|
|---|
| 125 |
|
|---|
| 126 | LDFLAGS := $(FFLAGS)
|
|---|
| 127 |
|
|---|
| 128 | ifdef USE_NETCDF4
|
|---|
| 129 | NF_CONFIG ?= nf-config
|
|---|
| 130 | NETCDF_INCDIR ?= $(shell $(NF_CONFIG) --prefix)/include
|
|---|
| 131 | LIBS += $(shell $(NF_CONFIG) --flibs)
|
|---|
| 132 | INCDIR += $(NETCDF_INCDIR) $(INCDIR)
|
|---|
| 133 | else
|
|---|
| 134 | NETCDF_INCDIR ?= /opt/cray/pe/netcdf/default/intel/16.0/include
|
|---|
| 135 | NETCDF_LIBDIR ?= /opt/cray/pe/netcdf/default/intel/16.0/lib
|
|---|
| 136 | NETCDF_LIBS ?= -lnetcdf
|
|---|
| 137 | LIBS += -L$(NETCDF_LIBDIR) $(NETCDF_LIBS)
|
|---|
| 138 | INCDIR += $(NETCDF_INCDIR) $(INCDIR)
|
|---|
| 139 | endif
|
|---|
| 140 |
|
|---|
| 141 | ifdef USE_HDF5
|
|---|
| 142 | HDF5_INCDIR ?= /opt/cray/hdf5/default/intel/16.0/include
|
|---|
| 143 | HDF5_LIBDIR ?= /opt/cray/hdf5/default/intel/16.0/lib
|
|---|
| 144 | HDF5_LIBS ?= -lhdf5_fortran -lhdf5hl_fortran -lhdf5 -lz
|
|---|
| 145 | LIBS += -L$(HDF5_LIBDIR) $(HDF5_LIBS)
|
|---|
| 146 | INCDIR += $(HDF5_INCDIR)
|
|---|
| 147 | endif
|
|---|
| 148 |
|
|---|
| 149 | ifdef USE_ARPACK
|
|---|
| 150 | ifdef USE_MPI
|
|---|
| 151 | PARPACK_LIBDIR ?= /usr/local/lib
|
|---|
| 152 | LIBS += -L$(PARPACK_LIBDIR) -lparpack
|
|---|
| 153 | endif
|
|---|
| 154 | ARPACK_LIBDIR ?= /usr/local/lib
|
|---|
| 155 | LIBS += -L$(ARPACK_LIBDIR) -larpack
|
|---|
| 156 | endif
|
|---|
| 157 |
|
|---|
| 158 | ifdef USE_MPI
|
|---|
| 159 | CPPFLAGS += -DMPI
|
|---|
| 160 | endif
|
|---|
| 161 |
|
|---|
| 162 | ifdef USE_OpenMP
|
|---|
| 163 | CPPFLAGS += -D_OPENMP
|
|---|
| 164 | FFLAGS += -openmp -fpp
|
|---|
| 165 | endif
|
|---|
| 166 |
|
|---|
| 167 | ifdef USE_MCT
|
|---|
| 168 | MCT_INCDIR ?= /usr/local/mct/include
|
|---|
| 169 | MCT_LIBDIR ?= /usr/local/mct/lib
|
|---|
| 170 | FFLAGS += -I$(MCT_INCDIR)
|
|---|
| 171 | LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
|
|---|
| 172 | INCDIR += $(MCT_INCDIR) $(INCDIR)
|
|---|
| 173 | endif
|
|---|
| 174 |
|
|---|
| 175 | ifdef USE_ESMF
|
|---|
| 176 | ESMF_OS ?= $(OS)
|
|---|
| 177 | ESMF_SUBDIR := $(ESMF_OS).$(ESMF_COMPILER).$(ESMF_ABI).$(ESMF_COMM).$(ESMF_SITE)
|
|---|
| 178 | ESMF_MK_DIR ?= $(ESMF_DIR)/lib/lib$(ESMF_BOPT)/$(ESMF_SUBDIR)
|
|---|
| 179 | include $(ESMF_MK_DIR)/esmf.mk
|
|---|
| 180 | FFLAGS += $(ESMF_F90COMPILEPATHS)
|
|---|
| 181 | LIBS += $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKLIBS)
|
|---|
| 182 | endif
|
|---|
| 183 |
|
|---|
| 184 | # Use full path of compiler.
|
|---|
| 185 |
|
|---|
| 186 | FC := $(shell which ${FC})
|
|---|
| 187 | LD := $(FC)
|
|---|
| 188 |
|
|---|
| 189 | #
|
|---|
| 190 | # Set free form format in some ROMS source files to allow long string for
|
|---|
| 191 | # local directory and compilation flags inside the code.
|
|---|
| 192 |
|
|---|
| 193 | ifdef USE_ROMS
|
|---|
| 194 | $(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 195 | $(SCRATCH_DIR)/mod_strings.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 196 | $(SCRATCH_DIR)/analytical.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 197 | $(SCRATCH_DIR)/biology.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 198 |
|
|---|
| 199 | ifdef USE_ADJOINT
|
|---|
| 200 | $(SCRATCH_DIR)/ad_biology.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 201 | endif
|
|---|
| 202 | ifdef USE_REPRESENTER
|
|---|
| 203 | $(SCRATCH_DIR)/rp_biology.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 204 | endif
|
|---|
| 205 | ifdef USE_TANGENT
|
|---|
| 206 | $(SCRATCH_DIR)/tl_biology.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 207 | endif
|
|---|
| 208 | endif
|
|---|
| 209 |
|
|---|
| 210 | #--------------------------------------------------------------------------
|
|---|
| 211 | # Model coupling specific rules.
|
|---|
| 212 | #--------------------------------------------------------------------------
|
|---|
| 213 |
|
|---|
| 214 | # Add COAMPS library directory to include path of ESMF coupling files.
|
|---|
| 215 |
|
|---|
| 216 | ifdef USE_COAMPS
|
|---|
| 217 | $(SCRATCH_DIR)/esmf_atm.o: FFLAGS += -I$(COAMPS_LIB_DIR)
|
|---|
| 218 | $(SCRATCH_DIR)/esmf_esm.o: FFLAGS += -I$(COAMPS_LIB_DIR)
|
|---|
| 219 | endif
|
|---|
| 220 |
|
|---|
| 221 | # Add WRF library directory to include path of ESMF coupling files.
|
|---|
| 222 |
|
|---|
| 223 | ifdef USE_WRF
|
|---|
| 224 | ifeq "$(strip $(WRF_LIB_DIR))" "$(WRF_SRC_DIR)"
|
|---|
| 225 | $(SCRATCH_DIR)/esmf_atm.o: FFLAGS += $(addprefix -I$(WRF_LIB_DIR)/,$(WRF_MOD_DIRS))
|
|---|
| 226 | else
|
|---|
| 227 | $(SCRATCH_DIR)/esmf_atm.o: FFLAGS += -I$(WRF_LIB_DIR)
|
|---|
| 228 | endif
|
|---|
| 229 | endif
|
|---|
| 230 |
|
|---|
| 231 | # Supress free format in SWAN source files since there are comments
|
|---|
| 232 | # beyond column 72.
|
|---|
| 233 |
|
|---|
| 234 | ifdef USE_SWAN
|
|---|
| 235 | $(SCRATCH_DIR)/ocpcre.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 236 | $(SCRATCH_DIR)/ocpids.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 237 | $(SCRATCH_DIR)/ocpmix.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 238 | $(SCRATCH_DIR)/swancom1.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 239 | $(SCRATCH_DIR)/swancom2.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 240 | $(SCRATCH_DIR)/swancom3.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 241 | $(SCRATCH_DIR)/swancom4.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 242 | $(SCRATCH_DIR)/swancom5.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 243 | $(SCRATCH_DIR)/swanmain.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 244 | $(SCRATCH_DIR)/swanout1.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 245 | $(SCRATCH_DIR)/swanout2.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 246 | $(SCRATCH_DIR)/swanparll.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 247 | $(SCRATCH_DIR)/swanpre1.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 248 | $(SCRATCH_DIR)/swanpre2.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 249 | $(SCRATCH_DIR)/swanser.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 250 | $(SCRATCH_DIR)/swmod1.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 251 | $(SCRATCH_DIR)/swmod2.o: FFLAGS += $(FIXEDFLAGS)
|
|---|
| 252 | $(SCRATCH_DIR)/m_constants.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 253 | $(SCRATCH_DIR)/m_fileio.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 254 | $(SCRATCH_DIR)/mod_xnl4v5.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 255 | $(SCRATCH_DIR)/serv_xnl4v5.o: FFLAGS += $(FREEFLAGS)
|
|---|
| 256 | endif
|
|---|