source: palm/trunk/SCRIPTS/mbuild @ 492

Last change on this file since 492 was 492, checked in by maronga, 14 years ago

bugfix in the UTIL Makefile

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