-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
151 lines (132 loc) · 3.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# $Revision$, $Date$
# $URL$
### Instalation directory
I3RC_Home = /Users/robert/Codes/I3RC
CodeDir = $(I3RC_Home)/Code
IntegDir = $(I3RC_Home)/Integrators
### Netcdf-specific entries
NetcdfHome = /Users/robert/Codes/netcdf
Netcdf_IncludeDir = $(NetcdfHome)/include
NetcdfLibs = -L$(NetcdfHome)/lib -lnetcdf
### General compiler macros
ModuleFlag = -I
Modules = $(ModuleFlag)$(Netcdf_IncludeDir)
Libs = $(NetcdfLibs)
Compile.F95 = $(F95) $(F95Flags) -c
Compile.F77 = $(F77) $(FFlags) -c
Link.F95 = $(F95) $(F95Flags)
### MPI-specific entries, if any
#
# Set UseMPI to "yes" and specify the appropriate values for the
# MPI_Dir, MPI_IncludeDir, and MPI_LibDir directories to enable
# the use of multiple processors
#
UseMPI=no
ifeq ($(UseMPI),yes)
MPI_Dir = NULL
MPI_IncludeDir=$(MPI_Dir)/include
MPI_LibDir=$(MPI_Dir)/lib
Libs += $(MPI_LibDir) -lmpi
# MPI and non-MPI versions live in $(CodeDir)
multipleProcCode = multipleProcesses_mpi.o
F95Flags += $(ModuleFlag)$(MPI_IncludeDir)
else
multipleProcCode = multipleProcesses_nompi.o
endif
#### Compiler-specific entries (may override marcos above)
# Macros are available for ifort, g95, xlf, absoft, nagfor (NAGware v5.2)
compiler=ifort
debug=no
ifeq ($(compiler),ifort)
#
# Intel fortran
#
F95 = ifort
F77 = ifort
Compile.F95 += -free -Tf
ifeq ($(debug),no)
# Optimization flags.
F95Flags = -O3 -heap-arrays -diag-disable vec -ipo $(Modules)
FFlags = -fast
else
# Debugging flags
F95Flags = -g -O2 -heap-arrays -C -traceback -diag-disable vec $(Modules)
FFLAGS = -g -O2 -heap-arrays -C -traceback -diag-disable vec
endif
endif
ifeq ($(compiler),g95)
#
# GNU fortran
#
F95 = g95
F77 = g77
ifeq ($(debug),no)
# Optimization flags.
F95Flags = -O2 -std=f95 $(Modules)
FFLAGS = -O2
else
# Debugging flags
F95Flags = -g -std=f95 -fmodule-private -fimplicit-none -Wall $(Modules)
FFLAGS = -g -fimplicit-none -Wall
endif
endif
ifeq ($(compiler),xlf)
#
# IBM xlf 8 for Mac
#
F95 = f95
F77 = f77
ifeq ($(debug),no)
# Optimization flags.
F95Flags = -O3 -qlanglvl=95std $(Modules)
FFLAGS = -O3
else
# Debugging flags
F95Flags = -g -O2 -C -qlanglvl=95std -qmaxmem=-1 $(Modules)
FFLAGS = -g
endif
endif
ifeq ($(compiler),absoft)
#
# absoft fortran
#
F95 = f95
F77 = f77
ModuleFlag = -p
Libs += -lU77
ifeq ($(debug),no)
# Optimization flags.
F95Flags = -O3 -stack_size 0x10000000 -cpu:host $(Modules)
FFlags = -O3 -stack_size 0x10000000 -cpu:host
else
##Debugging flags
F95Flags = -g $(Modules)
FFLAGS = -g
endif
endif
ifeq ($(compiler),nagfor)
#
# NAG Fortran, v 5.2
#
F95 = nagfor
F77 = nagfor
ifeq ($(debug),no)
# Optimization flags.
F95Flags = -O3 $(Modules)
FFLAGS = -O3
else
# Debugging flags
F95Flags = -g -C $(Modules)
FFLAGS = -g -C=all -nan
endif
endif
### General rules - should not require editing
# Rules for bullding object files
%.o: %.f
$(Compile.F77) $<
%.o: %.f95
$(Compile.F95) $<
# Rule to build executables - some compilers are happier if everything
# is an object file
%: %.o
$(Link.F95) -o $@ $^ $(Libs)