source: palm/trunk/SCRIPTS/mbuild @ 222

Last change on this file since 222 was 221, checked in by raasch, 15 years ago

new environment variable mpilib in configuration file, used by mrun, mbuild, and subjob; small bugfix concerning t<0 in init_cloud_physics

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