Ticket #762: Linux-ftn-gnu.mk

File Linux-ftn-gnu.mk, 5.0 KB (added by m.hadfield, 6 years ago)

Make file for PrgEnv-gnu on a Cray XC50

Line 
1# svn $Id$
2#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
3# Copyright (c) 2002-2018 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-gnu
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# NF_CONFIG NetCDF Fortran configuration script
17# NETCDF_INCDIR NetCDF include directory
18# NETCDF_LIBDIR NetCDF library directory
19# NETCDF_LIBS NetCDF library switches
20# LD Program to load the objects into an executable
21# LDFLAGS Flags to the loader
22# RANLIB Name of ranlib command
23# MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
24#
25# First the defaults
26#
27 FC := ftn
28 FFLAGS := -frepack-arrays
29 CPP := /usr/bin/cpp
30 CPPFLAGS := -P -traditional
31 LDFLAGS :=
32 AR := ar
33 ARFLAGS := -r
34 MKDIR := mkdir -p
35 RM := rm -f
36 RANLIB := ranlib
37 PERL := perl
38 TEST := test
39
40 MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)
41
42#
43# Library locations, can be overridden by environment variables.
44#
45
46ifdef USE_NETCDF4
47 NF_CONFIG ?= nf-config
48 NETCDF_INCDIR ?= $(shell $(NF_CONFIG) --includedir)
49 LIBS := $(shell $(NF_CONFIG) --flibs)
50else
51 NETCDF_INCDIR ?= /usr/local/include
52 NETCDF_LIBDIR ?= /usr/local/lib
53 NETCDF_LIBS ?= -lnetcdff
54 LIBS := -L$(NETCDF_LIBDIR) $(NETCDF_LIBS)
55endif
56
57ifdef USE_ARPACK
58 ifdef USE_MPI
59 PARPACK_LIBDIR ?= /opt/gfortransoft/PARPACK
60 LIBS += -L$(PARPACK_LIBDIR) -lparpack
61 endif
62 ARPACK_LIBDIR ?= /opt/gfortransoft/PARPACK
63 LIBS += -L$(ARPACK_LIBDIR) -larpack
64endif
65
66ifdef USE_MPI
67 CPPFLAGS += -DMPI
68endif
69
70ifdef USE_OpenMP
71 CPPFLAGS += -D_OPENMP
72 FFLAGS += -fopenmp
73endif
74
75ifdef USE_DEBUG
76 FFLAGS += -g -fbounds-check -fbacktrace -finit-real=nan -ffpe-trap=invalid,zero,overflow
77else
78 FFLAGS += -O3 -ffast-math
79endif
80
81ifdef USE_MCT
82 MCT_INCDIR ?= /usr/local/mct/include
83 MCT_LIBDIR ?= /usr/local/mct/lib
84 FFLAGS += -I$(MCT_INCDIR)
85 LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
86endif
87
88ifdef USE_ESMF
89 ESMF_OS ?= $(OS)
90 ESMF_SUBDIR := $(ESMF_OS).$(ESMF_COMPILER).$(ESMF_ABI).$(ESMF_COMM).$(ESMF_SITE)
91 ESMF_MK_DIR ?= $(ESMF_DIR)/lib/lib$(ESMF_BOPT)/$(ESMF_SUBDIR)
92 include $(ESMF_MK_DIR)/esmf.mk
93 FFLAGS += $(ESMF_F90COMPILEPATHS)
94 LIBS += $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKLIBS)
95endif
96
97#
98# Use full path of compiler.
99#
100 FC := $(shell which ${FC})
101 LD := $(FC)
102
103#
104# Set free form format in source files to allow long string for
105# local directory and compilation flags inside the code.
106#
107
108$(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form -ffree-line-length-none
109$(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form -ffree-line-length-none
110$(SCRATCH_DIR)/analytical.o: FFLAGS += -ffree-form -ffree-line-length-none
111$(SCRATCH_DIR)/biology.o: FFLAGS += -ffree-form -ffree-line-length-none
112ifdef USE_ADJOINT
113$(SCRATCH_DIR)/ad_biology.o: FFLAGS += -ffree-form -ffree-line-length-none
114endif
115ifdef USE_REPRESENTER
116$(SCRATCH_DIR)/rp_biology.o: FFLAGS += -ffree-form -ffree-line-length-none
117endif
118ifdef USE_TANGENT
119$(SCRATCH_DIR)/tl_biology.o: FFLAGS += -ffree-form -ffree-line-length-none
120endif
121
122#
123# Supress free format in SWAN source files since there are comments
124# beyond column 72.
125#
126
127ifdef USE_SWAN
128
129$(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
130$(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
131$(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
132$(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
133$(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
134$(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
135$(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
136$(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
137$(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
138$(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
139$(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
140$(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
141$(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
142$(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
143$(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
144$(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
145$(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
146$(SCRATCH_DIR)/m_constants.o: FFLAGS += -ffree-form -ffree-line-length-none
147$(SCRATCH_DIR)/m_fileio.o: FFLAGS += -ffree-form -ffree-line-length-none
148$(SCRATCH_DIR)/mod_xnl4v5.o: FFLAGS += -ffree-form -ffree-line-length-none
149$(SCRATCH_DIR)/serv_xnl4v5.o: FFLAGS += -ffree-form -ffree-line-length-none
150
151endif