source: palm/tags/release-3.8/SCRIPTS/mbuild @ 4343

Last change on this file since 4343 was 693, checked in by raasch, 13 years ago

New:
---
adjustments for ibmkisti (pres, batch_scp, mbuild, mrun, subjob)

new default configuration files .mrun.config.yonsei2011 and .config_block_for_ibmkisti

Changed:


Errors:


bugfix: weighting coefficient added to ibm branch (pres)

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