1 | # svn $Id: Linux-gfortran.mk 49 2007-05-10 21:40:11Z arango $
|
---|
2 | #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
---|
3 | # Copyright (c) 2002-2007 The ROMS/TOMS Group :::
|
---|
4 | # Licensed under a MIT/X style license :::
|
---|
5 | # See License_ROMS.txt :::
|
---|
6 | #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
---|
7 | #
|
---|
8 | # Include file for GNU G95 compiler on Linux
|
---|
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 | # CLEAN Name of cleaning executable after C-preprocessing
|
---|
17 | # NETCDF_INCDIR NetCDF include directory
|
---|
18 | # NETCDF_LIBDIR NetCDF libary directory
|
---|
19 | # LD Program to load the objects into an executable
|
---|
20 | # LDFLAGS Flags to the loader
|
---|
21 | # RANLIB Name of ranlib command
|
---|
22 | # MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
|
---|
23 | #
|
---|
24 | # First the defaults
|
---|
25 | #
|
---|
26 | FC := gfortran
|
---|
27 | FFLAGS := -frepack-arrays
|
---|
28 | CPP := /usr/bin/cpp
|
---|
29 | CPPFLAGS := -P -traditional
|
---|
30 | LD := $(FC)
|
---|
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 |
|
---|
46 | MCT_INCDIR ?= /usr/local/mct/include
|
---|
47 | MCT_LIBDIR ?= /usr/local/mct/lib
|
---|
48 | NETCDF_INCDIR ?= /usr/local/include
|
---|
49 | NETCDF_LIBDIR ?= /usr/local/lib
|
---|
50 |
|
---|
51 | CPPFLAGS += -I$(NETCDF_INCDIR)
|
---|
52 | LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
|
---|
53 |
|
---|
54 | ifdef USE_ARPACK
|
---|
55 | ARPACK_LIBDIR ?= /usr/local/lib
|
---|
56 | LIBS += -L$(ARPACK_LIBDIR) -larpack
|
---|
57 | endif
|
---|
58 |
|
---|
59 | ifdef USE_MPI
|
---|
60 | CPPFLAGS += -DMPI
|
---|
61 | ifdef USE_MPIF90
|
---|
62 | FC := mpif90
|
---|
63 | LD := $(FC)
|
---|
64 | else
|
---|
65 | LIBS += -lfmpi -lmpi
|
---|
66 | endif
|
---|
67 | endif
|
---|
68 |
|
---|
69 | ifdef USE_OpenMP
|
---|
70 | CPPFLAGS += -D_OPENMP
|
---|
71 | FFLAGS += -fopenmp
|
---|
72 | endif
|
---|
73 |
|
---|
74 | ifdef USE_DEBUG
|
---|
75 | FFLAGS += -g -fbounds-check
|
---|
76 | else
|
---|
77 | FFLAGS += -O3 -ffast-math
|
---|
78 | endif
|
---|
79 |
|
---|
80 | ifdef SWAN_COUPLE
|
---|
81 | FFLAGS += -I$(MCT_INCDIR)
|
---|
82 | LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
|
---|
83 | endif
|
---|
84 |
|
---|
85 | # Turn off bounds checking for function def_var, as "dimension(*)"
|
---|
86 | # declarations confuse Gnu Fortran 95 bounds-checking code.
|
---|
87 |
|
---|
88 | $(SCRATCH_DIR)/def_var.o: FFLAGS += -fno-bounds-check
|
---|
89 |
|
---|
90 | #
|
---|
91 | # Set free form format in source files to allow long string for
|
---|
92 | # local directory and compilation flags inside the code.
|
---|
93 | #
|
---|
94 |
|
---|
95 | $(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form
|
---|
96 | $(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form
|
---|
97 |
|
---|
98 | #
|
---|
99 | # Supress free format in SWAN source files since there are comments
|
---|
100 | # beyond column 72.
|
---|
101 | #
|
---|
102 |
|
---|
103 | ifdef SWAN_COUPLE
|
---|
104 |
|
---|
105 | $(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
|
---|
106 | $(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
|
---|
107 | $(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
|
---|
108 | $(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
|
---|
109 | $(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
|
---|
110 | $(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
|
---|
111 | $(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
|
---|
112 | $(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
|
---|
113 | $(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
|
---|
114 | $(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
|
---|
115 | $(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
|
---|
116 | $(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
|
---|
117 | $(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
|
---|
118 | $(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
|
---|
119 | $(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
|
---|
120 | $(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
|
---|
121 | $(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
|
---|
122 | $(SCRATCH_DIR)/swmod3.o: FFLAGS += -ffixed-form
|
---|
123 |
|
---|
124 | endif
|
---|