source: palm/trunk/SCRIPTS/mbuild @ 504

Last change on this file since 504 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
RevLine 
[1]1#!/bin/ksh
[503]2# mbuild - script for compiling the PALM code and its utility programs
[169]3# $Id: mbuild 503 2010-03-03 00:27:06Z raasch $
[1]4
[503]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.
[1]7
[503]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
[1]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)
[5]70     # 10/02/07 - Siggi - all hpmuk-related code removed
[40]71     # 02/03/07 - Siggi - compilation of utility programs and transfer of
[27]72     #                    scripts to remote hosts added (option -u)
[66]73     # 14/03/07 - Siggi - fimm admitted, revision number added to terminal
74     #                    output
[69]75     # 16/03/07 - Siggi - adjustments (netcdf) for lctit
76     #                    adjustments for running under pdksh, local ip-addres
77     #                    is not determined any more
[82]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
[116]81     # 10/10/07 - Siggi - bugfix: handling of comment lines
[181]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)
[206]85     # 02/10/08 - Siggi - adapted for lcxt4
[215]86     # 14/11/08 - Siggi - update mechanism completely revised: source tarfile
87     #                    remains in source directory, one depository per block
[266]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)
[224]92     # 13/01/09 - Marcus- re-enable compilation more than once on lcmuk (as on
93     #                    other machines)
[266]94     # 21/03/09 - Siggi - -u copies also copies process_dvr_output and
95     #                    .dvrserver.config
[305]96     # 21/04/09 - Siggi - adjustments for new IBM at DKRZ, which is now ibmh
[367]97     # 25/08/09 - BjornM- adapted for lck
[407]98     # 01/12/09 - BjornM- re-adjustments for lcxt4
[437]99     # 01/02/10 - Siggi - adjustments for lcxt5m
[475]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
[492]103     # 26/02/10 - BjornM- re-adjustments for lcxt4 (new modules)
[493]104     # 01/03/10 - Siggi - mpilib replaced by modules: explicit module settings
105     #                    removed; modules should now be given in the
106     #                    configuration file
[503]107     # 02/03/10 - Siggi - utility programs are created separately for each
108     #                    block in the configuration file,
109     #                    parallel make for utility programs
[1]110
111
[503]112    # VARIABLE DECLARATIONS + DEFAULT VALUES
[22]113 compile_utility_programs=false
[1]114 config_file=.mrun.config
[67]115 fimm=false
[1]116 host=all
117 host_found=false
118 locat=normal
119 makefile=""
[493]120 module_calls=""
[1]121 scirocco=false
122 silent=false
123 suf=f90
124 update=false
[83]125 working_directory=`pwd`
[1]126
127 typeset -i  ih ihost=0
128
[66]129 typeset  -R30 calltime
[1]130 typeset  -L20 column1
131 typeset  -L50 column2
132 typeset  -L70 column3
[215]133 typeset  -L40 version="MBUILD  2.1  Rev$Rev: 503 $"
[1]134
[503]135    # ERROR HANDLING
136    # IN CASE OF EXIT:
[83]137 trap 'rm -rf  $working_directory/tmp_mbuild
[69]138       if [[ $locat != normal ]]
[1]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
[503]146    # IN CASE OF TERMINAL-BREAK:
[83]147 trap 'rm -rf  $working_directory/tmp_mbuild
[69]148       printf "\n\n +++ mbuild killed by \"^C\" \n\n"
[1]149       exit
150      ' 2
151
152
[215]153 tmp_mbuild=${working_directory}/tmp_mbuild
[1]154
[503]155    # READ SHELLSCRIPT-OPTIONS
[475]156 while  getopts  :c:h:m:s:u  option
[1]157 do
158   case  $option  in
159       (c)   config_file=$OPTARG;;
160       (h)   host=$OPTARG;;
161       (m)   makefile=$OPTARG;;
162       (s)   suf=$OPTARG;;
[22]163       (u)   compile_utility_programs=true;;
[1]164       (\?)  printf "\n  +++ unknown option $OPTARG \n";
165             locat=parameter; exit;;
166   esac
167 done
168
169
170
[503]171    # CHECK, IF CONFIGURATION-FILE EXISTS
[82]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
[503]182    # DETERMINE THE LOCAL HOST
[1]183 local_host_real_name=$(hostname)
[69]184# local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
185
[1]186
[82]187
[503]188    # DETERMINE HOST-IDENTIFIER (local_host) FROM THE CONFIG-FILE
[82]189 line=""
[215]190 grep  "%host_identifier"  $config_file  >  $tmp_mbuild
[82]191 while read line
192 do
[116]193    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
[82]194    then
195       HOSTNAME=`echo $line | cut -d" " -s -f2`
196       host_identifier=`echo $line | cut -d" " -s -f3`
[83]197       if [[ $local_host_real_name = $HOSTNAME ]]
[82]198       then
199          local_host=$host_identifier
200          break
201       fi
202    fi
[215]203 done < $tmp_mbuild
[82]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
[1]217 [[ $local_host_real_name = scirocco ]]  &&  scirocco=true
[67]218 [[ $local_host_real_name = fimm.bccs.uib.no ]]  &&  fimm=true
[1]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 
[503]231    # DETERMINE USER NAME ON LOCAL HOST FROM THE CONFIG-FILE
[1]232 line=""
[215]233 grep  " $local_host" $config_file | grep "%remote_username"  >  $tmp_mbuild
[69]234 while read line
[1]235 do
[116]236    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
[1]237    then
238       local_username=`echo $line | cut -d" " -s -f2`
239    fi
[215]240 done < $tmp_mbuild
[1]241
[82]242
[1]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
[503]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.
[5]255 line=""
[215]256 grep "%" $config_file  >  $tmp_mbuild
[69]257 while read line
[5]258 do
[116]259    if [[ "$line" != ""  &&  "$(echo $line | cut -d" " -s -f3)" = ""  &&  $(echo $line | cut -c1) != "#" ]]
[1]260    then
[5]261       var=`echo $line | cut -d" " -s -f1 | cut -c2-`
262       value=`echo $line | cut -d" " -s -f2`
[8]263       eval export $var=\$value
[1]264    fi
[215]265 done < $tmp_mbuild
[1]266
[503]267    # NOW CHECK, IF A GLOBAL SOURCE-CODE-PATH HAS BEEN DECLARED
[1]268 line=""
[215]269 grep "%source_path" $config_file  >  $tmp_mbuild
[69]270 while read line
[1]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
[215]279 done < $tmp_mbuild
[1]280
281 line=""
[215]282 grep  " $local_host" $config_file | grep "%source_path"  >  $tmp_mbuild
[69]283 while read line
[1]284 do
285    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
286    then
287       local_source_path=`echo $line | cut -d" " -s -f2`
288    fi
[215]289 done < $tmp_mbuild
[1]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
[8]304 eval local_source_path=$local_source_path
[1]305
306
[215]307
[503]308    # DETERMINE GLOBAL DEPOSITORY-PATH
[1]309 line=""
[215]310 grep "%depository_path" $config_file  >  $tmp_mbuild
[69]311 while read line
[1]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
[215]320 done < $tmp_mbuild
[1]321
322
323
[503]324    # CHECK, IF A MAIN PROGRAM HAS BEEN DEFINED IN THE CONFIG-FILE
[5]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
[503]342    # CHECK IF MAKEFILE EXITS
[1]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
[503]353    # HEADER-OUTPUT (PART1: MESSAGES CONCERNING THE LOCAL HOST)
[1]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
[40]376 if [[ $compile_utility_programs = false ]]
377 then
[1]378
[503]379       # IN ANY CASE, GIVE ALL FILES WRITE-PERMIT, IN ORDER TO AVOID PROBLEMS
380       # WITH OVERWRITING FILES ON THE REMOTE HOST
[215]381    cd  $local_source_path
382    printf "\n\n  *** tar of makefile and source files in $local_source_path" 
[40]383    tar -cf  ${mainprog}_sources.tar  Makefile  *.$suf
384    printf "\n"
[1]385
[40]386 fi
[1]387
388
[40]389
[503]390    # GET CONFIRMATION TO CONTINUE
[1]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
[215]421 grep  %fopts  $config_file  >  $tmp_mbuild
[69]422 while read line
[1]423 do
424       # KOMMENTARZEILEN UEBERSPRINGEN
425    [[ $(echo $line | cut -c1) = "#" ]]  &&  continue
426    (( ihost = ihost + 1 ))
427    hostline[$ihost]="$line"
[215]428 done < $tmp_mbuild
[1]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
[493]454    modules=""
[82]455    netcdf_inc=""
456    netcdf_lib=""
[1]457
458       # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN
459    case  $remote_host  in
[116]460        (lcmuk)          remote_addres=130.75.105.2;;
[181]461        (lcsgib)         remote_addres=130.73.232.102;;
[346]462        (lcsgih)         remote_addres=130.75.4.102;;
[367]463        (lck)            remote_addres=165.132.26.61;;
[83]464        (lctit)          remote_addres=172.17.75.161;;
[206]465        (lcxt4)          remote_addres=129.177.20.113;;
[437]466        (lcxt5m)         remote_addres=193.166.211.144;;
[83]467        (decalpha)       remote_addres=165.132.26.56;;
[305]468        (ibmh)           remote_addres=136.172.40.15;;
[83]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 ]]
[1]475                         then
[83]476                            printf "\n  +++ remote host \"$remote_host\" unknown";
[503]477                            printf "\n      please inform PALM group support!"
[1]478                         fi;;
479    esac
480
481
482       # REMOTE-USERNAMEN ERMITTELN
483    line=""
[116]484    found=false
[215]485    grep  "$remote_host_string" $config_file | grep "%remote_username"  >  $tmp_mbuild
[69]486    while read line1
[1]487    do
[116]488
[1]489       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
490       then
491          line="$line1"
492       fi
[116]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
[215]500    done < $tmp_mbuild
[1]501
[116]502    if [[ $found = false ]]
[1]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=""
[54]512    remote_source_path=""
[215]513    grep  "$remote_host_string" $config_file | grep "%source_path"  >  $tmp_mbuild
[69]514    while read line1
[1]515    do
[116]516
[1]517       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
518       then
519          line="$line1"
520       fi
[116]521
522       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
523       then
524          remote_source_path=`echo $line | cut -d" " -s -f2`
525       fi
526
[215]527    done < $tmp_mbuild
[1]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
[22]541    remote_ud=${remote_source_path}/../UTIL
[24]542    remote_ud=$(eval echo $remote_ud)
[1]543
[54]544
[1]545       # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN
[54]546    remote_md=""
[1]547    line=""
[215]548    grep  "$remote_host_string" $config_file | grep "%depository_path"  >  $tmp_mbuild
[69]549    while read line1
[1]550    do
[116]551
[1]552       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
553       then
554          line="$line1"
555       fi
[116]556
557       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
558       then
559          remote_md=`echo $line | cut -d" " -s -f2`
560       fi
561
[215]562    done < $tmp_mbuild
[1]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
[8]577    remote_md=$(eval echo $remote_md)
[503]578    block=""
579    [[ "$condition1" != "" ]]  &&  block=_$condition1
580    [[ "$condition2" != "" ]]  &&  block=${block}_$condition2
581    remote_md==${remote_md}$block
[1]582
[8]583
[1]584       # COMPILERNAMEN ERMITTELN
585    line=""
[116]586    found=false
[215]587    grep  "$remote_host_string" $config_file | grep "%compiler_name "  >  $tmp_mbuild
[69]588    while read line1
[1]589    do
[116]590
[1]591       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
592       then
593          line="$line1"
594       fi
[116]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
[215]602    done < $tmp_mbuild
[1]603
[116]604    if [[ $found = false ]]
[1]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
[27]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=""
[116]617       found=false
[215]618       grep  "$remote_host_string" $config_file | grep "%compiler_name_ser"  >  $tmp_mbuild
[69]619       while read line1
[27]620       do
[116]621
[27]622          if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
623          then
624             line="$line1"
625          fi
[116]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
[215]633       done < $tmp_mbuild
[1]634
[116]635       if [[ $found = false ]]
[27]636       then
[28]637          printf "\n  +++ no serial compiler name found in configuration file"
[27]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
[82]647       # PRAEPROZESSOR-OPTIONEN/DIREKTIVEN ERMITTELN
648    line=""
[116]649    found=false
[215]650    grep  "$remote_host_string" $config_file | grep "%cpp_options"  >  $tmp_mbuild
[82]651    while read line1
652    do
[116]653
[82]654       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
655       then
656          line="$line1"
657       fi
[116]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
[215]666    done < $tmp_mbuild
[116]667
668    if [[ $found = false ]]
[82]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
[116]675
[82]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 "
[83]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"
[82]688       else
[83]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
[82]695       fi
696    done
697
698
699
700       # NETCDF-OPTIONEN ERMITTELN
701    line=""
[215]702    grep  "$remote_host_string" $config_file | grep "%netcdf_inc"  >  $tmp_mbuild
[82]703    while read line1
704    do
[116]705
[82]706       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
707       then
708          line="$line1"
709       fi
[116]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
[215]717    done < $tmp_mbuild
[82]718
719    line=""
[215]720    grep  "$remote_host_string" $config_file | grep "%netcdf_lib"  >  $tmp_mbuild
[82]721    while read line1
722    do
[116]723
[82]724       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
725       then
726          line="$line1"
727       fi
[116]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
[215]735    done < $tmp_mbuild
[82]736
737
738
[475]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
[1]762       # COMPILEROPTIONEN ERMITTELN
763    line=""
[116]764    found=false
[215]765    grep  "$remote_host_string" $config_file | grep "%fopts"  >  $tmp_mbuild
[69]766    while read line1
[1]767    do
[116]768
[1]769       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
770       then
771          line="$line1"
772       fi
[116]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
[215]784    done < $tmp_mbuild
[116]785
786    if [[ $found = false ]]
[1]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
[82]792
[1]793
794
[503]795       # get modules to be loaded
[221]796    line=""
[493]797    grep  "$remote_host_string" $config_file | grep "%modules"  >  $tmp_mbuild
[221]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
[493]809          modules=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
[221]810       fi
811
812    done < $tmp_mbuild
813
814
815
816
[1]817       # LADER-OPTIONEN ERMITTELN
818    line=""
[116]819    found=false
[215]820    grep  "$remote_host_string" $config_file | grep "%lopts"  >  $tmp_mbuild
[69]821    while read line1
[1]822    do
[116]823
[1]824       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
825       then
826          line="$line1"
827       fi
[116]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
[215]839    done < $tmp_mbuild
[1]840
[116]841    if [[ $found = false ]]
[1]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
[82]847
[1]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"
[215]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
[25]870    if [[ $compile_utility_programs = true ]]
871    then
872       column1="utility directory:"; column2=$remote_ud
873       printf "| $column1$column2 | \n"
874    fi
[1]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"
[28]881    if [[ $compile_utility_programs = true ]]
882    then
883       column1="serial compiler:"; column2=$compiler_name_ser
884       printf "| $column1$column2 | \n"
885    fi
[475]886    if [[ "$make_options" != "" ]]
887    then
888       column1="make options:"; column2=$make_options
889       printf "| $column1$column2 | \n"
890    fi
[1]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
[493]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
[1]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
[503]951          silent=true
[1]952       fi
953       if [[ $answer = s  ||  $answer = S ]]
954       then
955          continue
956       fi
957    fi
958
959
[475]960       # make on remote host
961    if [[ $remote_host != $local_host ]]
[1]962    then
963
[475]964       if [[ $compile_utility_programs = false ]]
[1]965       then
966
[475]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
[1]988
989
990
[475]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
[1]1001
1002
[475]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
[1]1013
1014
[475]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"
[1]1020
[493]1021
1022             # generate make call with make options
[475]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
[1]1029
[493]1030             # generate command to load modules, if modules are given
1031          if [[ "$modules" != "" ]]
1032          then
1033             module_calls="module load ${modules};"
[503]1034          else
1035             module_calls=""
[493]1036          fi
1037
[475]1038          if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
1039          then
[1]1040
[493]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
[1]1042
[475]1043          elif [[ $remote_host = ibmh ]]
1044          then
[1]1045
[493]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
[1]1047
[475]1048          elif [[ $remote_host = lcsgib  ||  $remote_host = lcsgih ]]
1049          then
[1]1050
[493]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
[1]1052
[475]1053          elif [[ $remote_host = lctit ]]
1054          then
[1]1055
[475]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
[1]1061
[475]1062          elif [[ $remote_host = lcxt4 ]]
[1]1063          then
1064
[493]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
[1]1066
[475]1067          else
[1]1068
[493]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
[1]1070
[475]1071          fi
[1]1072
[475]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 ]]
[40]1077             then
[475]1078                answer=dummy
1079                printf "\n"
1080                while [[ "$answer" != c  &&  "$answer" != k ]]
[40]1081                do
[475]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
[40]1088                done
[475]1089                if [[ $answer = k ]]
[40]1090                then
[475]1091                   locat=user_abort; exit
[1]1092                fi
1093             fi
[475]1094          fi
[1]1095
1096
1097
[475]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
[1]1108
1109
[475]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"
[1]1114
1115
[25]1116
1117
[475]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 ]]
[22]1129          then
[475]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
[503]1132                # TIT ERLAUBT NUR DIE AUSFUEHRUNG GANZ BESTIMMTER KOMMANDOS
[475]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
[22]1136
[475]1137             # KOPIEREN DER SCRIPTE
1138          if [[ $local_host = decalpha ]]
1139          then
[503]1140                # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTAENDIGEN PFADES
[475]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
[22]1148
[475]1149          cd  -  > /dev/null
1150          cd  ${local_source_path}/../UTIL
[22]1151
[27]1152
[475]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
[27]1164
1165
[22]1166
[475]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"
[22]1172
[475]1173          if [[ $remote_host = nech ]]
1174          then
[503]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\" "
[475]1176          else
[503]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\" "
[475]1178          fi
[22]1179
[493]1180             # generate command to load modules, if modules are given
1181          if [[ "$modules" != "" ]]
1182          then
1183             module_calls="module load ${modules};"
[503]1184          else
1185             module_calls=""
[493]1186          fi
1187
[475]1188          if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
1189          then
[22]1190
[493]1191             ssh  ${remote_username}@${remote_addres}  "$module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR"
[22]1192
[475]1193          elif [[ $remote_host = ibmh ]]
1194          then
[22]1195
[493]1196             print "$module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres}
[22]1197
[475]1198          elif [[ $remote_host = lctit ]]
1199          then
[22]1200
[475]1201             echo  " "  >  ${remote_host}_last_make_protokoll
1202             while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
1203             do
[493]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
[475]1205             done
[22]1206
[475]1207          elif [[ $remote_host = lcxt4 ]]
1208          then
[22]1209
[493]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
[22]1211
[475]1212          else
[407]1213
[493]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
[407]1215
[475]1216          fi
[22]1217
[475]1218       fi    # ENDE UEBERSETZUNG DER UTILITY-PROGRAMME
[22]1219
[475]1220       rm -rf  ${remote_host}_last_make_protokoll
[22]1221
[475]1222       # make on local host
1223    else
[22]1224
[475]1225       if [[ $compile_utility_programs = false ]]
1226       then
[22]1227
[475]1228             # DEPOSITORY VERZEICHNIS ERZEUGEN, FALLS NOCH NICHT VORHANDEN
1229          eval remote_md=$remote_md
1230          if [[ ! -d $remote_md ]]
[40]1231          then
[475]1232             if  mkdir $remote_md
[215]1233             then
[475]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
[215]1242             fi
[475]1243          fi
[215]1244
[475]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
[215]1251
[475]1252             # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN
1253          echo " "
1254          echo "  *** execute \"make\" on local host"
[1]1255
[493]1256             # first load modules, if given
1257          if [[ "$modules" != "" ]]
1258          then
1259             module load ${modules}
1260          fi
1261
[475]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
[40]1263
[475]1264          if [[ $? != 0 ]]
1265          then
1266             printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1267             if [[ $silent = false ]]
[1]1268             then
[475]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 ]]
[1]1276                   then
[475]1277                      more ${remote_host}_last_make_protokoll
[1]1278                   fi
[475]1279                done
1280                if [[ $answer = k ]]
1281                then
1282                   locat=user_abort; exit
[1]1283                fi
1284             fi
[475]1285          fi
[1]1286
1287
[503]1288             # TAR NEW VERSION ON LOCAL HOST
[475]1289          printf "\n  *** tar update on local host ..."
1290          tar -cf  ${mainprog}_current_version.tar  *.$suf *.o *.mod
[1]1291
[22]1292
[475]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
[503]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"
[475]1303          cd  -  > /dev/null
[1]1304       fi
1305
1306    fi
[475]1307
[1]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
[503]1324    # FINAL WORK
[1]1325 rm -f  hosts_found_in_config_file
1326
Note: See TracBrowser for help on using the repository browser.