source: palm/trunk/SCRIPTS/mbuild @ 505

Last change on this file since 505 was 503, checked in by raasch, 15 years ago

New:
---

Changed:


combine_plot_fields is now directly called within mrun and must not be given
by an output command in the configuration file any more.

Utility programs (combine_plot_fields, interpret_config) are created by mbuild
separately for each block in the configuration file. Depending on option -K,
mrun is using the utility programs for the respective block.
Parallel make for utility programs.

Default configuration files updated.

mbuild, mrun, UTIL/Makefile

Errors:


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