Ticket #807: Linux-ftn-cray.mk

File Linux-ftn-cray.mk, 8.6 KB (added by m.hadfield, 5 years ago)
Line 
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-cray
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 := -e m
32 FIXEDFLAGS := -f fixed
33 FREEFLAGS := -f 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
56ifdef USE_ROMS
57 ifdef USE_DEBUG
58 FFLAGS += -G 0
59 else
60 FFLAGS += -O 3,aggress
61 endif
62 MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)
63endif
64
65#--------------------------------------------------------------------------
66# Compiling flags for CICE Applications.
67#--------------------------------------------------------------------------
68
69ifdef CICE_APPLICATION
70 CPPDEFS := -DLINUS $(MY_CPP_FLAGS)
71 ifdef USE_DEBUG
72 FFLAGS += -G 0
73 else
74 FFLAGS += -O 3,aggress
75 endif
76endif
77
78#--------------------------------------------------------------------------
79# Coupled models. Notice Linux needs the libraries repeated for
80# dependencies for some of the coupled components.
81#--------------------------------------------------------------------------
82
83ifdef USE_COAMPS
84 LIBS += $(COAMPS_LIB_DIR)/coamps_driver.a
85 LIBS += $(COAMPS_LIB_DIR)/libaa.a
86 LIBS += $(COAMPS_LIB_DIR)/libam.a
87 LIBS += $(COAMPS_LIB_DIR)/libashare.a
88 LIBS += $(COAMPS_LIB_DIR)/libcoamps.a
89 LIBS += $(COAMPS_LIB_DIR)/libfnoc.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)/libfishpak.a
96 LIBS += $(COAMPS_LIB_DIR)/libtracer.a
97endif
98
99ifdef USE_WRF
100 LIBS += $(WRF_LIB_DIR)/module_wrf_top.o
101 LIBS += $(WRF_LIB_DIR)/libwrflib.a
102 LIBS += $(WRF_LIB_DIR)/libfftpack.a
103 LIBS += $(WRF_LIB_DIR)/libio_grib1.a
104 LIBS += $(WRF_LIB_DIR)/libio_grib_share.a
105 LIBS += $(WRF_LIB_DIR)/libwrfio_int.a
106 LIBS += $(WRF_LIB_DIR)/libesmf_time.a
107 LIBS += $(WRF_LIB_DIR)/librsl_lite.a
108 LIBS += $(WRF_LIB_DIR)/module_internal_header_util.o
109 LIBS += $(WRF_LIB_DIR)/pack_utils.o
110 LIBS += $(WRF_LIB_DIR)/libwrfio_nf.a
111endif
112
113ifdef CICE_APPLICATION
114 SLIBS := $(LIBS) $(SLIBS)
115endif
116
117#--------------------------------------------------------------------------
118# Library locations, can be overridden by environment variables.
119#--------------------------------------------------------------------------
120
121 LDFLAGS := $(FFLAGS)
122
123ifdef USE_NETCDF4
124 NF_CONFIG ?= nf-config
125 NETCDF_INCDIR ?= $(shell $(NF_CONFIG) --prefix)/include
126 LIBS += $(shell $(NF_CONFIG) --flibs)
127 INCDIR += $(NETCDF_INCDIR) $(INCDIR)
128else
129 NETCDF_INCDIR ?= /opt/cray/pe/netcdf/default/cray/8.6/include
130 NETCDF_LIBDIR ?= /opt/cray/pe/netcdf/default/cray/8.6/lib
131 NETCDF_LIBS ?= -lnetcdf
132 LIBS += -L$(NETCDF_LIBDIR) $(NETCDF_LIBS)
133 INCDIR += $(NETCDF_INCDIR) $(INCDIR)
134endif
135
136ifdef USE_HDF5
137 HDF5_INCDIR ?= /opt/cray/pe/hdf5/default/cray/8.6/include
138 HDF5_LIBDIR ?= /opt/cray/pe/hdf5/default/cray/8.6/lib
139 HDF5_LIBS ?= -lhdf5_fortran -lhdf5hl_fortran -lhdf5 -lz
140 LIBS += -L$(HDF5_LIBDIR) $(HDF5_LIBS)
141 INCDIR += $(HDF5_INCDIR)
142endif
143
144ifdef USE_ARPACK
145 ifdef USE_MPI
146 PARPACK_LIBDIR ?= /usr/local/lib
147 LIBS += -L$(PARPACK_LIBDIR) -lparpack
148 endif
149 ARPACK_LIBDIR ?= /usr/local/lib
150 LIBS += -L$(ARPACK_LIBDIR) -larpack
151endif
152
153ifdef USE_MPI
154 CPPFLAGS += -DMPI
155endif
156
157ifdef USE_OpenMP
158 CPPFLAGS += -D_OPENMP
159endif
160
161ifdef USE_MCT
162 MCT_INCDIR ?= /usr/local/mct/include
163 MCT_LIBDIR ?= /usr/local/mct/lib
164 FFLAGS += -I$(MCT_INCDIR)
165 LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
166 INCDIR += $(MCT_INCDIR) $(INCDIR)
167endif
168
169ifdef USE_ESMF
170 ESMF_OS ?= $(OS)
171 ESMF_SUBDIR := $(ESMF_OS).$(ESMF_COMPILER).$(ESMF_ABI).$(ESMF_COMM).$(ESMF_SITE)
172 ESMF_MK_DIR ?= $(ESMF_DIR)/lib/lib$(ESMF_BOPT)/$(ESMF_SUBDIR)
173 include $(ESMF_MK_DIR)/esmf.mk
174 FFLAGS += $(ESMF_F90COMPILEPATHS)
175 LIBS += $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKLIBS)
176endif
177
178# Use full path of compiler.
179
180 FC := $(shell which ${FC})
181 LD := $(FC)
182
183#
184# Set free form format in some ROMS source files to allow long string for
185# local directory and compilation flags inside the code.
186
187ifdef USE_ROMS
188 $(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += $(FREEFLAGS)
189 $(SCRATCH_DIR)/mod_strings.o: FFLAGS += $(FREEFLAGS)
190 $(SCRATCH_DIR)/analytical.o: FFLAGS += $(FREEFLAGS)
191 $(SCRATCH_DIR)/biology.o: FFLAGS += $(FREEFLAGS)
192
193 ifdef USE_ADJOINT
194 $(SCRATCH_DIR)/ad_biology.o: FFLAGS += $(FREEFLAGS)
195 endif
196 ifdef USE_REPRESENTER
197 $(SCRATCH_DIR)/rp_biology.o: FFLAGS += $(FREEFLAGS)
198 endif
199 ifdef USE_TANGENT
200 $(SCRATCH_DIR)/tl_biology.o: FFLAGS += $(FREEFLAGS)
201 endif
202endif
203
204#--------------------------------------------------------------------------
205# Model coupling specific rules.
206#--------------------------------------------------------------------------
207
208# Add COAMPS library directory to include path of ESMF coupling files.
209
210ifdef USE_COAMPS
211 $(SCRATCH_DIR)/esmf_atm.o: FFLAGS += -I$(COAMPS_LIB_DIR)
212 $(SCRATCH_DIR)/esmf_esm.o: FFLAGS += -I$(COAMPS_LIB_DIR)
213endif
214
215# Add WRF library directory to include path of ESMF coupling files.
216
217ifdef USE_WRF
218 ifeq "$(strip $(WRF_LIB_DIR))" "$(WRF_SRC_DIR)"
219 $(SCRATCH_DIR)/esmf_atm.o: FFLAGS += $(addprefix -I$(WRF_LIB_DIR)/,$(WRF_MOD_DIRS))
220 else
221 $(SCRATCH_DIR)/esmf_atm.o: FFLAGS += -I$(WRF_LIB_DIR)
222 endif
223endif
224
225# Supress free format in SWAN source files since there are comments
226# beyond column 72.
227
228ifdef USE_SWAN
229 $(SCRATCH_DIR)/ocpcre.o: FFLAGS += $(FIXEDFLAGS)
230 $(SCRATCH_DIR)/ocpids.o: FFLAGS += $(FIXEDFLAGS)
231 $(SCRATCH_DIR)/ocpmix.o: FFLAGS += $(FIXEDFLAGS)
232 $(SCRATCH_DIR)/swancom1.o: FFLAGS += $(FIXEDFLAGS)
233 $(SCRATCH_DIR)/swancom2.o: FFLAGS += $(FIXEDFLAGS)
234 $(SCRATCH_DIR)/swancom3.o: FFLAGS += $(FIXEDFLAGS)
235 $(SCRATCH_DIR)/swancom4.o: FFLAGS += $(FIXEDFLAGS)
236 $(SCRATCH_DIR)/swancom5.o: FFLAGS += $(FIXEDFLAGS)
237 $(SCRATCH_DIR)/swanmain.o: FFLAGS += $(FIXEDFLAGS)
238 $(SCRATCH_DIR)/swanout1.o: FFLAGS += $(FIXEDFLAGS)
239 $(SCRATCH_DIR)/swanout2.o: FFLAGS += $(FIXEDFLAGS)
240 $(SCRATCH_DIR)/swanparll.o: FFLAGS += $(FIXEDFLAGS)
241 $(SCRATCH_DIR)/swanpre1.o: FFLAGS += $(FIXEDFLAGS)
242 $(SCRATCH_DIR)/swanpre2.o: FFLAGS += $(FIXEDFLAGS)
243 $(SCRATCH_DIR)/swanser.o: FFLAGS += $(FIXEDFLAGS)
244 $(SCRATCH_DIR)/swmod1.o: FFLAGS += $(FIXEDFLAGS)
245 $(SCRATCH_DIR)/swmod2.o: FFLAGS += $(FIXEDFLAGS)
246 $(SCRATCH_DIR)/m_constants.o: FFLAGS += $(FREEFLAGS)
247 $(SCRATCH_DIR)/m_fileio.o: FFLAGS += $(FREEFLAGS)
248 $(SCRATCH_DIR)/mod_xnl4v5.o: FFLAGS += $(FREEFLAGS)
249 $(SCRATCH_DIR)/serv_xnl4v5.o: FFLAGS += $(FREEFLAGS)
250endif