1 | include $(DOMHOME)/HOSTS/$(DOM_HOSTTYPE)/makefile.h 2 | 3 | # 4 | # Version and outpath 5 | # ------------------- 6 | # 7 | 8 | HOST = $(DOMHOME)/HOSTS/$(DOM_HOSTTYPE) 9 | OUT = $(HOST) 10 | 11 | # 12 | # Remove .f files? (yes/no) 13 | # ----------------- 14 | # 15 | 16 | CLEANf = yes 17 | 18 | 19 | # 20 | # Sources directories 21 | # ------------------- 22 | # 23 | 24 | FUNC = $(DOMHOME)/SOURCES/FUNCTIONS 25 | INOUT = $(DOMHOME)/SOURCES/INOUT 26 | MAIN = $(DOMHOME)/SOURCES/MAIN 27 | MASTR = $(DOMHOME)/SOURCES/MAIN/MASTER 28 | MODEL = $(DOMHOME)/SOURCES/MODEL 29 | MODIR = $(DOMHOME)/SOURCES/MODULES 30 | QUAD = $(DOMHOME)/SOURCES/QUADRATURE 31 | SCHM = $(DOMHOME)/SOURCES/SCHEMES 32 | SLAVE = $(DOMHOME)/SOURCES/MAIN/SLAVE 33 | 34 | INCFILE = $(HOST)/dom.inc 35 | 36 | # 37 | # Suffixes 38 | # -------- 39 | 40 | .SUFFIXES: 41 | .SUFFIXES:.o .F .HH .h .c 42 | 43 | # 44 | # Executable files 45 | # ---------------- 46 | # 47 | 48 | DOMEXEC = $(OUT)/mpiprissma_$(DOM_VERSION).e_$(DOM_HOSTTYPE) 49 | LIBDOM = $(OUT)/mpiprissma.a 50 | 51 | # 52 | # Modules 53 | # ------- 54 | # 55 | 56 | MODULES = \ 57 | $(MAIN)/mod_pmm \ 58 | $(MAIN)/mod_inout \ 59 | $(SLAVE)/mod_slave \ 60 | $(MASTR)/mod_prissma \ 61 | $(MAIN)/mod_ftn_c 62 | 63 | # 64 | # File dependency 65 | # --------------- 66 | # 67 | 68 | D1 = $(MAIN)/mod_pmm 69 | D2 = $(MAIN)/mod_inout 70 | D3 = $(SLAVE)/mod_slave 71 | D4 = $(MAIN)/mod_ftn_c $(SLAVE)/mod_slave $(MAIN)/mod_inout $(MAIN)/mod_pmm 72 | D5 = $(MASTR)/mod_prissma $(MAIN)/mod_inout $(SLAVE)/mod_slave 73 | D6 = $(MAIN)/mod_pmm $(MAIN)/mod_inout 74 | D8 = $(MASTR)/mod_prissma $(MAIN)/mod_inout $(MAIN)/mod_pmm 75 | D9 = $(SLAVE)/mod_slave $(MAIN)/mod_inout $(MAIN)/mod_pmm 76 | 77 | D10= $(MAIN)/mod_pmm $(MAIN)/mod_inout $(SLAVE)/mod_slave 78 | D11= $(SLAVE)/mod_slave $(MAIN)/mod_pmm 79 | 80 | # 81 | # Independent files 82 | # ----------------- 83 | # 84 | 85 | FUNC_= \ 86 | $(FUNC)/blae \ 87 | $(FUNC)/planck \ 88 | $(FUNC)/heap_sort \ 89 | $(FUNC)/rcb \ 90 | $(FUNC)/qsort_C \ 91 | 92 | INOUT_ = \ 93 | $(INOUT)/readtab 94 | 95 | MODEL_= \ 96 | $(MODEL)/findi \ 97 | $(MODEL)/tmno 98 | 99 | QUAD_= \ 100 | $(QUAD)/cdss \ 101 | $(QUAD)/pdf \ 102 | $(QUAD)/cofg \ 103 | $(QUAD)/gauleg \ 104 | $(QUAD)/k_distributeur 105 | 106 | # 107 | # Module dependency 108 | # ----------------- 109 | # 110 | 111 | SUB_D0 = $(FUNC_) $(INOUT_) $(MODEL_) $(QUAD_) $(SCHM_) 112 | 113 | SUB_D1 = \ 114 | $(MAIN)/pmm_begin \ 115 | $(MAIN)/pmm_end \ 116 | $(MAIN)/pmm_sendpartition \ 117 | $(MODEL)/emissiv \ 118 | $(MODEL)/emissiv_snb \ 119 | $(MAIN)/mpiprissma \ 120 | $(MASTR)/master 121 | 122 | SUB_D2 = \ 123 | $(MAIN)/pmm_readinput \ 124 | 125 | SUB_D3 = \ 126 | $(SLAVE)/slave_partition \ 127 | $(SCHM)/spatial_scheme \ 128 | $(FUNC)/find_ibnd \ 129 | $(FUNC)/find_ivirt \ 130 | $(MODEL)/kbarandphi 131 | 132 | SUB_D4 = \ 133 | $(INOUT)/read_data_slave 134 | 135 | SUB_D5 = \ 136 | $(INOUT)/outprocessing 137 | 138 | SUB_D6 = \ 139 | $(MASTR)/master_control 140 | 141 | SUB_D8 = \ 142 | $(MASTR)/master_integrate \ 143 | $(INOUT)/read_data \ 144 | $(MASTR)/partition \ 145 | $(MASTR)/meshpartition 146 | 147 | SUB_D9 = \ 148 | $(SLAVE)/slave_meshpartition \ 149 | $(SCHM)/band_integ \ 150 | $(SCHM)/band_integ_snb \ 151 | $(slave.F.html">SLAVE)/slave \ 152 | $(SCHM)/deri_kappa \ 153 | $(SCHM)/deri_kappa_snb 154 | 155 | SUB_D10 = \ 156 | $(MODEL)/fsk_case \ 157 | $(MODEL)/tfsk_case \ 158 | $(MODEL)/fsck_case \ 159 | $(MODEL)/tfsck_case \ 160 | $(MODEL)/ck_case \ 161 | $(MODEL)/wsgg_case \ 162 | $(INOUT)/postprocessing 163 | 164 | SUB_D11 = \ 165 | $(INOUT)/param_slave \ 166 | $(SLAVE)/slave_receive \ 167 | $(FUNC)/gather \ 168 | $(FUNC)/gather_faces \ 169 | $(FUNC)/scatter \ 170 | $(FUNC)/volaverage 171 | 172 | # 173 | # Constants 174 | # --------- 175 | # 176 | 177 | CONSTS = \ 178 | $(MAIN)/dom_constants.h \ 179 | $(MAIN)/pmm_constants.h 180 | 181 | # 182 | # Subroutine compilation order 183 | # ---------------------------- 184 | # 185 | 186 | SUB = \ 187 | $(SUB_D0) \ 188 | $(SUB_D1) \ 189 | $(SUB_D2) \ 190 | $(SUB_D3) \ 191 | $(SUB_D4) \ 192 | $(SUB_D5) \ 193 | $(SUB_D6) \ 194 | $(SUB_D8) \ 195 | $(SUB_D9) \ 196 | $(SUB_D10) \ 197 | $(SUB_D11) 198 | 199 | # 200 | # All objects 201 | # ----------- 202 | # 203 | 204 | ALL_OBJ = $(MODULES:=.o) $(SUB:=.o) 205 | 206 | # 207 | # Compilation 208 | # ----------- 209 | # 210 | 211 | all : test_lib link_dominc link_const allmodules subroutines 212 | @echo 213 | @echo "****************************************" 214 | @echo 215 | @echo "Linking Object Files ...." 216 | @echo 217 | @$(FF) $(LDFLAGS) -o $(DOMEXEC) $(ALL_OBJ) $(PLIBS) 218 | @chmod a+x $(DOMEXEC) 219 | @echo "Removing include files" 220 | @$(RM) dom.inc *.h *_m4.F90 *.c *.o *.mod 221 | @echo 222 | @echo "Executable created :" 223 | @echo $(DOMEXEC) 224 | @echo 225 | @echo "****************************************" 226 | @echo 227 | 228 | allmodules : $(MODULES:=.o) 229 | 230 | subroutines : $(SUB:=.o) 231 | 232 | $(SUB_D1:=.o) : $(D1:=.mod) 233 | 234 | $(SUB_D2:=.o) : $(D2:=.mod) 235 | 236 | $(SUB_D3:=.o) : $(D3:=.mod) 237 | 238 | $(SUB_D4:=.o) : $(D4:=.mod) 239 | 240 | $(SUB_D5:=.o) : $(D5:=.mod) 241 | 242 | $(SUB_D6:=.o) : $(D6:=.mod) 243 | 244 | $(SUB_D7:=.o) : $(D7:=.mod) 245 | 246 | $(SUB_D8:=.o) : $(D8:=.mod) 247 | 248 | $(SUB_D9:=.o) : $(D9:=.mod) 249 | 250 | $(SUB_D10:=.o) : $(D10:=.mod) 251 | 252 | $(SUB_D11:=.o) : $(D11:=.mod) 253 | 254 | link_dominc : 255 | @echo 256 | @echo "****************************************" 257 | @echo "Linking dom.inc" 258 | @$(RM) dom.inc 259 | @$(LN) $(INCFILE) . 260 | @echo "****************************************" 261 | @echo 262 | 263 | link_const : $(CONSTS) 264 | @echo 265 | @echo "****************************************" 266 | @echo "Linking .h files" 267 | @$(RM) *.h 268 | @$(LN) $(CONSTS) . 269 | @echo "****************************************" 270 | @echo 271 | 272 | test_lib : 273 | @-if [ -f $(LIBDOM) ]; then echo; fi 274 | @-if [ -f $(LIBDOM) ]; then echo "****************************************"; fi 275 | @-if [ -f $(LIBDOM) ]; then echo "Cleaning previous coupling librairy"; fi 276 | @-if [ -f $(LIBDOM) ]; then touch `grep -Rli USEPALM $(DOMHOME)/SOURCES | grep -v \.svn`; $(RM) $(LIBDOM); fi 277 | @-if [ -f $(LIBDOM) ]; then echo "****************************************"; fi 278 | @-if [ -f $(LIBDOM) ]; then echo; fi 279 | 280 | # 281 | # Cleaning 282 | # -------- 283 | # 284 | 285 | clean : clean_obj clean_modules clean_const 286 | 287 | clean_const : 288 | @echo 289 | @echo "****************************************" 290 | @echo 291 | @echo "Removing *.h files " 292 | @echo 293 | @$(RM) $(CONSTS) 294 | @$(RM) *.h ./dom.inc 295 | @echo 296 | @echo "****************************************" 297 | 298 | clean_modules : 299 | @echo 300 | @echo "****************************************" 301 | @echo 302 | @echo "Removing *.mod files " 303 | @echo 304 | @$(RM) *.mod 305 | @$(RM) $(MODULES:=.mod) 306 | @echo 307 | @echo "****************************************" 308 | 309 | clean_obj : 310 | @echo 311 | @echo "****************************************" 312 | @echo 313 | @echo "Removing *.f files " 314 | @echo 315 | @$(RM) $(ALL_OBJ) 316 | @$(RM) $(ALL_OBJ:%.o=%_m4.F90) 317 | @$(RM) *.o 318 | @echo 319 | @echo "****************************************" 320 | 321 | # 322 | # Suffix rules 323 | # ------------ 324 | # 325 | 326 | .F.o : 327 | @echo 328 | @echo "****************************************" 329 | @echo "Preprocessing " $*.F 330 | @$(M4DIR) $*.F > $*_m4.F90 331 | @sed '1d' $*_m4.F90 > tmp_m4.F90 332 | @$(MV) tmp_m4.F90 $*_m4.F90 333 | @echo "Compiling " $*_m4.F90 334 | @$(FF) -I./ -I$(MASTR) -I$(MAIN) -I$(SLAVE) -c $(FFLAGS) $*_m4.F90 335 | @-if [ -f $(notdir $*).mod ] ; then $(CP) $(notdir $*).mod $*.mod ; fi 336 | @$(MV) *.o $*.o 337 | @-if(test $(CLEANf) = yes) then $(RM) $*_m4.F90 ; fi 338 | @echo "****************************************" 339 | @echo 340 | 341 | .HH.h : 342 | @echo 343 | @echo "****************************************" 344 | @echo "Preprocessing " $*.HH 345 | @$(M4DIR) $*.HH > $*.h 346 | @-touch $*.h 347 | @echo "****************************************" 348 | @echo 349 | 350 | %.o : %.c 351 | @echo 352 | @echo "****************************************" 353 | @echo "Compiling " $*.c 354 | @$(CC) $(CFLAGS) -c -o $@ $(@:%.o=%.c) 355 | @echo "****************************************" 356 | @echo