1 | #!/bin/ksh |
---|
2 | |
---|
3 | # mbuild - script for compiling the PALM code and its utility programs |
---|
4 | |
---|
5 | #--------------------------------------------------------------------------------# |
---|
6 | # This file is part of PALM. |
---|
7 | # |
---|
8 | # PALM is free software: you can redistribute it and/or modify it under the terms |
---|
9 | # of the GNU General Public License as published by the Free Software Foundation, |
---|
10 | # either version 3 of the License, or (at your option) any later version. |
---|
11 | # |
---|
12 | # PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
13 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
14 | # A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
15 | # |
---|
16 | # You should have received a copy of the GNU General Public License along with |
---|
17 | # PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | # |
---|
19 | # Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
20 | #--------------------------------------------------------------------------------# |
---|
21 | # |
---|
22 | # Current revisions: |
---|
23 | # ------------------ |
---|
24 | # |
---|
25 | # |
---|
26 | # Former revisions: |
---|
27 | # ----------------- |
---|
28 | # $Id: mbuild 1805 2016-04-05 16:32:34Z gronemeier $ |
---|
29 | # |
---|
30 | # 1804 2016-04-05 16:30:18Z maronga |
---|
31 | # Removed parameter file check |
---|
32 | # |
---|
33 | # 1652 2015-09-17 08:12:24Z raasch |
---|
34 | # bugfix for terminal output of configuration settings removed, |
---|
35 | # output of login init commands |
---|
36 | # |
---|
37 | # 1621 2015-07-17 11:39:33Z heinze |
---|
38 | # adjustments for Mistral at DKRZ Hamburg (lcbullhh) |
---|
39 | # |
---|
40 | # 1613 2015-07-08 14:53:29Z maronga |
---|
41 | # nc2vdf removed |
---|
42 | # |
---|
43 | # 1547 2015-01-29 15:09:12Z witha |
---|
44 | # adjustments for ForWind computing cluster (lcflow) |
---|
45 | # |
---|
46 | # 1487 2014-10-25 14:36:28Z raasch |
---|
47 | # bash compatibility adjustments: output formatting with printf instead |
---|
48 | # of "typeset -L/-R", print replaced by echo |
---|
49 | # |
---|
50 | # 1468 2014-09-24 14:06:57Z maronga |
---|
51 | # Typo removed (addres->address) |
---|
52 | # Adjustments for lcxe6 |
---|
53 | # |
---|
54 | # 1390 2014-05-06 07:57:37Z maronga |
---|
55 | # disabled compilation of parameter file check (currently not working), |
---|
56 | # adjustments for lcxe6 |
---|
57 | # |
---|
58 | # 1388 2014-05-06 07:42:38Z maronga |
---|
59 | # small adjustments for lcxe6 |
---|
60 | # |
---|
61 | # 1350 2014-04-04 13:01:30Z maronga |
---|
62 | # init_cmds is now executed before module calls in case of compilation on local |
---|
63 | # host |
---|
64 | # |
---|
65 | # 1289 2014-03-04 07:12:34Z raasch |
---|
66 | # comments translated from German to English |
---|
67 | # fimm-, scirocco-, ibmy-, and sgi-specific code removed |
---|
68 | # |
---|
69 | # 1274 2014-01-09 13:14:54Z heinze |
---|
70 | # adjustments for lccrayh |
---|
71 | # |
---|
72 | # 1255 2013-11-07 14:43:35Z raasch |
---|
73 | # further adjustments for lccrayb remote access |
---|
74 | # |
---|
75 | # 1229 2013-09-20 06:55:19Z raasch |
---|
76 | # adjustments for lccrayb |
---|
77 | # |
---|
78 | # 1216 2013-08-26 09:31:42Z raasch |
---|
79 | # RCS renamed SOURCES |
---|
80 | # |
---|
81 | # 1210 2013-08-14 10:58:20Z raasch |
---|
82 | # fftw support added |
---|
83 | # |
---|
84 | # 1197 2013-07-04 06:19:45Z raasch |
---|
85 | # adjustments for CSC Helsinki (lccrayf) |
---|
86 | # |
---|
87 | # 1099 2013-02-10 01:47:43Z raasch |
---|
88 | # adjustments for Forwind cluster (lcflow) |
---|
89 | # |
---|
90 | # 1096 2013-02-03 01:52:12Z raasch |
---|
91 | # decalpha parts (yonsei) removed |
---|
92 | # |
---|
93 | # 2013-02-02 07:06:13Z raasch |
---|
94 | # adjustments for Kyushu-University computing center (lckyut) |
---|
95 | # old changelog messages removed |
---|
96 | # |
---|
97 | # 1083 2013-01-04 10:22:09Z maronga |
---|
98 | # bugfix in parameter file check (in case that no preprocessor flag, i.e. -cpp was |
---|
99 | # set in %cpp_options, the last directive in the variable was processed. |
---|
100 | # |
---|
101 | # 1081 2013-01-03 08:44:36Z maronga |
---|
102 | # loader options set for parameter file check_depository_path |
---|
103 | # |
---|
104 | # 1069 2012-11-28 16:18:43Z maronga |
---|
105 | # added copy of nc2vdf tools to remote host_found |
---|
106 | # |
---|
107 | # 1046 2012-11-09 14:38:45Z maronga |
---|
108 | # code put under GPL (PALM 3.9) |
---|
109 | # |
---|
110 | # 12/06/02 - Siggi - first version finished |
---|
111 | # 06/05/02 - Siggi - script development started |
---|
112 | # |
---|
113 | #--------------------------------------------------------------------------------# |
---|
114 | # mbuild - script for compiling the PALM code and its utility programs |
---|
115 | # |
---|
116 | # Procedure to compile code on local and remote hosts using the |
---|
117 | # make-mechanism. The source code must be provided on the local host. |
---|
118 | #--------------------------------------------------------------------------------# |
---|
119 | |
---|
120 | |
---|
121 | # VARIABLE DECLARATIONS + DEFAULT VALUES |
---|
122 | block_conditions=none |
---|
123 | block_conditions_found=false |
---|
124 | calltime="" |
---|
125 | column1="" |
---|
126 | column2="" |
---|
127 | compile_utility_programs=false |
---|
128 | config_file=.mrun.config |
---|
129 | host=all |
---|
130 | host_found=false |
---|
131 | locat=normal |
---|
132 | makefile="" |
---|
133 | module_calls="" |
---|
134 | util_compiled_localhost=false |
---|
135 | silent=false |
---|
136 | suf=f90 |
---|
137 | update=false |
---|
138 | version="MBUILD 2.1 Rev$Rev: 1805 $" |
---|
139 | working_directory=`pwd` |
---|
140 | |
---|
141 | typeset -i ih ihost=0 |
---|
142 | |
---|
143 | |
---|
144 | # ERROR HANDLING |
---|
145 | # IN CASE OF EXIT: |
---|
146 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
147 | if [[ $locat != normal ]] |
---|
148 | then |
---|
149 | printf "\n\n +++ mbuild killed \n\n" |
---|
150 | else |
---|
151 | printf "\n\n *** mbuild finished \n\n" |
---|
152 | fi' exit |
---|
153 | |
---|
154 | |
---|
155 | # IN CASE OF TERMINAL-BREAK: |
---|
156 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
157 | printf "\n\n +++ mbuild killed by \"^C\" \n\n" |
---|
158 | exit |
---|
159 | ' 2 |
---|
160 | |
---|
161 | |
---|
162 | tmp_mbuild=${working_directory}/tmp_mbuild |
---|
163 | |
---|
164 | # READ SHELLSCRIPT-OPTIONS |
---|
165 | while getopts :c:h:K:m:s:uv option |
---|
166 | do |
---|
167 | case $option in |
---|
168 | (c) config_file=$OPTARG;; |
---|
169 | (h) host=$OPTARG;; |
---|
170 | (K) block_conditions=$OPTARG;; |
---|
171 | (m) makefile=$OPTARG;; |
---|
172 | (s) suf=$OPTARG;; |
---|
173 | (u) compile_utility_programs=true;; |
---|
174 | (v) silent=true;; |
---|
175 | (\?) printf "\n +++ unknown option $OPTARG \n"; |
---|
176 | locat=parameter; exit;; |
---|
177 | esac |
---|
178 | done |
---|
179 | |
---|
180 | |
---|
181 | |
---|
182 | # CHECK, IF CONFIGURATION-FILE EXISTS |
---|
183 | if [[ ! -f $config_file ]] |
---|
184 | then |
---|
185 | printf "\n +++ configuration file: " |
---|
186 | printf "\n $config_file" |
---|
187 | printf "\n does not exist" |
---|
188 | locat=configuration; exit |
---|
189 | fi |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | # DETERMINE THE LOCAL HOST |
---|
194 | local_host_real_name=$(hostname) |
---|
195 | local_address=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{echo $2}') |
---|
196 | |
---|
197 | |
---|
198 | |
---|
199 | # DETERMINE HOST-IDENTIFIER (local_host) FROM THE CONFIG-FILE |
---|
200 | line="" |
---|
201 | grep "%host_identifier" $config_file > $tmp_mbuild |
---|
202 | while read line |
---|
203 | do |
---|
204 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
205 | then |
---|
206 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
207 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
208 | if [[ $local_host_real_name = $HOSTNAME ]] |
---|
209 | then |
---|
210 | local_host=$host_identifier |
---|
211 | break |
---|
212 | fi |
---|
213 | fi |
---|
214 | done < $tmp_mbuild |
---|
215 | |
---|
216 | if [[ "$local_host" = "" ]] |
---|
217 | then |
---|
218 | printf "\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
219 | printf "\n for local host \"$local_host_real_name\"." |
---|
220 | printf "\n Please add line" |
---|
221 | printf "\n \"\%host_identifier $local_host_real_name <identifier>\"" |
---|
222 | printf "\n to the configuration file." |
---|
223 | locat=local_host; exit |
---|
224 | fi |
---|
225 | |
---|
226 | |
---|
227 | if [[ $local_host != ibms ]] |
---|
228 | then |
---|
229 | config_file=$PWD/$config_file |
---|
230 | else |
---|
231 | config_file=`pwd`/$config_file |
---|
232 | fi |
---|
233 | |
---|
234 | |
---|
235 | # DETERMINE THE BLOCK CONDITIONS |
---|
236 | if [[ $block_conditions != none ]] |
---|
237 | then |
---|
238 | block_condition1=`echo $block_conditions | cut -d" " -f1` |
---|
239 | block_condition2=`echo $block_conditions | cut -d" " -f2` |
---|
240 | if [[ "$block_condition2" = "$block_condition1" ]] |
---|
241 | then |
---|
242 | block_condition2="" |
---|
243 | fi |
---|
244 | fi |
---|
245 | |
---|
246 | |
---|
247 | # DETERMINE USER NAME ON LOCAL HOST FROM THE CONFIG-FILE |
---|
248 | line="" |
---|
249 | grep " $local_host" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
250 | while read line |
---|
251 | do |
---|
252 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
253 | then |
---|
254 | local_username=`echo $line | cut -d" " -s -f2` |
---|
255 | fi |
---|
256 | done < $tmp_mbuild |
---|
257 | |
---|
258 | |
---|
259 | if [[ "$local_username" = "" ]] |
---|
260 | then |
---|
261 | printf "\n +++ no user name found in configuration file" |
---|
262 | printf "\n for local host \"$local_host\" " |
---|
263 | locat=config_file; exit |
---|
264 | fi |
---|
265 | |
---|
266 | |
---|
267 | # DETERMINE LOCAL SOURCE-CODE PATH. |
---|
268 | # FIRST CHECK, IF A GLOBAL SOURCE-CODE PATH HAS BEEN DECLARED FOR ALL HOSTS. |
---|
269 | # THEREFORE, FIRST SET ALL GLOBAL VARIABLES DECLARED IN THE CONFIG-FILE, |
---|
270 | # BECAUSE THEY MAY BE USED AS PART OF THE PATH NAME. |
---|
271 | line="" |
---|
272 | grep "%" $config_file > $tmp_mbuild |
---|
273 | while read line |
---|
274 | do |
---|
275 | if [[ "$line" != "" && "$(echo $line | cut -d" " -s -f3)" = "" && $(echo $line | cut -c1) != "#" ]] |
---|
276 | then |
---|
277 | var=`echo $line | cut -d" " -s -f1 | cut -c2-` |
---|
278 | value=`echo $line | cut -d" " -s -f2` |
---|
279 | eval export $var=\$value |
---|
280 | fi |
---|
281 | done < $tmp_mbuild |
---|
282 | |
---|
283 | # NOW CHECK, IF A GLOBAL SOURCE-CODE-PATH HAS BEEN DECLARED |
---|
284 | line="" |
---|
285 | grep "%source_path" $config_file > $tmp_mbuild |
---|
286 | while read line |
---|
287 | do |
---|
288 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
289 | then |
---|
290 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
291 | then |
---|
292 | global_source_path=`echo $line | cut -d" " -s -f2` |
---|
293 | fi |
---|
294 | fi |
---|
295 | done < $tmp_mbuild |
---|
296 | |
---|
297 | line="" |
---|
298 | grep " $local_host" $config_file | grep "%source_path" > $tmp_mbuild |
---|
299 | while read line |
---|
300 | do |
---|
301 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
302 | then |
---|
303 | local_source_path=`echo $line | cut -d" " -s -f2` |
---|
304 | fi |
---|
305 | done < $tmp_mbuild |
---|
306 | |
---|
307 | if [[ "$local_source_path" = "" ]] |
---|
308 | then |
---|
309 | if [[ "$global_source_path" != "" ]] |
---|
310 | then |
---|
311 | local_source_path=$global_source_path |
---|
312 | else |
---|
313 | printf "\n +++ no source path found in configuration file" |
---|
314 | printf "\n for local host \"$local_host\" " |
---|
315 | printf "\n please set \"\%source_path\" in configuration file" |
---|
316 | locat=config_file; exit |
---|
317 | fi |
---|
318 | fi |
---|
319 | eval local_source_path=$local_source_path |
---|
320 | eval local_source_path=$local_source_path |
---|
321 | |
---|
322 | |
---|
323 | |
---|
324 | # DETERMINE GLOBAL DEPOSITORY-PATH |
---|
325 | line="" |
---|
326 | grep "%depository_path" $config_file > $tmp_mbuild |
---|
327 | while read line |
---|
328 | do |
---|
329 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
330 | then |
---|
331 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
332 | then |
---|
333 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
334 | fi |
---|
335 | fi |
---|
336 | done < $tmp_mbuild |
---|
337 | |
---|
338 | if [[ $found = false ]] |
---|
339 | then |
---|
340 | printf "\n +++ no \%depository_path found in" |
---|
341 | printf "\n $config_file" |
---|
342 | locat=depository_path; exit |
---|
343 | fi |
---|
344 | |
---|
345 | # CHECK, IF A MAIN PROGRAM HAS BEEN DEFINED IN THE CONFIG-FILE |
---|
346 | if [[ $(grep -c "%mainprog" $config_file) != 1 ]] |
---|
347 | then |
---|
348 | printf "\n +++ no main program or more than one main program defined" |
---|
349 | printf "\n in configuration file" |
---|
350 | locat=configuration; exit |
---|
351 | else |
---|
352 | line=`grep "%mainprog" $config_file` |
---|
353 | if [[ "$line" = "" || $(echo $line | cut -c1) = "#" ]] |
---|
354 | then |
---|
355 | printf "\n +++ no main program defined in configuration file" |
---|
356 | locat=configuration; exit |
---|
357 | fi |
---|
358 | mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1` |
---|
359 | fi |
---|
360 | |
---|
361 | |
---|
362 | |
---|
363 | # CHECK IF MAKEFILE EXITS |
---|
364 | [[ "$makefile" = "" ]] && makefile=$local_source_path/Makefile |
---|
365 | if [[ ! -f $makefile ]] |
---|
366 | then |
---|
367 | printf "\n +++ makefile: " |
---|
368 | printf "\n $makefile" |
---|
369 | printf "\n does not exist" |
---|
370 | locat=makefile; exit |
---|
371 | fi |
---|
372 | |
---|
373 | |
---|
374 | # HEADER-OUTPUT (PART1: MESSAGES CONCERNING THE LOCAL HOST) |
---|
375 | calltime=$(date) |
---|
376 | printf "\n" |
---|
377 | printf "#------------------------------------------------------------------------# \n" |
---|
378 | printf "| %-40s%30s | \n" "$version" "$calltime" |
---|
379 | printf "| | \n" |
---|
380 | printf "| %-20s%-50s | \n" "called on:" "$local_host_real_name" |
---|
381 | printf "| %-20s%-50s | \n" "local username:" "$local_username" |
---|
382 | printf "| %-20s%-50s | \n" "local IP-address:" "$local_address" |
---|
383 | column2=$(echo $config_file | cut -c1-50 ) |
---|
384 | printf "| %-20s%-50s | \n" "config file:" "$column2" |
---|
385 | line=$(echo "$config_file" | cut -c51-) |
---|
386 | while [[ "$line" != "" ]] |
---|
387 | do |
---|
388 | column1="" |
---|
389 | column2=$(echo $line | cut -c1-50 ) |
---|
390 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
391 | line=$(echo "$line" | cut -c51-) |
---|
392 | done |
---|
393 | column2=$(echo $makefile | cut -c1-50 ) |
---|
394 | printf "| %-20s%-50s | \n" "makefile:" "$column2" |
---|
395 | line=$(echo "$makefile" | cut -c51-) |
---|
396 | while [[ "$line" != "" ]] |
---|
397 | do |
---|
398 | column1="" |
---|
399 | column2=$(echo $line | cut -c1-50 ) |
---|
400 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
401 | line=$(echo "$line" | cut -c51-) |
---|
402 | done |
---|
403 | column2=$(echo $local_source_path | cut -c1-50 ) |
---|
404 | printf "| %-20s%-50s | \n" "local source path:" "$column2" |
---|
405 | line=$(echo "$local_source_path" | cut -c51-) |
---|
406 | while [[ "$line" != "" ]] |
---|
407 | do |
---|
408 | column1="" |
---|
409 | column2=$(echo $line | cut -c1-50 ) |
---|
410 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
411 | line=$(echo "$line" | cut -c51-) |
---|
412 | done |
---|
413 | printf "#------------------------------------------------------------------------# \n" |
---|
414 | |
---|
415 | |
---|
416 | if [[ $compile_utility_programs = false ]] |
---|
417 | then |
---|
418 | |
---|
419 | # IN ANY CASE, GIVE ALL FILES WRITE-PERMIT, IN ORDER TO AVOID PROBLEMS |
---|
420 | # WITH OVERWRITING FILES ON THE REMOTE HOST |
---|
421 | cd $local_source_path |
---|
422 | printf "\n\n *** tar of makefile and source files in $local_source_path" |
---|
423 | tar -cf ${mainprog}_sources.tar Makefile *.$suf |
---|
424 | printf "\n" |
---|
425 | |
---|
426 | else |
---|
427 | cd $local_source_path |
---|
428 | printf "\n\n *** tar of makefile and source files in $local_source_path" |
---|
429 | |
---|
430 | cat Makefile_check|while read line |
---|
431 | do |
---|
432 | line=$(echo $line|grep SOURCES) |
---|
433 | if [[ $line == *"SOURCES"* ]] |
---|
434 | then |
---|
435 | line=$(echo $line|sed 's/SOURCES = //g') |
---|
436 | break |
---|
437 | fi |
---|
438 | done |
---|
439 | |
---|
440 | tar -cf ${mainprog}_sources_check.tar Makefile_check $line |
---|
441 | printf "\n" |
---|
442 | fi |
---|
443 | |
---|
444 | |
---|
445 | |
---|
446 | # GET CONFIRMATION TO CONTINUE |
---|
447 | if [[ $host = all ]] |
---|
448 | then |
---|
449 | printf "\n *** updates will be made for ALL hosts found in" |
---|
450 | printf "\n the configuration file" |
---|
451 | else |
---|
452 | printf "\n *** update will be made for host \"$host\" " |
---|
453 | fi |
---|
454 | |
---|
455 | if [[ $silent = false ]] |
---|
456 | then |
---|
457 | answer=dummy |
---|
458 | printf "\n\n" |
---|
459 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
460 | do |
---|
461 | printf " >>> continue (y/n) ? " |
---|
462 | read answer |
---|
463 | done |
---|
464 | if [[ $answer = n || $answer = N ]] |
---|
465 | then |
---|
466 | locat=user_abort; exit |
---|
467 | fi |
---|
468 | fi |
---|
469 | |
---|
470 | |
---|
471 | |
---|
472 | |
---|
473 | # GENERATE MODEL-VERSIONS FOR ALL HOST-BLOCKS |
---|
474 | # FOUND IN THE CONFIGURATION-FILE |
---|
475 | printf "\n *** scanning configuration file for host(s) ..." |
---|
476 | |
---|
477 | grep %fopts $config_file > $tmp_mbuild |
---|
478 | while read line |
---|
479 | do |
---|
480 | # SKIP COMMENT-LINES |
---|
481 | [[ $(echo $line | cut -c1) = "#" ]] && continue |
---|
482 | (( ihost = ihost + 1 )) |
---|
483 | hostline[$ihost]="$line" |
---|
484 | done < $tmp_mbuild |
---|
485 | |
---|
486 | |
---|
487 | while (( ih < ihost )) |
---|
488 | do |
---|
489 | |
---|
490 | (( ih = ih + 1 )) |
---|
491 | |
---|
492 | # DETERMINE REMOTE HOST AND CONDITIONS FOR THE RESPECTIVE BLOCK |
---|
493 | # CONTINUE, ONLY IF THIS HOST HAS BEEN CHOSEN VIA -h OPTION AND IF |
---|
494 | # CONDITIONS HAVE BEEN CHOSEN VIA -K OPTION |
---|
495 | remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-` |
---|
496 | remote_host=`echo $remote_host_string | cut -d" " -f1` |
---|
497 | if [[ $host != all ]] |
---|
498 | then |
---|
499 | [[ $remote_host != $host ]] && continue |
---|
500 | fi |
---|
501 | host_found=true |
---|
502 | condition1=`echo $remote_host_string | cut -d" " -s -f2` |
---|
503 | if [[ $condition1 = $remote_host ]] |
---|
504 | then |
---|
505 | condition1="" |
---|
506 | else |
---|
507 | condition2=`echo $remote_host_string | cut -d" " -s -f3` |
---|
508 | fi |
---|
509 | |
---|
510 | if [[ $block_conditions != none ]] |
---|
511 | then |
---|
512 | if [[ "$condition1" != "$block_condition1" || "$condition2" != "$block_condition2" ]] |
---|
513 | then |
---|
514 | continue |
---|
515 | fi |
---|
516 | block_conditions_found=true |
---|
517 | fi |
---|
518 | |
---|
519 | fftw_inc="" |
---|
520 | fftw_lib="" |
---|
521 | modules="" |
---|
522 | netcdf_inc="" |
---|
523 | netcdf_lib="" |
---|
524 | make_options="" |
---|
525 | |
---|
526 | # DETERMINE IP-ADDRES OF THE REMOTE-HOST |
---|
527 | case $remote_host in |
---|
528 | (lcbullhh) remote_address=136.172.50.13;; |
---|
529 | (lccrayb) remote_address=130.73.233.1;; |
---|
530 | (lccrayh) remote_address=130.75.4.1;; |
---|
531 | (lcflow) remote_address="flow02.hpc.uni-oldenburg.de";; |
---|
532 | (lckordi) remote_adress=210.219.61.8;; |
---|
533 | (lcmuk) remote_address=130.75.105.2;; |
---|
534 | (lcrte) remote_address=133.5.185.60;; |
---|
535 | (lcsb) remote_address=147.46.30.151;; |
---|
536 | (lck) remote_address=165.132.26.61;; |
---|
537 | (lckiaps) remote_address=118.128.66.223;; |
---|
538 | (lckyut) remote_address=133.5.4.37;; |
---|
539 | (lctit) remote_address=10.1.6.170;; |
---|
540 | (lcxe6) remote_address=129.177.20.113;; |
---|
541 | (lcxt5m) remote_address=193.166.211.144;; |
---|
542 | (ibmh) remote_address=136.172.40.15;; |
---|
543 | (ibmkisti) remote_address=150.183.146.24;; |
---|
544 | (ibmku) remote_address=133.5.4.129;; |
---|
545 | (ibms) remote_address=150.183.5.101;; |
---|
546 | (nech) remote_address=136.172.44.192;; |
---|
547 | (neck) remote_address=133.5.178.11;; |
---|
548 | (ground.yonsei.ac.kr) remote_address=134.75.155.33;; |
---|
549 | (*) if [[ $local_host != $remote_host ]] |
---|
550 | then |
---|
551 | printf "\n +++ remote host \"$remote_host\" unknown"; |
---|
552 | printf "\n please inform PALM group support!" |
---|
553 | locat=remote_host; exit |
---|
554 | fi;; |
---|
555 | esac |
---|
556 | |
---|
557 | |
---|
558 | # DETERMINE REMOTE-USERNAME |
---|
559 | line="" |
---|
560 | found=false |
---|
561 | grep "$remote_host_string" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
562 | while read line1 |
---|
563 | do |
---|
564 | |
---|
565 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
566 | then |
---|
567 | line="$line1" |
---|
568 | fi |
---|
569 | |
---|
570 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
571 | then |
---|
572 | remote_username=`echo $line | cut -d" " -s -f2` |
---|
573 | found=true |
---|
574 | fi |
---|
575 | |
---|
576 | done < $tmp_mbuild |
---|
577 | |
---|
578 | if [[ $found = false ]] |
---|
579 | then |
---|
580 | printf "\n +++ no remote username found in configuration file" |
---|
581 | printf "\n for \"$remote_host_string\" " |
---|
582 | locat=config_file; exit |
---|
583 | fi |
---|
584 | |
---|
585 | |
---|
586 | # DETERMINE REMOTE-SOURCE-CODE-PATH |
---|
587 | line="" |
---|
588 | remote_source_path="" |
---|
589 | grep "$remote_host_string" $config_file | grep "%source_path" > $tmp_mbuild |
---|
590 | while read line1 |
---|
591 | do |
---|
592 | |
---|
593 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
594 | then |
---|
595 | line="$line1" |
---|
596 | fi |
---|
597 | |
---|
598 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
599 | then |
---|
600 | remote_source_path=`echo $line | cut -d" " -s -f2` |
---|
601 | fi |
---|
602 | |
---|
603 | done < $tmp_mbuild |
---|
604 | |
---|
605 | if [[ "$remote_source_path" = "" ]] |
---|
606 | then |
---|
607 | if [[ "$global_source_path" != "" ]] |
---|
608 | then |
---|
609 | remote_source_path=$global_source_path |
---|
610 | else |
---|
611 | printf "\n +++ no source path found in configuration file" |
---|
612 | printf "\n for \"$remote_host_string\" " |
---|
613 | locat=config_file; exit |
---|
614 | fi |
---|
615 | fi |
---|
616 | |
---|
617 | remote_ud=${remote_source_path}/../UTIL |
---|
618 | remote_ud=$(eval echo $remote_ud) |
---|
619 | |
---|
620 | |
---|
621 | # DETERMINE REMOTE-PATH FOR MAKE-DEPOSITORY |
---|
622 | remote_md="" |
---|
623 | line="" |
---|
624 | grep "$remote_host_string" $config_file | grep "%depository_path" > $tmp_mbuild |
---|
625 | while read line1 |
---|
626 | do |
---|
627 | |
---|
628 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
629 | then |
---|
630 | line="$line1" |
---|
631 | fi |
---|
632 | |
---|
633 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
634 | then |
---|
635 | remote_md=`echo $line | cut -d" " -s -f2` |
---|
636 | fi |
---|
637 | |
---|
638 | done < $tmp_mbuild |
---|
639 | |
---|
640 | if [[ "$remote_md" = "" ]] |
---|
641 | then |
---|
642 | if [[ "$global_depository_path" != "" ]] |
---|
643 | then |
---|
644 | remote_md=$global_depository_path |
---|
645 | else |
---|
646 | printf "\n +++ no depository path found in configuration file" |
---|
647 | printf "\n for \"$remote_host_string\" " |
---|
648 | printf "\n please set \"\%depository_path\" in configuration file" |
---|
649 | locat=config_file; exit |
---|
650 | fi |
---|
651 | fi |
---|
652 | |
---|
653 | remote_md=$(eval echo $remote_md) |
---|
654 | block="" |
---|
655 | [[ "$condition1" != "" ]] && block=_$condition1 |
---|
656 | [[ "$condition2" != "" ]] && block=${block}_$condition2 |
---|
657 | remote_md=${remote_md}$block |
---|
658 | |
---|
659 | |
---|
660 | # DETERMINE COMPILERNAME |
---|
661 | line="" |
---|
662 | found=false |
---|
663 | grep "$remote_host_string" $config_file | grep "%compiler_name " > $tmp_mbuild |
---|
664 | while read line1 |
---|
665 | do |
---|
666 | |
---|
667 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
668 | then |
---|
669 | line="$line1" |
---|
670 | fi |
---|
671 | |
---|
672 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
673 | then |
---|
674 | compiler_name=`echo $line | cut -d" " -s -f2` |
---|
675 | found=true |
---|
676 | fi |
---|
677 | |
---|
678 | done < $tmp_mbuild |
---|
679 | |
---|
680 | if [[ $found = false ]] |
---|
681 | then |
---|
682 | printf "\n +++ no compiler name found in configuration file" |
---|
683 | printf "\n for \"$remote_host_string\" " |
---|
684 | locat=config_file; exit |
---|
685 | fi |
---|
686 | |
---|
687 | |
---|
688 | # IN CASE OF PARALLEL EXECUTION (COMPILER FOR PARALLEL EXECUTION), |
---|
689 | # A SERIAL COMPILERNAME MUST BE DETERMINED ALSO |
---|
690 | if [[ $(echo $remote_host_string | grep -c parallel) = 1 ]] |
---|
691 | then |
---|
692 | line="" |
---|
693 | found=false |
---|
694 | grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > $tmp_mbuild |
---|
695 | while read line1 |
---|
696 | do |
---|
697 | |
---|
698 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
699 | then |
---|
700 | line="$line1" |
---|
701 | fi |
---|
702 | |
---|
703 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
704 | then |
---|
705 | compiler_name_ser=`echo $line | cut -d" " -s -f2` |
---|
706 | found=true |
---|
707 | fi |
---|
708 | |
---|
709 | done < $tmp_mbuild |
---|
710 | |
---|
711 | if [[ $found = false ]] |
---|
712 | then |
---|
713 | printf "\n +++ no serial compiler name found in configuration file" |
---|
714 | printf "\n for \"$remote_host_string\" " |
---|
715 | locat=config_file; exit |
---|
716 | fi |
---|
717 | else |
---|
718 | compiler_name_ser=$compiler_name |
---|
719 | fi |
---|
720 | |
---|
721 | |
---|
722 | |
---|
723 | # DETERMINE PREPROCESSOR-OPTIONS AND DIRECTIVES |
---|
724 | line="" |
---|
725 | found=false |
---|
726 | grep "$remote_host_string" $config_file | grep "%cpp_options" > $tmp_mbuild |
---|
727 | while read line1 |
---|
728 | do |
---|
729 | |
---|
730 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
731 | then |
---|
732 | line="$line1" |
---|
733 | fi |
---|
734 | |
---|
735 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
736 | then |
---|
737 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
738 | cpp_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
739 | found=true |
---|
740 | fi |
---|
741 | |
---|
742 | done < $tmp_mbuild |
---|
743 | |
---|
744 | if [[ $found = false ]] |
---|
745 | then |
---|
746 | printf "\n +++ no preprocessor options found in configuration file" |
---|
747 | printf "\n for \"$remote_host_string\" " |
---|
748 | locat=config_file; exit |
---|
749 | fi |
---|
750 | |
---|
751 | |
---|
752 | # ADD HOST-SPECIFIC PREPROCESSOR-DIRECTIVES |
---|
753 | for string in $remote_host_string |
---|
754 | do |
---|
755 | if [[ $(echo $remote_host | cut -c1-2) = lc && $(echo $string | cut -c1-2) = lc ]] |
---|
756 | then |
---|
757 | cpp_options="$cpp_options -D__lc " |
---|
758 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $(echo $string | cut -c1-3) = ibm ]] |
---|
759 | then |
---|
760 | cpp_options="${cpp_options},-D__ibm" |
---|
761 | elif [[ $(echo $remote_host | cut -c1-3) = nec && $(echo $string | cut -c1-3) = nec ]] |
---|
762 | then |
---|
763 | cpp_options="${cpp_options} -D__nec" |
---|
764 | else |
---|
765 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
766 | then |
---|
767 | cpp_options="${cpp_options},-D__$string" |
---|
768 | else |
---|
769 | cpp_options="$cpp_options -D__$string " |
---|
770 | fi |
---|
771 | fi |
---|
772 | done |
---|
773 | |
---|
774 | |
---|
775 | |
---|
776 | # GET netCDF OPTIONS |
---|
777 | line="" |
---|
778 | grep "$remote_host_string" $config_file | grep "%netcdf_inc" > $tmp_mbuild |
---|
779 | while read line1 |
---|
780 | do |
---|
781 | |
---|
782 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
783 | then |
---|
784 | line="$line1" |
---|
785 | fi |
---|
786 | |
---|
787 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
788 | then |
---|
789 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
790 | netcdf_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
791 | fi |
---|
792 | |
---|
793 | done < $tmp_mbuild |
---|
794 | |
---|
795 | line="" |
---|
796 | grep "$remote_host_string" $config_file | grep "%netcdf_lib" > $tmp_mbuild |
---|
797 | while read line1 |
---|
798 | do |
---|
799 | |
---|
800 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
801 | then |
---|
802 | line="$line1" |
---|
803 | fi |
---|
804 | |
---|
805 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
806 | then |
---|
807 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
808 | netcdf_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
809 | fi |
---|
810 | |
---|
811 | done < $tmp_mbuild |
---|
812 | |
---|
813 | |
---|
814 | |
---|
815 | # GET FFTW OPTIONS |
---|
816 | line="" |
---|
817 | grep "$remote_host_string" $config_file | grep "%fftw_inc" > $tmp_mbuild |
---|
818 | while read line1 |
---|
819 | do |
---|
820 | |
---|
821 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
822 | then |
---|
823 | line="$line1" |
---|
824 | fi |
---|
825 | |
---|
826 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
827 | then |
---|
828 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
829 | fftw_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
830 | fi |
---|
831 | |
---|
832 | done < $tmp_mbuild |
---|
833 | |
---|
834 | line="" |
---|
835 | grep "$remote_host_string" $config_file | grep "%fftw_lib" > $tmp_mbuild |
---|
836 | while read line1 |
---|
837 | do |
---|
838 | |
---|
839 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
840 | then |
---|
841 | line="$line1" |
---|
842 | fi |
---|
843 | |
---|
844 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
845 | then |
---|
846 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
847 | fftw_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
848 | fi |
---|
849 | |
---|
850 | done < $tmp_mbuild |
---|
851 | |
---|
852 | |
---|
853 | |
---|
854 | # GET MAKE OPTIONS |
---|
855 | line="" |
---|
856 | found=false |
---|
857 | grep "$remote_host_string" $config_file | grep "%mopts" > $tmp_mbuild |
---|
858 | while read line1 |
---|
859 | do |
---|
860 | |
---|
861 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
862 | then |
---|
863 | line="$line1" |
---|
864 | fi |
---|
865 | |
---|
866 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
867 | then |
---|
868 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
869 | make_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
870 | |
---|
871 | fi |
---|
872 | |
---|
873 | done < $tmp_mbuild |
---|
874 | |
---|
875 | |
---|
876 | |
---|
877 | # GET COMPILER OPTIONS |
---|
878 | line="" |
---|
879 | found=false |
---|
880 | grep "$remote_host_string" $config_file | grep "%fopts" > $tmp_mbuild |
---|
881 | while read line1 |
---|
882 | do |
---|
883 | |
---|
884 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
885 | then |
---|
886 | line="$line1" |
---|
887 | fi |
---|
888 | |
---|
889 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
890 | then |
---|
891 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
892 | compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
893 | found=true |
---|
894 | |
---|
895 | # ADD INCLUDE PATHS FOR netCDF AND FFTW |
---|
896 | compiler_options="$compiler_options $netcdf_inc $fftw_inc" |
---|
897 | fi |
---|
898 | |
---|
899 | done < $tmp_mbuild |
---|
900 | |
---|
901 | if [[ $found = false ]] |
---|
902 | then |
---|
903 | printf "\n +++ no compiler options found in configuration file" |
---|
904 | printf "\n for \"$remote_host_string\" " |
---|
905 | locat=config_file; exit |
---|
906 | fi |
---|
907 | |
---|
908 | |
---|
909 | # GET LOGIN INIT COMMANDS |
---|
910 | line="" |
---|
911 | grep "$remote_host_string" $config_file | grep "%login_init_cmd" > $tmp_mbuild |
---|
912 | while read line1 |
---|
913 | do |
---|
914 | |
---|
915 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
916 | then |
---|
917 | line="$line1" |
---|
918 | fi |
---|
919 | |
---|
920 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
921 | then |
---|
922 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
923 | init_cmds=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
924 | init_cmds="${init_cmds};" |
---|
925 | fi |
---|
926 | done < $tmp_mbuild |
---|
927 | |
---|
928 | |
---|
929 | # GET MODULES TO BE LOADED |
---|
930 | line="" |
---|
931 | grep "$remote_host_string" $config_file | grep "%modules" > $tmp_mbuild |
---|
932 | while read line1 |
---|
933 | do |
---|
934 | |
---|
935 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
936 | then |
---|
937 | line="$line1" |
---|
938 | fi |
---|
939 | |
---|
940 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
941 | then |
---|
942 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
943 | modules=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
944 | fi |
---|
945 | |
---|
946 | done < $tmp_mbuild |
---|
947 | |
---|
948 | |
---|
949 | # GET LINKER OPTIONS |
---|
950 | line="" |
---|
951 | found=false |
---|
952 | grep "$remote_host_string" $config_file | grep "%lopts" > $tmp_mbuild |
---|
953 | while read line1 |
---|
954 | do |
---|
955 | |
---|
956 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
957 | then |
---|
958 | line="$line1" |
---|
959 | fi |
---|
960 | |
---|
961 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
962 | then |
---|
963 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
964 | loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
965 | found=true |
---|
966 | |
---|
967 | # ADD netCDF- AND FFTW-LIBRARY |
---|
968 | loader_options="$loader_options $netcdf_lib $fftw_lib" |
---|
969 | fi |
---|
970 | |
---|
971 | done < $tmp_mbuild |
---|
972 | |
---|
973 | if [[ $found = false ]] |
---|
974 | then |
---|
975 | printf "\n +++ no loader options found in configuration file" |
---|
976 | printf "\n for \"$remote_host_string\" " |
---|
977 | locat=config_file; exit |
---|
978 | fi |
---|
979 | |
---|
980 | |
---|
981 | printf "\n\n#------------------------------------------------------------------------# \n" |
---|
982 | if [[ $remote_host = $local_host ]] |
---|
983 | then |
---|
984 | column2="$remote_host (= local host!)" |
---|
985 | else |
---|
986 | column2=$remote_host |
---|
987 | fi |
---|
988 | printf "| %-20s%-50s | \n" "remote_host:" "$column2" |
---|
989 | printf "| | \n" |
---|
990 | printf "| %-20s%-50s | \n" "conditions:" "$condition1 $condition2" |
---|
991 | column2=$(echo "$remote_md" | cut -c1-50 ) |
---|
992 | printf "| %-20s%-50s | \n" "make depository:" "$column2" |
---|
993 | line=$(echo "$remote_md" | cut -c51-) |
---|
994 | while [[ "$line" != "" ]] |
---|
995 | do |
---|
996 | column1="" |
---|
997 | column2=$(echo "$line" | cut -c1-50 ) |
---|
998 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
999 | line=$(echo "$line" | cut -c51-) |
---|
1000 | done |
---|
1001 | if [[ $compile_utility_programs = true ]] |
---|
1002 | then |
---|
1003 | column2=$(echo "$remote_ud" | cut -c1-50 ) |
---|
1004 | printf "| %-20s%-50s | \n" "utility directory:" "$column2" |
---|
1005 | line=$(echo "$remote_ud" | cut -c51-) |
---|
1006 | while [[ "$line" != "" ]] |
---|
1007 | do |
---|
1008 | column1="" |
---|
1009 | column2=$(echo "$line" | cut -c1-50 ) |
---|
1010 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
1011 | line=$(echo "$line" | cut -c51-) |
---|
1012 | done |
---|
1013 | fi |
---|
1014 | printf "| %-20s%-50s | \n" "username:" "$remote_username" |
---|
1015 | printf "| %-20s%-50s | \n" "address:" "$remote_address" |
---|
1016 | printf "| %-20s%-50s | \n" "compiler:" "$compiler_name" |
---|
1017 | if [[ $compile_utility_programs = true ]] |
---|
1018 | then |
---|
1019 | printf "| %-20s%-50s | \n" "serial compiler:" "$compiler_name_ser" |
---|
1020 | fi |
---|
1021 | if [[ "$make_options" != "" ]] |
---|
1022 | then |
---|
1023 | printf "| %-20s%-50s | \n" "make options:" "$make_options" |
---|
1024 | fi |
---|
1025 | column2=$(echo $cpp_options | cut -c1-50 ) |
---|
1026 | printf "| %-20s%-50s | \n" "cpp options:" "$column2" |
---|
1027 | line=$(echo "$cpp_options" | cut -c51-) |
---|
1028 | while [[ "$line" != "" ]] |
---|
1029 | do |
---|
1030 | column1="" |
---|
1031 | column2=$(echo $line | cut -c1-50 ) |
---|
1032 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
1033 | line=$(echo "$line" | cut -c51-) |
---|
1034 | done |
---|
1035 | column2=$(echo $compiler_options | cut -c1-50 ) |
---|
1036 | printf "| %-20s%-50s | \n" "compiler options:" "$column2" |
---|
1037 | line=$(echo "$compiler_options" | cut -c51-) |
---|
1038 | while [[ "$line" != "" ]] |
---|
1039 | do |
---|
1040 | column1="" |
---|
1041 | column2=$(echo $line | cut -c1-50 ) |
---|
1042 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
1043 | line=$(echo "$line" | cut -c51-) |
---|
1044 | done |
---|
1045 | column2=$(echo $loader_options | cut -c1-50 ) |
---|
1046 | printf "| %-20s%-50s | \n" "loader options:" "$column2" |
---|
1047 | line=$(echo "$loader_options" | cut -c51-) |
---|
1048 | while [[ "$line" != "" ]] |
---|
1049 | do |
---|
1050 | column1="" |
---|
1051 | column2=$(echo $line | cut -c1-50 ) |
---|
1052 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
1053 | line=$(echo "$line" | cut -c51-) |
---|
1054 | done |
---|
1055 | if [[ $init_cmds != "" ]] |
---|
1056 | then |
---|
1057 | column2=$(echo $init_cmds | cut -c1-50 ) |
---|
1058 | printf "| %-20s%-50s | \n" "login init command:" "$column2" |
---|
1059 | line=$(echo "$init_cmds" | cut -c51-) |
---|
1060 | while [[ "$line" != "" ]] |
---|
1061 | do |
---|
1062 | column1="" |
---|
1063 | column2=$(echo $line | cut -c1-50 ) |
---|
1064 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
1065 | line=$(echo "$line" | cut -c51-) |
---|
1066 | done |
---|
1067 | fi |
---|
1068 | if [[ $modules != "" ]] |
---|
1069 | then |
---|
1070 | column2=$(echo $modules | cut -c1-50 ) |
---|
1071 | printf "| %-20s%-50s | \n" "modules to be load:" "$column2" |
---|
1072 | line=$(echo "$modules" | cut -c51-) |
---|
1073 | while [[ "$line" != "" ]] |
---|
1074 | do |
---|
1075 | column1="" |
---|
1076 | column2=$(echo $line | cut -c1-50 ) |
---|
1077 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
1078 | line=$(echo "$line" | cut -c51-) |
---|
1079 | done |
---|
1080 | fi |
---|
1081 | printf "#------------------------------------------------------------------------# \n" |
---|
1082 | |
---|
1083 | if [[ $silent = false ]] |
---|
1084 | then |
---|
1085 | answer=dummy |
---|
1086 | printf "\n\n" |
---|
1087 | while [[ "$answer" != y && "$answer" != Y && "$answer" != c && "$answer" != C && "$answer" != s && "$answer" != S && "$answer" != a && "$answer" != A ]] |
---|
1088 | do |
---|
1089 | printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ? " |
---|
1090 | read answer |
---|
1091 | done |
---|
1092 | if [[ $answer = a || $answer = A ]] |
---|
1093 | then |
---|
1094 | locat=user_abort; exit |
---|
1095 | fi |
---|
1096 | if [[ $answer = c || $answer = C ]] |
---|
1097 | then |
---|
1098 | silent=true |
---|
1099 | fi |
---|
1100 | if [[ $answer = s || $answer = S ]] |
---|
1101 | then |
---|
1102 | continue |
---|
1103 | fi |
---|
1104 | fi |
---|
1105 | |
---|
1106 | |
---|
1107 | # MAKE ON REMOTE HOST |
---|
1108 | if [[ $remote_host != $local_host ]] |
---|
1109 | then |
---|
1110 | if [[ $compile_utility_programs = false ]] |
---|
1111 | then |
---|
1112 | |
---|
1113 | # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST |
---|
1114 | # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST |
---|
1115 | echo " *** copying \"${mainprog}_sources.tar\" to \"${remote_address}:${remote_md}/\" " |
---|
1116 | if [[ $remote_host != lctit ]] |
---|
1117 | then |
---|
1118 | ssh ${remote_username}@${remote_address} "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" |
---|
1119 | else |
---|
1120 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
1121 | echo "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" | ssh ${remote_username}@${remote_address} 2>&1 |
---|
1122 | fi |
---|
1123 | |
---|
1124 | scp ${local_source_path}/${mainprog}_sources.tar ${remote_username}@${remote_address}:${remote_md}/${mainprog}_sources.tar |
---|
1125 | |
---|
1126 | |
---|
1127 | |
---|
1128 | # UNTAR PREVIOUS UPDATE ON REMOTE HOST, IF EXISTING |
---|
1129 | echo " *** untar previous update on remote host, if existing" |
---|
1130 | if [[ $remote_host != lctit ]] |
---|
1131 | then |
---|
1132 | ssh ${remote_username}@${remote_address} "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" |
---|
1133 | else |
---|
1134 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
1135 | echo "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" | ssh ${remote_username}@${remote_address} 2>&1 |
---|
1136 | fi |
---|
1137 | |
---|
1138 | |
---|
1139 | # UNTAR CURRENT SOURCES ON REMOTE HOST |
---|
1140 | echo " *** untar current sources on remote host" |
---|
1141 | if [[ $remote_host != lctit ]] |
---|
1142 | then |
---|
1143 | ssh ${remote_username}@${remote_address} "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" |
---|
1144 | else |
---|
1145 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
1146 | echo "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" | ssh ${remote_username}@${remote_address} 2>&1 |
---|
1147 | fi |
---|
1148 | |
---|
1149 | |
---|
1150 | # EXECUTE MAKE WITH THOSE OPTIONS DETERMINED ABOVE |
---|
1151 | # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND |
---|
1152 | # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE |
---|
1153 | # WILL E.G. MISS THE COMPILER-PATHS) |
---|
1154 | echo " *** execute \"make\" on remote host" |
---|
1155 | |
---|
1156 | |
---|
1157 | # GENERATE MAKE CALL WITH MAKE OPTIONS |
---|
1158 | if [[ $remote_host = nech ]] |
---|
1159 | then |
---|
1160 | make_call_string="sxmake $make_options PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
1161 | else |
---|
1162 | make_call_string="make $make_options PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
1163 | fi |
---|
1164 | |
---|
1165 | # GENERATE COMMAND TO LOAD MODULES, IF MODULES ARE GIVEN |
---|
1166 | if [[ "$modules" != "" ]] |
---|
1167 | then |
---|
1168 | if [[ $remote_host = lctit ]] |
---|
1169 | then |
---|
1170 | module_calls=". $modules" |
---|
1171 | else |
---|
1172 | module_calls="module load ${modules};" |
---|
1173 | fi |
---|
1174 | else |
---|
1175 | module_calls="" |
---|
1176 | fi |
---|
1177 | |
---|
1178 | if [[ $remote_host = ibmkisti || $remote_host = ibms ]] |
---|
1179 | then |
---|
1180 | |
---|
1181 | ssh ${remote_username}@${remote_address} "$init_cmds $module_calls cd ${remote_md}; echo '$make_call_string' > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1182 | |
---|
1183 | elif [[ $remote_host = ibmh ]] |
---|
1184 | then |
---|
1185 | |
---|
1186 | echo "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1187 | |
---|
1188 | elif [[ $remote_host = lctit ]] |
---|
1189 | then |
---|
1190 | |
---|
1191 | echo " " > ${remote_host}_last_make_protokoll |
---|
1192 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
1193 | do |
---|
1194 | echo "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1195 | done |
---|
1196 | |
---|
1197 | elif [[ $remote_host = lcxe6 ]] |
---|
1198 | then |
---|
1199 | |
---|
1200 | ssh ${remote_username}@${remote_address} "$init_cmds $module_calls cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1201 | |
---|
1202 | else |
---|
1203 | |
---|
1204 | echo "$init_cmds $module_calls cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1205 | |
---|
1206 | fi |
---|
1207 | |
---|
1208 | if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]] |
---|
1209 | then |
---|
1210 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
1211 | if [[ $silent = false ]] |
---|
1212 | then |
---|
1213 | answer=dummy |
---|
1214 | printf "\n" |
---|
1215 | while [[ "$answer" != c && "$answer" != k ]] |
---|
1216 | do |
---|
1217 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
1218 | read answer |
---|
1219 | if [[ "$answer" = l ]] |
---|
1220 | then |
---|
1221 | more ${remote_host}_last_make_protokoll |
---|
1222 | fi |
---|
1223 | done |
---|
1224 | if [[ $answer = k ]] |
---|
1225 | then |
---|
1226 | locat=user_abort; exit |
---|
1227 | fi |
---|
1228 | fi |
---|
1229 | fi |
---|
1230 | |
---|
1231 | |
---|
1232 | |
---|
1233 | # TAR UPDATED VERSION ON THE REMOTE HOST |
---|
1234 | printf "\n *** tar update on remote host ..." |
---|
1235 | if [[ $remote_host != lctit ]] |
---|
1236 | then |
---|
1237 | ssh ${remote_username}@${remote_address} "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" |
---|
1238 | else |
---|
1239 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
1240 | echo "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" | ssh ${remote_username}@${remote_address} 2>&1 |
---|
1241 | fi |
---|
1242 | |
---|
1243 | |
---|
1244 | |
---|
1245 | # DO THE SAME THINGS FOR THE UTILITY-ROUTINES: |
---|
1246 | # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST |
---|
1247 | # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST |
---|
1248 | elif [[ $compile_utility_programs = true ]] |
---|
1249 | then |
---|
1250 | |
---|
1251 | printf "\n\n" |
---|
1252 | echo " *** copying scripts and utility programs to \"${remote_address}:${remote_ud}/\" " |
---|
1253 | cd ${local_source_path}/../SCRIPTS |
---|
1254 | |
---|
1255 | if [[ $remote_host != lctit ]] |
---|
1256 | then |
---|
1257 | ssh ${remote_username}@${remote_address} "[[ ! -d ${remote_ud} ]] && (echo \" *** ${remote_ud} will be created\"; mkdir -p ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]] && (echo \" *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)" |
---|
1258 | else |
---|
1259 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
1260 | echo "[[ ! -d ${remote_ud} ]] && (echo \" *** ${remote_ud} will be created\"; mkdir -p ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]] && (echo \" *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)" | ssh ${remote_username}@${remote_address} 2>&1 |
---|
1261 | fi |
---|
1262 | |
---|
1263 | # COPY SHELL-SCRIPTS |
---|
1264 | scp batch_scp mbuild mrun process_dvr_output .dvrserver.config subjob ${remote_username}@${remote_address}:${remote_ud}/../SCRIPTS > /dev/null |
---|
1265 | |
---|
1266 | cd - > /dev/null |
---|
1267 | cd ${local_source_path}/../UTIL |
---|
1268 | |
---|
1269 | |
---|
1270 | # COPY UTILITY-ROUTINES |
---|
1271 | scp Makefile *.f90 ${remote_username}@${remote_address}:${remote_ud} > /dev/null |
---|
1272 | |
---|
1273 | |
---|
1274 | |
---|
1275 | # EXECUTE MAKE WITH THOSE OPTIONS DETERMINED ABOVE |
---|
1276 | # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND |
---|
1277 | # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE |
---|
1278 | # WILL E.G. MISS THE COMPILER-PATHS) |
---|
1279 | echo " *** execute \"make\" on remote host" |
---|
1280 | |
---|
1281 | if [[ $remote_host = nech ]] |
---|
1282 | then |
---|
1283 | make_call_string="sxmake $make_options BLOCK=$block F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
1284 | else |
---|
1285 | make_call_string="make $make_options BLOCK=$block F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
1286 | fi |
---|
1287 | |
---|
1288 | # GENERATE COMMAND TO LOAD MODULES, IF MODULES ARE GIVEN |
---|
1289 | if [[ "$modules" != "" ]] |
---|
1290 | then |
---|
1291 | if [[ $remote_host = lctit ]] |
---|
1292 | then |
---|
1293 | module_calls=". $modules" |
---|
1294 | else |
---|
1295 | module_calls="module load ${modules};" |
---|
1296 | fi |
---|
1297 | else |
---|
1298 | module_calls="" |
---|
1299 | fi |
---|
1300 | |
---|
1301 | |
---|
1302 | if [[ $remote_host = ibms ]] |
---|
1303 | then |
---|
1304 | |
---|
1305 | ssh ${remote_username}@${remote_address} "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" |
---|
1306 | |
---|
1307 | elif [[ $remote_host = ibmh ]] |
---|
1308 | then |
---|
1309 | |
---|
1310 | echo "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_address} |
---|
1311 | |
---|
1312 | elif [[ $remote_host = lctit ]] |
---|
1313 | then |
---|
1314 | |
---|
1315 | echo " " > ${remote_host}_last_make_protokoll |
---|
1316 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
1317 | do |
---|
1318 | echo "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1319 | done |
---|
1320 | |
---|
1321 | elif [[ $remote_host = lcxe6 ]] |
---|
1322 | then |
---|
1323 | |
---|
1324 | ssh ${remote_username}@${remote_address} "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1325 | |
---|
1326 | else |
---|
1327 | |
---|
1328 | echo "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1329 | |
---|
1330 | fi |
---|
1331 | |
---|
1332 | fi # END OF COMPILING UTILITY-ROUTINES |
---|
1333 | |
---|
1334 | rm -rf ${remote_host}_last_make_protokoll |
---|
1335 | |
---|
1336 | # MAKE ON LOCAL HOST |
---|
1337 | else |
---|
1338 | |
---|
1339 | # INIT WORKAROUND FOR lcxe6 |
---|
1340 | if [[ $remote_host = lcxe6 || $remote_host = lccrayb || $remote_host = lccrayf || $remote_host = lccrayh ]] |
---|
1341 | then |
---|
1342 | |
---|
1343 | eval $init_cmds > /dev/null 2>&1 |
---|
1344 | |
---|
1345 | fi |
---|
1346 | |
---|
1347 | # FIRST LOAD MODULES, IF GIVEN |
---|
1348 | if [[ "$modules" != "" ]] |
---|
1349 | then |
---|
1350 | if [[ $remote_host = lctit ]] |
---|
1351 | then |
---|
1352 | . $modules |
---|
1353 | elif [[ $remote_host = lcflow ]] |
---|
1354 | then |
---|
1355 | eval `$MODULESHOME/bin/modulecmd ksh load ${modules}` |
---|
1356 | else |
---|
1357 | eval init_cmds=$init_cmds |
---|
1358 | module load ${modules} |
---|
1359 | fi |
---|
1360 | fi |
---|
1361 | |
---|
1362 | |
---|
1363 | if [[ $compile_utility_programs = false ]] |
---|
1364 | then |
---|
1365 | |
---|
1366 | # CREATE MAKE-DEPOSITORY, IF IT DOES NOT EXIST |
---|
1367 | eval remote_md=$remote_md |
---|
1368 | if [[ ! -d $remote_md ]] |
---|
1369 | then |
---|
1370 | if mkdir $remote_md |
---|
1371 | then |
---|
1372 | printf "\n\n *** directory for make depository:" |
---|
1373 | printf "\n $remote_md" |
---|
1374 | printf "\n was created\n" |
---|
1375 | else |
---|
1376 | printf "\n +++ directory for make depository:" |
---|
1377 | printf "\n $remote_md" |
---|
1378 | printf "\n cannot be created" |
---|
1379 | locat=local_depository_path; exit |
---|
1380 | fi |
---|
1381 | fi |
---|
1382 | |
---|
1383 | # COPY SOURCE-CODE FROM REPOSITORY TO MAKE-DEPOSITORY |
---|
1384 | echo " " |
---|
1385 | echo " *** updating sources in $remote_md" |
---|
1386 | cd $remote_md |
---|
1387 | cp $local_source_path/${mainprog}_sources.tar . |
---|
1388 | tar xf ${mainprog}_sources.tar |
---|
1389 | |
---|
1390 | # CALL MAKE ON LOCAL HOST USING THE OPTIONS DETERMINED FURTHER ABOVE |
---|
1391 | echo " " |
---|
1392 | echo " *** execute \"make\" on local host" |
---|
1393 | |
---|
1394 | make $make_options PROG=$mainprog F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
1395 | |
---|
1396 | if [[ $? != 0 ]] |
---|
1397 | then |
---|
1398 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
1399 | if [[ $silent = false ]] |
---|
1400 | then |
---|
1401 | answer=dummy |
---|
1402 | printf "\n" |
---|
1403 | while [[ "$answer" != c && "$answer" != k ]] |
---|
1404 | do |
---|
1405 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
1406 | read answer |
---|
1407 | if [[ "$answer" = l ]] |
---|
1408 | then |
---|
1409 | more ${remote_host}_last_make_protokoll |
---|
1410 | fi |
---|
1411 | done |
---|
1412 | if [[ $answer = k ]] |
---|
1413 | then |
---|
1414 | locat=user_abort; exit |
---|
1415 | fi |
---|
1416 | fi |
---|
1417 | fi |
---|
1418 | |
---|
1419 | |
---|
1420 | # TAR NEW VERSION ON LOCAL HOST |
---|
1421 | printf "\n *** tar update on local host ..." |
---|
1422 | tar -cf ${mainprog}_current_version.tar *.$suf *.o *.mod |
---|
1423 | |
---|
1424 | |
---|
1425 | # COMPILE THE UTILITY PROGRAMS |
---|
1426 | elif [[ $compile_utility_programs = true ]] |
---|
1427 | then |
---|
1428 | printf "\n\n" |
---|
1429 | echo " *** compiling the utility programs ..." |
---|
1430 | cd ${local_source_path}/../UTIL |
---|
1431 | |
---|
1432 | # TOUCH FILES IN ORDER TO FORCE COMPILATION FOR EVERY BLOCK |
---|
1433 | touch *.f90 |
---|
1434 | eval init_cmds=$init_cmds |
---|
1435 | make $make_options BLOCK=$block F90=$compiler_name F90_SER=$compiler_name_ser COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" |
---|
1436 | |
---|
1437 | # CHECK IF QMAKE IS AVAILABLE AND COMPILE MRUNGUI |
---|
1438 | if [[ $util_compiled_localhost == false ]] |
---|
1439 | then |
---|
1440 | printf "\n\n" |
---|
1441 | echo " *** compiling the mrun GUI" |
---|
1442 | if which qmake >/dev/null; then |
---|
1443 | cd mrungui |
---|
1444 | touch * |
---|
1445 | qmake |
---|
1446 | make |
---|
1447 | make clean |
---|
1448 | rm Makefile |
---|
1449 | cd .. |
---|
1450 | else |
---|
1451 | echo " +++ no qmake found. The (optional) GUI will not be compiled." |
---|
1452 | fi |
---|
1453 | else |
---|
1454 | cd $check_depository_path |
---|
1455 | printf "\n\n" |
---|
1456 | echo " *** skipped compilation of mrun GUI." |
---|
1457 | fi |
---|
1458 | |
---|
1459 | fi |
---|
1460 | fi |
---|
1461 | done |
---|
1462 | |
---|
1463 | |
---|
1464 | if [[ $host_found = false ]] |
---|
1465 | then |
---|
1466 | if [[ $host = all ]] |
---|
1467 | then |
---|
1468 | printf "\n +++ no hosts found in configuration file" |
---|
1469 | else |
---|
1470 | printf "\n +++ host \"$host\" not found in configuration file" |
---|
1471 | fi |
---|
1472 | locat=config_file; exit |
---|
1473 | fi |
---|
1474 | |
---|
1475 | if [[ "$block_conditions" != none && $block_conditions_found = false ]] |
---|
1476 | then |
---|
1477 | printf "\n +++ block conditions \"$block_conditions\" not found for host \"$host\"" |
---|
1478 | fi |
---|
1479 | |
---|
1480 | |
---|
1481 | # FINAL WORK |
---|
1482 | rm -f hosts_found_in_config_file |
---|
1483 | rm -f ${local_source_path}/${mainprog}_sources_check.tar |
---|