DCS
a Driven-Cavity Open source Simulator code
 All Classes Files Functions Variables Groups Pages
makefile
Go to the documentation of this file.
1 #!/usr/bin/make
2 #----------------------------------------------------------------------------------------------------------------------------------
3 # make init
4 
5 # shell
6 SHELL = /bin/bash
7 # no verbose
8 $(VERBOSE).SILENT:
9 #----------------------------------------------------------------------------------------------------------------------------------
10 
11 #----------------------------------------------------------------------------------------------------------------------------------
12 # User options
13 COMPILER = intel
14 DEBUG = no
15 F03STD = yes
16 OPTIMIZE = no
17 OPENMP = no
18 NULi = no
19 NULj = no
20 NULk = no
21 
22 .PHONY : DEFAULTRULE
23 DEFAULTRULE: $(DEXE)DCS
24 
25 .PHONY : help
26 help:
27  @echo
28  @echo -e '\033[1;31m Make options of DCS code\033[0m'
29  @echo
30  @echo -e '\033[1;31m Compiler choice: COMPILER=$(COMPILER)\033[0m\033[1m => default\033[0m'
31  @echo -e '\033[1;31m COMPILER=gnu \033[0m\033[1m => GNU gfortran \033[0m'
32  @echo -e '\033[1;31m COMPILER=intel\033[0m\033[1m => Intel Fortran \033[0m'
33  @echo
34  @echo -e '\033[1;31m Compiling options\033[0m'
35  @echo -e '\033[1;31m DEBUG=yes(no) \033[0m\033[1m => on(off) debug (default $(DEBUG))\033[0m'
36  @echo -e '\033[1;31m F03STD=yes(no) \033[0m\033[1m => on(off) check standard fortran (default $(F03STD))\033[0m'
37  @echo -e '\033[1;31m OPTIMIZE=yes(no) \033[0m\033[1m => on(off) optimization (default $(OPTIMIZE))\033[0m'
38  @echo -e '\033[1;31m OPENMP=yes(no) \033[0m\033[1m => on(off) OpenMP directives (default $(OPENMP))\033[0m'
39  @echo
40  @echo -e '\033[1;31m Provided Rules: default=DCS\033[0m\033[1m => compile the code\033[0m'
41  @echo -e '\033[1;31m cleanobj =>\033[0m\033[1m cleaning compiled object\033[0m'
42  @echo -e '\033[1;31m cleanmod =>\033[0m\033[1m cleaning .mod files\033[0m'
43  @echo -e '\033[1;31m cleanmsg =>\033[0m\033[1m cleaning make-log massage files\033[0m'
44  @echo -e '\033[1;31m clean =>\033[0m\033[1m running cleanobj, cleanmod and cleanmsg\033[0m'
45  @echo -e '\033[1;31m cleanall =>\033[0m\033[1m running clean and cleanexe\033[0m'
46  @echo -e '\033[1;31m tar =>\033[0m\033[1m creating a tar archive of the project\033[0m'
47  @echo -e '\033[1;31m doc =>\033[0m\033[1m building the documentation\033[0m'
48 #----------------------------------------------------------------------------------------------------------------------------------
49 
50 #----------------------------------------------------------------------------------------------------------------------------------
51 # directory & file
52 DSRC = ./src/
53 DOBJ = ./obj/
54 DMOD = ./mod/
55 DEXE = ./
56 VPATH = $(DSRC) $(DOBJ) $(DMOD)
57 
58 MKDIRS = $(DOBJ) $(DMOD) $(DEXE)
59 #-----------------------------------------------------------------------------------------------------------------------------------
60 
61 #-----------------------------------------------------------------------------------------------------------------------------------
62 # compiler specific rules
63 # GNU
64 WRN_GNU = -fmax-errors=0 -Wall -Wno-array-temporaries -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wconversion-extra -Wimplicit-interface -Wimplicit-procedure -Wunderflow -Wextra -Wuninitialized
65 CHK_GNU = -fcheck=all
66 DEB_GNU = -fmodule-private -ffree-line-length-132 -fimplicit-none -ffpe-trap=invalid,overflow -fbacktrace -fdump-core -finit-real=nan #-fno-range-check ,precision,denormal,underflow
67 STD_GNU = -std=f2003 -fall-intrinsics
68 OPT_GNU = -O3
69 OMP_GNU = -fopenmp
70 # Intel
71 WRN_INT = -warn all
72 CHK_INT = -check all
73 DEB_INT = -debug all -extend-source 132 -fpe-all=0 -fp-stack-check -fstack-protector-all -ftrapuv -no-ftz -traceback -gen-interfaces
74 STD_INT = -std03
75 OPT_INT = -O3 -ipo -inline all -ipo-jobs4 -vec-report1
76 OMP_INT = -openmp
77 # setting rules according user options
78 ifeq "$(COMPILER)" "gnu"
79  FC = gfortran
80  OPTSC = -cpp -c -J$(DMOD) -static -fprotect-parens -fno-realloc-lhs
81  OPTSL =
82  WRN = $(WRN_GNU)
83  CHK = $(CHK_GNU)
84  DEB = $(DEB_GNU)
85  STD = $(STD_GNU)
86  OPT = $(OPT_GNU)
87 endif
88 ifeq "$(COMPILER)" "intel"
89  FC = ifort
90  OPTSC = -cpp -c -module $(DMOD) -static -assume protect_parens -assume norealloc_lhs -fp-model source
91  OPTSL =
92  WRN = $(WRN_INT)
93  CHK = $(CHK_INT)
94  DEB = $(DEB_INT)
95  STD = $(STD_INT)
96  OPT = $(OPT_INT)
97 endif
98 ifeq "$(DEBUG)" "yes"
99  PREPROC := $(PREPROC) -DDEBUG
100  OPTSC := $(OPTSC) -O0 -C -g $(WRN) $(CHK) $(DEB)
101  OPTSL := $(OPTSL) -O0 -C -g $(WRN) $(CHK) $(DEB)
102 endif
103 ifeq "$(F03STD)" "yes"
104  OPTSC := $(OPTSC) $(STD)
105  OPTSL := $(OPTSL) $(STD)
106 endif
107 ifeq "$(OPTIMIZE)" "yes"
108  OPTSC := $(OPTSC) $(OPT)
109  OPTSL := $(OPTSL) $(OPT)
110 endif
111 ifeq "$(OPENMP)" "yes"
112  PREPROC := $(PREPROC) -DOPENMP
113  OPTSC := $(OPTSC) $(OMP)
114  OPTSL := $(OPTSL) $(OMP)
115 endif
116 OPTSC := $(OPTSC) $(PREPROC)
117 OPTSL := $(OPTSL) $(PREPROC)
118 
119 WHICHFC = $(shell which $(FC))
120 
121 PRINTCHK = "\\033[1;31m Compiler used \\033[0m\\033[1m $(COMPILER) => $(WHICHFC)\\033[0m \n\
122  \\033[1;31mSource dir \\033[0m\\033[1m $(DSRC)\\033[0m \n\
123  \\033[1;31m Debug \\033[0m\\033[1m $(DEBUG)\\033[0m \n\
124  \\033[1;31m F-standard \\033[0m\\033[1m $(F03STD)\\033[0m \n\
125  \\033[1;31m Optimize \\033[0m\\033[1m $(OPTIMIZE)\\033[0m"
126 #-----------------------------------------------------------------------------------------------------------------------------------
127 
128 #-----------------------------------------------------------------------------------------------------------------------------------
129 # auxiliary rules
130 .PHONY : PRINTINFO
131 .NOTPARALLEL : PRINTINFO
132 PRINTINFO:
133  @echo | tee make.log
134  @echo -e $(PRINTCHK) | tee -a make.log
135  @echo | tee -a make.log
136  @echo -e "\033[1;31m Compiling options\033[0m" | tee -a make.log
137  @echo -e "\033[1m [$(OPTSC)]\033[0m" | tee -a make.log
138  @echo | tee -a make.log
139  @echo -e "\033[1;31m Linking options \033[0m" | tee -a make.log
140  @echo -e "\033[1m [$(OPTSL)]\033[0m" | tee -a make.log
141  @echo | tee -a make.log
142 
143 .PHONY : $(MKDIRS)
144 $(MKDIRS):
145  @mkdir -p $@
146 
147 .PHONY : cleanobj
148 cleanobj:
149  @echo -e "\033[1;31m deleting objects \033[0m" | tee make.log
150  @rm -fr $(DOBJ)
151 
152 .PHONY : cleanmod
153 cleanmod:
154  @echo -e "\033[1;31m deleting mods \033[0m" | tee -a make.log
155  @rm -fr $(DMOD)
156 
157 .PHONY : cleanexe
158 cleanexe:
159  @echo -e "\033[1;31m deleting exes \033[0m" | tee -a make.log
160  @rm -f $(addprefix $(DEXE),DCS)
161 
162 .PHONY : cleanmsg
163 cleanmsg:
164  @rm -f diagnostic_messages
165  @rm -f error_messages
166 
167 .PHONY : clean
168 clean: cleanobj cleanmod cleanmsg
169 
170 .PHONY : cleanall
171 cleanall: clean cleanexe
172 
173 .PHONY : tar
174 tar: cleanall
175  @echo -e "\033[1;31m Creating tar archive of the code \033[0m" | tee make.log
176  @rm -f Driven_Cavity
177  @mkdir -p Driven_Cavity
178  @cp -rL src makefile Driven_Cavity/
179  @tar czf Driven_Cavity.tgz Driven_Cavity
180  @rm -rf Driven_Cavity
181 
182 .PHONY : doc
183 doc:
184  @echo -e "\033[1;31m Building documentation\033[0m" | tee make.log
185  @doxygen .doxygenconfig
186 #-----------------------------------------------------------------------------------------------------------------------------------
187 
188 #-----------------------------------------------------------------------------------------------------------------------------------
189 # rules of linking and compiling
190 COTEXT = -e "\033[1;31m Compiling\033[0m\033[1m $(<F)\033[0m"
191 LITEXT = -e "\033[1;31m Assembling\033[0m\033[1m $@\033[0m"
192 
193 $(DEXE)DCS : PRINTINFO $(MKDIRS) $(DOBJ)dcs.o
194  @echo | tee -a make.log
195  @echo $(LITEXT) | tee -a make.log
196  @$(FC) $(OPTSL) $(DOBJ)*.o $(LIBS) -o $@ 1>> diagnostic_messages 2>> error_messages
197 
198 $(DOBJ)ir_precision.o : IR_Precision.f90
199  @echo $(COTEXT) | tee -a make.log
200  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
201 
202 $(DOBJ)data_type_conservative.o : Data_Type_Conservative.f90 \
203  $(DOBJ)ir_precision.o
204  @echo $(COTEXT) | tee -a make.log
205  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
206 
207 $(DOBJ)data_type_cell_quad.o : Data_Type_Cell_Quad.f90 \
208  $(DOBJ)ir_precision.o \
209  $(DOBJ)data_type_face.o
210  @echo $(COTEXT) | tee -a make.log
211  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
212 
213 $(DOBJ)data_type_cavity.o : Data_Type_Cavity.f90 \
214  $(DOBJ)ir_precision.o \
215  $(DOBJ)data_type_conservative.o \
216  $(DOBJ)data_type_mesh.o
217  @echo $(COTEXT) | tee -a make.log
218  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
219 
220 $(DOBJ)data_type_face.o : Data_Type_Face.f90 \
221  $(DOBJ)ir_precision.o \
222  $(DOBJ)data_type_node.o \
223  $(DOBJ)data_type_vector.o
224  @echo $(COTEXT) | tee -a make.log
225  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
226 
227 $(DOBJ)data_type_mesh.o : Data_Type_Mesh.f90 \
228  $(DOBJ)ir_precision.o \
229  $(DOBJ)data_type_cell_quad.o \
230  $(DOBJ)data_type_node.o \
231  $(DOBJ)data_type_face.o
232  @echo $(COTEXT) | tee -a make.log
233  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
234 
235 $(DOBJ)data_type_node.o : Data_Type_Node.f90 \
236  $(DOBJ)ir_precision.o \
237  $(DOBJ)data_type_vector.o
238  @echo $(COTEXT) | tee -a make.log
239  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
240 
241 $(DOBJ)data_type_vector.o : Data_Type_Vector.f90 \
242  $(DOBJ)ir_precision.o
243  @echo $(COTEXT) | tee -a make.log
244  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
245 
246 $(DOBJ)dcs.o : DCS.f90 \
247  $(DOBJ)ir_precision.o \
248  $(DOBJ)data_type_cavity.o \
249  $(DOBJ)data_type_conservative.o \
250  $(DOBJ)data_type_mesh.o
251  @echo $(COTEXT) | tee -a make.log
252  @$(FC) $(OPTSC) $< -o $@ 1>> diagnostic_messages 2>> error_messages
253 #-----------------------------------------------------------------------------------------------------------------------------------
This module contains the definition of Type_Node and its procedures.
This module contains the definition of Type_Cavity and its procedures.
This module contains the definition of Type_Face and its procedures.
program dcs
DCS is an Open source program for simulating driven cavity problems.
Definition: DCS.f90:98
This module contains the definition of Type_Vector and its procedures.
This module contains the definition of Type_Conservative and its procedures.
SHELL
Definition: makefile:6
This module contains the definition of Type_Mesh and its procedures.
This module contains the definition of Type_Cell_Quad and its procedures.
Module IR_Precision makes available some portable kind-parameters and some useful procedures to deal ...