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