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