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