source: palm/trunk/SCRIPTS/mbuild @ 410

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

humidity for non-flat topography implemented, re-adjustments for lcxt4

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