-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
152 lines (134 loc) · 5.32 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
151
152
# Fortran compiler ("gnu", "intel" or "portland")
FORTRAN = gnu
# Debugging ("yes" or "no")
DEBUG = no
# Directories for objects and modules. (No need to change.)
DIR_MODULE = .Modules
DIR_OBJECT = .Objects
# Program name (This should hardly change)
PROGRAM_NAME = Process
PROGRAM_FILE = $(PROGRAM_NAME)
$(info #=======================================================================)
$(info # Compiling $(PROGRAM_NAME) with compiler $(FORTRAN))
$(info #-----------------------------------------------------------------------)
$(info # Usage: )
$(info # make <FORTRAN=gnu/intel/portland> <DEBUG=yes/no> )
$(info #-----------------------------------------------------------------------)
#-------------------------------------------------------------------------------
# Compiler and linker options
#-------------------------------------------------------------------------------
# Note: Changes only when support to a new Fortran compiler is added.
#-------------------------------------------------------------------------------
# Fortran == gnu
ifeq ($(FORTRAN), gnu)
FC = gfortran
ifeq ($(DEBUG),yes)
OPT_COMP = -J $(DIR_MODULE) -fdefault-real-8 -O0 -g \
-ffixed-line-length-80 -fcheck=all -fwhole-file -fbacktrace \
-ffpe-trap=invalid,zero,overflow \
-fimplicit-none -finit-real=nan \
-Wall -Wextra -Waliasing -Wampersand \
-Wc-binding-type -Wcharacter-truncation -Wline-truncation \
-Wconversion -Wconversion-extra -Wintrinsics-std \
-Wreal-q-constant -Wsurprising -Wtabs -Wunderflow \
-Wintrinsic-shadow -Wunused-parameter -Walign-commons \
-Wfunction-elimination -Wrealloc-lhs -Wrealloc-lhs-all \
-Wcompare-reals -Wtarget-lifetime -Wpedantic -fstack-check
else
OPT_COMP = -J $(DIR_MODULE) -fdefault-real-8 -O3
endif
OPT_LINK = $(OPT_COMP)
endif
# Fortran == intel
ifeq ($(FORTRAN), intel)
FC = ifort
ifeq ($(DEBUG),yes)
OPT_COMP = -module $(DIR_MODULE) -r8 -i8 -O0 -g -warn all -check all \
-debug all -fpe-all=0 -traceback
else
OPT_COMP = -module $(DIR_MODULE) -r8 -i8 -O3
endif
OPT_LINK = $(OPT_COMP)
endif
# Fortran == portland
ifeq ($(FORTRAN), portland)
FC = pgfortran
ifeq ($(DEBUG),yes)
OPT_COMP = -module $(DIR_MODULE) -r8 -i8 -O0 -g
else
OPT_COMP = -module $(DIR_MODULE) -r8 -i8 -O3
endif
OPT_LINK = $(OPT_COMP)
endif
#------------------------------------------------------
# List of sources for modules and functions
#------------------------------------------------------
# Modules' order must obey their dependency
# This list should therefore be written "by hand".
# Note: Modules written in lower case
# letters are candidates for deletion.
#------------------------------------------------------
#-------------
# Modules
#-------------
SRC_MOD = Mesh_Mod.f90 \
Eddy_Mod.f90 \
Var_Mod.f90 \
Prof_Mod.f90 \
Flow_Mod.f90
#---------------
# Functions
#---------------
SRC_FUN = Cholesky.f90 \
Convect_Eddy.f90 \
Generate_Fluctuations.f90 \
Main_Sem.f90 \
Mat_Mul.f90 \
Read_Vtk_Mesh.f90 \
Save_Vtk.f90 \
Scale_Fluctuations.f90 \
Statistics.f90
#----------------------------------------------------------------------
# List of objects generated from the list of modules and functions
#----------------------------------------------------------------------
# Note: This doesn't need editing.
#----------------------------------------------------------------------
OBJ_MOD = $(SRC_MOD:%.f90=$(DIR_OBJECT)/%.o)
OBJ_FUN = $(SRC_FUN:%.f90=$(DIR_OBJECT)/%.o)
OBJ = $(OBJ_MOD) $(OBJ_FUN)
#-------------------------------------------------------
# List of modules currently used for target "clean"
#-------------------------------------------------------
# Note: This doesn't need editing.
#-------------------------------------------------------
SRC_MOD_LOW = $(shell echo $(SRC_MOD) | tr A-Z a-z)
MOD = $(SRC_MOD_LOW:%.f90=$(DIR_MODULE)/%.mod)
#---------------------------------------------------------
# Default rule to build Fortran modules and functions
#---------------------------------------------------------
# Note: This doesn't need editing.
#---------------------------------------------------------
# Functions
$(DIR_OBJECT)/%.o: %.f90
@echo FC $<
@$(FC) $(OPT_COMP) -c -o $@ $<
#-----------------------------------
# Rule to build main program
#-----------------------------------
# Note: Should not be modified.
#-----------------------------------
$(PROGRAM_FILE): $(OBJ)
@echo Linking "\033[0;32m $(PROGRAM_FILE) \033[0m"
@$(FC) $(OPT_LINK) -o $(PROGRAM_FILE) $(OBJ)
#---------------------------------------
# Explicit dependencies for modules
#---------------------------------------
# These should be inserted by
# hand for tuning of dependencies.
#---------------------------------------
include makefile_explicit_dependencies
#---------------------
# Explicit target.
#---------------------
clean:
rm -f $(DIR_OBJECT)/*.o $(DIR_MODULE)/*.mod $(PROGRAM_FILE)