source: palm/trunk/SCRIPTS/mbuild @ 591

Last change on this file since 591 was 562, checked in by raasch, 14 years ago

bugfixes for wrong netcdf/3.6.3 module, last revision 561, and setting of MPI_TYPE_DEPTH for netCDF4/HDF5 with mpt -library

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