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