source: palm/trunk/SCRIPTS/mbuild_new @ 8

Last change on this file since 8 was 8, checked in by raasch, 17 years ago

bugfix mbuild

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