source: palm/trunk/SCRIPTS/mbuild_new @ 5

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

html-documentation added

File size: 46.9 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       echo "*** export $var=$value"
221       eval export $var=$value
222       eval echo \"   $var=\$$var \"
223    fi
224 done
225
226    # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE
227 line=""
228 grep "%source_path" $config_file  |  while read line
229 do
230    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
231    then
232       if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]]
233       then
234          global_source_path=`echo $line | cut -d" " -s -f2`
235       fi
236    fi
237 done
238
239 line=""
240 grep  " $local_host" $config_file | grep "%source_path"  |  while read line
241 do
242    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
243    then
244       local_source_path=`echo $line | cut -d" " -s -f2`
245    fi
246 done
247
248 if [[ "$local_source_path" = "" ]]
249 then
250    if [[ "$global_source_path" != "" ]]
251    then
252       local_source_path=$global_source_path
253    else
254       printf "\n  +++ no source path found in configuration file"
255       printf "\n      for local host \"$local_host\" "
256       printf "\n      please set \"\%source_path\" in configuration file"
257       locat=config_file; exit
258    fi
259 fi
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
299
300
301    # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM
302    # VEREINBART WURDE
303 if [[ $(grep -c "%mainprog" $config_file) != 1 ]]
304 then
305    printf "\n  +++ no main program or more than one main program defined"
306    printf "\n      in configuration file"
307    locat=configuration; exit
308 else
309    line=`grep "%mainprog" $config_file`
310    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
311    then
312       printf "\n  +++ no main program defined in configuration file"
313       locat=configuration; exit
314    fi
315    mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1`
316 fi
317
318
319
320    # MAKEFILE vorhanden
321 [[ "$makefile" = "" ]]  &&  makefile=$local_source_path/Makefile
322 if [[ ! -f $makefile ]]
323 then
324    printf "\n  +++ makefile: "
325    printf "\n           $makefile"
326    printf "\n      does not exist"
327    locat=makefile; exit 
328 fi
329
330
331    # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER)
332 calltime=$(date)
333 printf "\n"
334 printf "#------------------------------------------------------------------------# \n"
335 printf "| $version$calltime | \n"
336 printf "|                                                                        | \n"
337 column1="called on:"; column2=$local_host_real_name
338 printf "| $column1$column2 | \n"
339 column1="local username:"; column2=$local_username
340 printf "| $column1$column2 | \n"
341 column1="local IP-addres:"; column2=$local_addres
342 printf "| $column1$column2 | \n"
343 column1="config file:"; column2=$config_file
344 printf "| $column1$column2 | \n"
345 column1="makefile:"; column2=$makefile
346 printf "| $column1$column2 | \n"
347 column1="local source path:"; column2=$local_source_path
348 printf "| $column1$column2 | \n"
349 column1="make depository:"; column2=$local_depository_path
350 printf "| $column1$column2 | \n"
351 printf "#------------------------------------------------------------------------# \n"
352
353# printf "|                                                                        | \n"
354
355
356 cd  $local_source_path
357
358
359    # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN
360 source_code_files=`ls -1  *.$suf`
361
362
363
364    # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN,
365    # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN
366    # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN
367 if [[ ! -d $local_depository_path ]]
368 then
369    if  mkdir $local_depository_path
370    then
371       printf "\n\n  *** directory for make depository:"
372       printf "\n           $local_depository_path"
373       printf "\n      was created\n"
374
375          # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG
376          # IHRES DATUMS INS VERZEICHNIS KOPIEREN
377       printf "\n  *** makefile and source code files are copied to"
378       printf "\n      $local_depository_path\n"
379       printf "\n      copying makefile \"$makefile\" ..."
380       cp -p  $makefile  $local_depository_path/Makefile
381
382          # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT
383          # SEIN
384       for  filename  in  $source_code_files
385       do
386          if [[ $(grep -c $filename  $makefile) = 0 ]]
387          then
388             printf "\n  +++ source code file:"
389             printf "\n         $filename"
390             printf "\n      is not listed in makefile"
391             locat=makefile; exit
392          else
393             printf "\n      copying source code file \"$filename\" ..."
394             cp -p  $filename  $local_depository_path
395          fi
396       done
397       printf "\n"
398    else
399       printf "\n  +++ directory for make depository:"
400       printf "\n           $local_depository_path"
401       printf "\n      cannot be created"
402       locat=local_depository_path; exit
403    fi
404 else
405 
406    printf "\n  *** checking file status ..."
407
408       # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS
409    if [[ $makefile -nt $local_depository_path/Makefile ]]
410    then
411       printf "\n  *** update of \"$makefile\" "
412       cp -f -p  $makefile  $local_depository_path/Makefile
413       update=true
414
415          # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE
416          # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN
417       cd  $local_depository_path
418       source_code_files_in_depository=`ls -1  *.$suf`
419       for  filename  in  $source_code_files_in_depository
420       do
421          if [[ $(grep -c $filename  Makefile) = 0 ]]
422          then
423             printf "\n  *** source code file in \"$local_depository_path\":"
424             printf "\n         $filename"
425             printf "\n      is not listed in makefile"
426             if [[ $silent = false ]]
427             then
428                answer=dummy
429                printf "\n\n"
430                while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
431                do
432                   printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ?  "
433                   read  answer
434                done
435                if [[ $answer = y  ||  $answer = Y ]]
436                then
437                   base=`echo $filename | cut -d. -f2`
438                   rm -f  $filename
439                   rm -f  ${base}.o  ${base}.mod
440                   printf "\n  *** \"$filename\" deleted in \"$local_depository_path\" "
441                else
442                   printf "\n  *** \"$filename\" not deleted in \"$local_depository_path\" "
443                fi
444             fi
445          fi
446       done
447       cd  -  > /dev/null  2>&1
448
449    elif [[ $local_depository_path/Makefile -nt $makefile ]]
450    then
451       printf "\n  *** makefile in depository is newer than"
452       printf "\n      \"$makefile\" "
453       if [[ $silent = false ]]
454       then
455          answer=dummy
456          printf "\n\n"
457          while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
458          do
459             printf " >>> update \"$makefile\" (y/n) ?  "
460             read  answer
461          done
462          if [[ $answer = y  ||  $answer = Y ]]
463          then
464             cp -f -p  $local_depository_path/Makefile  $makefile
465             printf "\n  *** \"$makefile\" updated"
466          else
467             printf "\n  *** \"$makefile\" not updated"
468          fi
469       fi
470    fi
471
472       # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS
473       # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN
474    for  filename  in  $source_code_files
475    do
476       if [[ $(grep -c $filename  $makefile) = 0 ]]
477       then
478          printf "\n  +++ source code file:"
479          printf "\n         $filename"
480          printf "\n      is not listed in makefile"
481          locat=makefile; exit
482       else
483          if [[ ! -f $local_depository_path/$filename ]]
484          then
485             cp -p  $filename  $local_depository_path
486             printf "\n  *** source code file \"$filename\" created in \"$local_depository_path\" "
487          fi
488          if [[ $filename -nt $local_depository_path/$filename ]]
489          then
490             printf "\n  *** update of source code file \"$filename\" "
491             cp -f -p  $filename  $local_depository_path
492             update=true
493          fi
494       fi
495    done
496
497
498       # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN
499       # ODER EVTL. NEUEREN DATUMS SIND
500    cd  $local_depository_path
501    source_code_files_in_depository=`ls -1  *.$suf`
502    cd  -  > /dev/null  2>&1
503    for  filename  in  $source_code_files_in_depository
504    do
505       if [[ ! -f $filename ]]
506       then
507          printf "\n  *** source code file \"$filename\" does not exist in current directory"
508          if [[ $silent = false ]]
509          then
510             answer=dummy
511             printf "\n\n"
512             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
513             do
514                printf " >>> create \"$filename\" in current directory (y/n) ?  "
515                read  answer
516             done
517             if [[ $answer = y  ||  $answer = Y ]]
518             then
519                cp -p  $local_depository_path/$filename  $filename
520                printf "\n  *** source code file \"$filename\" created in current directory"
521             else
522                printf "\n  *** source code file \"$filename\" not created in current directory"
523             fi
524          fi
525       elif [[ $local_depository_path/$filename -nt $filename ]]
526       then
527          ls -al $local_depository_path/$filename
528          ls -al $filename
529          printf "\n  *** source code file \"$filename\" in depository is newer than in current directory"
530          if [[ $silent = false ]]
531          then
532             answer=dummy
533             printf "\n\n"
534             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
535             do
536                printf " >>> update \"$filename\" in current directory (y/n) ?  "
537                read  answer
538             done
539             if [[ $answer = y  ||  $answer = Y ]]
540             then
541                cp -f -p  $local_depository_path/$filename  $filename
542                printf "\n  *** source code file \"$filename\" updated in current directory"
543             else
544                printf "\n  *** source code file \"$filename\" not updated in current directory"
545             fi
546          fi
547       fi
548    done
549
550    if [[ $update = false ]]
551    then
552       printf "\n  *** no updates necessary in \"$local_depository_path\" "
553       if [[ $silent = false ]]
554       then
555          answer=dummy
556          printf "\n\n"
557          while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
558          do
559             printf " >>> continue with updates on remote hosts (y/n) ?  "
560             read  answer
561          done
562          if [[ $answer = n  ||  $answer = N ]]
563          then
564             locat=user_abort; exit
565          fi
566       fi
567    fi
568 fi
569 
570
571 
572    # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN
573    # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF
574    # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT
575 printf "\n\n  *** tar of makefile and source files in depository ..." 
576 cd  $local_depository_path
577 chmod u+w  Makefile  *.$suf
578 tar -cf  ${mainprog}_sources.tar  Makefile  *.$suf
579 printf "\n"
580
581
582
583    # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN
584 if [[ $host = all ]]
585 then
586    printf "\n  *** updates will be made for ALL hosts found in"
587    printf "\n      the configuration file"
588 else
589    printf "\n  *** update will be made for host \"$host\" "
590 fi
591
592 if [[ $silent = false ]]
593 then
594    answer=dummy
595    printf "\n\n"
596    while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
597    do
598       printf " >>> continue (y/n) ?  "
599       read  answer
600    done
601    if [[ $answer = n  ||  $answer = N ]]
602    then
603       locat=user_abort; exit
604    fi
605 fi
606 
607 
608
609   
610    # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS-
611    # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN
612 printf "\n  *** scanning configuration file for host(s) ..."
613
614 grep  %fopts  $config_file  |  while read line
615 do
616       # KOMMENTARZEILEN UEBERSPRINGEN
617    [[ $(echo $line | cut -c1) = "#" ]]  &&  continue
618    (( ihost = ihost + 1 ))
619    hostline[$ihost]="$line"
620 done
621
622 
623 while (( ih < ihost ))
624 do
625
626    (( ih = ih + 1 ))
627
628       # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN
629       # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS
630       # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE
631    remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-`
632    remote_host=`echo $remote_host_string | cut -d" " -f1`
633    if [[ $host != all ]]
634    then
635       [[ $remote_host != $host ]]  &&  continue
636    fi
637    host_found=true
638    condition1=`echo $remote_host_string | cut -d" " -s -f2`
639    if [[ $condition1 = $remote_host ]]
640    then
641       condition1=""
642    else
643       condition2=`echo $remote_host_string | cut -d" " -s -f3`
644    fi
645
646
647       # AUF HLRN-RECHNER NUR EINMAL UEBERSETZEN
648    if [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
649    then
650       if [[ $ibm_hb_done = true ]]
651       then
652          printf "\n *** remote host \"$remote_host\" skipped since compilation has already"
653          printf "\n     been carried out on one of the HLRN machines\n"
654          continue
655       fi
656    fi
657
658       # AUF LCMUK-RECHNER NUR EINMAL UEBERSETZEN
659    if [[ $remote_host = lcmuk ]]
660    then
661       if [[ $lcmuk_done = true ]]
662       then
663          printf "\n *** local host \"$remote_host\" skipped since compilation has already"
664          printf "\n     been carried out on this host\n"
665          continue
666       fi
667    fi
668
669
670       # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN
671    netcdf_support=false
672    case  $remote_host  in
673        (lcmuk)          remote_addres=130.75.105.3; cpp_options=""
674                         netcdf_support=true
675                         if [[ $scirocco = true ]]
676                         then
677                            netcdf_path=/opt/netcdf/3.6.2-beta4
678                         else
679                            netcdf_path=/muksoft/packages/netcdf/linux
680                         fi;;
681        (lctit)          remote_addres=172.17.75.161; netcdf_support=true
682                         netcdf_path=/home/usr5/mkanda/netcdf-3.6.1/src; cpp_options="-Mpreprocess";;
683        (decalpha)       remote_addres=165.132.26.56; cpp_options="-cpp"; netcdf_support=true
684                         netcdf_path=/usr/local/netcdf-3.5.1;;
685        (ibm)            remote_addres=134.76.99.81; cpp_options="-qsuffix=cpp=f90";;
686        (ibmb)           remote_addres=130.73.230.10; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
687                         netcdf_path=/aws/dataformats/netcdf-3.6.0-p1/64-32;;
688        (ibmh)           remote_addres=130.75.4.10; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
689                         netcdf_path=/aws/dataformats/netcdf-3.6.0-p1/64-32;;
690        (ibms)           remote_addres=150.183.5.101; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
691                         netcdf_path=/applic/lib/NETCDF64;;
692        (ibmy)           remote_addres=165.132.26.58; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
693                         netcdf_path=/usr1/users/raasch/pub/netcdf-3.6.0-p1;;
694        (nech)           remote_addres=136.172.44.192; cpp_options="-Ep"; netcdf_support=true
695                         netcdf_path=/pool/SX-6/netcdf/netcdf-3.6.0-p1;;
696        (neck)           remote_addres=133.5.178.11; cpp_options="-Ep"; netcdf_support=true
697                         netcdf_path=/home/DSRC/NC/tatuyama/pub/netcdf-3.6.0-p1;;
698        (t3eb)           remote_addres=130.73.206.21; cpp_options="-eZ";;
699        (t3eh)           remote_addres=130.75.4.131; cpp_options="-eZ";;
700        (t3ej2)          remote_addres=134.94.100.22; cpp_options="-eZ";;
701        (t3ej5)          remote_addres=134.94.100.49; cpp_options="-eZ";;
702        (ground.yonsei.ac.kr) remote_addres=134.75.155.33;;
703     (*)                 printf "\n  +++ remote host \"$remote_host\" unknown";
704                         printf "\n      please inform S. Raasch!";
705                         locat=config_file; exit;;
706    esac
707
708
709       # REMOTE-USERNAMEN ERMITTELN
710    line=""
711    grep  "$remote_host_string" $config_file | grep "%remote_username"  |  while read line1
712    do
713       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
714       then
715          line="$line1"
716       fi
717    done
718
719    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
720    then
721       printf "\n  +++ no remote username found in configuration file"
722       printf "\n      for \"$remote_host_string\" "
723       locat=config_file; exit
724    else
725       remote_username=`echo $line | cut -d" " -s -f2`
726    fi
727
728
729       # REMOTE-QUELLTEXTPFAD ERMITTELN
730    line=""
731    grep  "$remote_host_string" $config_file | grep "%source_path"  |  while read line1
732    do
733       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
734       then
735          line="$line1"
736       fi
737    done
738
739    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
740    then
741       remote_source_path=`echo $line | cut -d" " -s -f2`
742    fi
743    if [[ "$remote_source_path" = "" ]]
744    then
745       if [[ "$global_source_path" != "" ]]
746       then
747          remote_source_path=$global_source_path
748       else
749          printf "\n  +++ no source path found in configuration file"
750          printf "\n      for \"$remote_host_string\" "
751          locat=config_file; exit
752       fi
753    fi
754
755
756       # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN
757    line=""
758    grep  "$remote_host_string" $config_file | grep "%depository_path"  |  while read line1
759    do
760       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
761       then
762          line="$line1"
763       fi
764    done
765
766    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
767    then
768       remote_md=`echo $line | cut -d" " -s -f2`
769    fi
770    if [[ "$remote_md" = "" ]]
771    then
772       if [[ "$global_depository_path" != "" ]]
773       then
774          remote_md=$global_depository_path
775       else
776          printf "\n  +++ no depository path found in configuration file"
777          printf "\n      for \"$remote_host_string\" "
778          printf "\n      please set \"\%depository_path\" in configuration file"
779          locat=config_file; exit
780       fi
781    fi
782
783
784       # COMPILERNAMEN ERMITTELN
785    line=""
786    grep  "$remote_host_string" $config_file | grep "%compiler_name"  |  while read line1
787    do
788       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
789       then
790          line="$line1"
791       fi
792    done
793
794    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
795    then
796       printf "\n  +++ no compiler name found in configuration file"
797       printf "\n      for \"$remote_host_string\" "
798       locat=config_file; exit
799    else
800       compiler_name=`echo $line | cut -d" " -s -f2`
801    fi
802
803
804
805       # PRAEPROZESSOR-DIREKTIVEN SETZEN
806    if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
807    then
808       if [[ $remote_host = ibms ]]
809       then
810          cpp_options="$cpp_options -WF,-DMPI_REAL=MPI_DOUBLE_PRECISION"
811          [[ $netcdf_support = true ]]  &&  cpp_options="${cpp_options},-D__netcdf"
812       else
813          cpp_options="$cpp_options -WF,-DMPI_REAL=MPI_DOUBLE_PRECISION"
814          [[ $netcdf_support = true ]]  &&  cpp_options="${cpp_options},-D__netcdf,-D__netcdf_64bit"
815          [[ $remote_host = ibmy ]]  &&  cpp_options="${cpp_options},-D__ibmy_special"
816       fi
817    elif [[ $remote_host = lcmuk ]]
818    then
819       cpp_options="$cpp_options -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION"
820       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf -D__netcdf_64bit"
821    elif [[ $remote_host = lctit ]]
822    then
823       cpp_options="$cpp_options -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION"
824       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf"
825    elif [[ $remote_host = decalpha ]]
826    then
827       cpp_options="$cpp_options -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION"
828       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf"
829    elif [[ $remote_host = nech  ||  $remote_host = neck ]]
830    then
831       cpp_options="$cpp_options -DMPI_REAL=MPI_REAL8 -DMPI_2REAL=MPI_2REAL8 -DSCFFT=DZFFT -DCSFFT=ZDFFT"
832       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf -D__netcdf_64bit"
833    fi
834
835    if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
836    then
837       for  string  in  $remote_host_string
838       do
839          if [[ $(echo $string | cut -c1-3) = ibm ]]
840          then
841             cpp_options="${cpp_options},-D__ibm"
842             if [[ $remote_host = ibmy ]]
843             then
844                cpp_options="${cpp_options},-D__ibmy_special"
845             fi
846          else
847             cpp_options="${cpp_options},-D__$string"
848          fi
849       done
850       cpp_options="$cpp_options "
851    elif [[ $remote_host = nech  ||  $remote_host = neck ]]
852    then
853       for  string  in  $remote_host_string
854       do
855          if [[ $(echo $string | cut -c1-3) = nec ]]
856          then
857             cpp_options="${cpp_options} -D__nec"
858          else
859             cpp_options="${cpp_options} -D__$string"
860          fi
861       done
862       cpp_options="$cpp_options "
863    else
864       for  string  in  $remote_host_string
865       do
866          cpp_options="$cpp_options -D__$string "
867       done
868    fi
869
870
871       # COMPILEROPTIONEN ERMITTELN
872    line=""
873    grep  "$remote_host_string" $config_file | grep "%fopts"  |  while read line1
874    do
875       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
876       then
877          line="$line1"
878       fi
879    done
880    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
881    then
882       printf "\n  +++ no compiler options found in configuration file"
883       printf "\n      for \"$remote_host_string\" "
884       locat=config_file; exit
885    else
886          # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
887       compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
888    fi
889    if [[ $netcdf_support = true ]]
890    then
891       case  $remote_host  in
892          (decalpha)  compiler_options="-I${netcdf_path}/include  $compiler_options";;
893          (ibmb|ibmh) compiler_options="-I ${netcdf_path}/include-64  $compiler_options";;
894          (ibms)      compiler_options="-I /applic/netcdf64/src/f90  $compiler_options";;
895          (ibmy)      compiler_options="-I ${netcdf_path}/include  $compiler_options";;
896          (lcmuk)     compiler_options="-I ${netcdf_path}/include  $compiler_options";;
897          (lctit)     compiler_options="-I ${netcdf_path}/f90      $compiler_options";;
898          (nech|neck) compiler_options="-I ${netcdf_path}/include  $compiler_options";;
899       esac
900    fi
901
902
903
904       # LADER-OPTIONEN ERMITTELN
905    line=""
906    grep  "$remote_host_string" $config_file | grep "%lopts"  |  while read line1
907    do
908       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
909       then
910          line="$line1"
911       fi
912    done
913
914    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
915    then
916       printf "\n  +++ no loader options found in configuration file"
917       printf "\n      for \"$remote_host_string\" "
918       locat=config_file; exit
919    else
920          # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
921       loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
922    fi
923    if [[ $netcdf_support = true ]]
924    then
925       case  $remote_host  in
926          (decalpha)                   loader_options="$loader_options -L${netcdf_path}/lib -lnetcdf";;
927          (ibmb|ibmh|lcmuk|nech|neck)  loader_options="$loader_options -L${netcdf_path}/lib -lnetcdf";;
928          (ibms)                       loader_options="$loader_options -L${netcdf_path} -lnetcdf";;
929          (ibmy)                       loader_options="$loader_options -L${netcdf_path}/lib -lnetcdf";;
930          (lctit)                      loader_options="$loader_options -L${netcdf_path}/libsrc -lnetcdf";;
931       esac
932    fi
933
934
935    printf "\n\n#------------------------------------------------------------------------# \n"
936    if [[ $remote_host = $local_host ]]
937    then
938       column1="remote_host:"; column2="$remote_host (= local host!)"
939    else
940       column1="remote_host:"; column2=$remote_host
941    fi
942    printf "| $column1$column2 | \n"
943    printf "|                                                                        | \n"
944    column1="conditions:"; column2="$condition1 $condition2"
945    printf "| $column1$column2 | \n"
946    column1="make depository:"; column2=$remote_md
947    printf "| $column1$column2 | \n"
948    column1="username:"; column2=$remote_username
949    printf "| $column1$column2 | \n"
950    column1="addres:"; column2=$remote_addres
951    printf "| $column1$column2 | \n"
952    column1="compiler:"; column2=$compiler_name
953    printf "| $column1$column2 | \n"
954    column1="cpp options:"; column2=$cpp_options
955    printf "| $column1$column2 | \n"
956    line=$(echo "$cpp_options" | cut -c51-)
957    while [[ "$line" != "" ]]
958    do
959       column1=""
960       column2=$line
961       printf "| $column1$column2 | \n"
962       line=$(echo "$line" | cut -c51-)
963    done
964    column1="compiler options:"; column2=$compiler_options
965    printf "| $column1$column2 | \n"
966    line=$(echo "$compiler_options" | cut -c51-)
967    while [[ "$line" != "" ]]
968    do
969       column1=""
970       column2=$line
971       printf "| $column1$column2 | \n"
972       line=$(echo "$line" | cut -c51-)
973    done
974    column1="loader options:"; column2=$loader_options
975    printf "| $column1$column2 | \n"
976    line=$(echo "$loader_options" | cut -c51-)
977    while [[ "$line" != "" ]]
978    do
979       column1=""
980       column2=$line
981       printf "| $column1$column2 | \n"
982       line=$(echo "$line" | cut -c51-)
983    done
984    printf "#------------------------------------------------------------------------# \n"
985
986    if [[ $silent = false ]]
987    then
988       answer=dummy
989       printf "\n\n"
990       while [[ "$answer" != y  &&  "$answer" != Y  && "$answer" != c  &&  "$answer" != C  && "$answer" != s  &&  "$answer" != S  &&  "$answer" != a  &&  "$answer" != A ]]
991       do
992          printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ?  "
993          read  answer
994       done
995       if [[ $answer = a  ||  $answer = A ]]
996       then
997          locat=user_abort; exit
998       fi
999       if [[ $answer = c  ||  $answer = C ]]
1000       then
1001          silent=false
1002       fi
1003       if [[ $answer = s  ||  $answer = S ]]
1004       then
1005          continue
1006       fi
1007    fi
1008
1009
1010    if [[ $remote_mode = batch ]]
1011    then
1012
1013          # BATCH-JOB PARAMETER SETZEN
1014       case  $remote_host  in
1015           (t3eb)           queue=berte; memory=60; cputime=1000; xoption="-X 0";;
1016           (t3eh)           queue=comp_t3e; memory=60; cputime=360;;
1017           (t3ej2)          queue=normal; memory=60; cputime=1000; xoption="-X 0";;
1018           (t3ej5|ground.yonsei.ac.kr)  printf "\n  --- remote host \"$remote_host\" does not allow batch jobs"; continue;;
1019       esac
1020
1021
1022          # BATCH-JOB ZUSAMMENSTELLEN
1023       printf "\n  *** creating batch-job for remote host"
1024       echo " "  >  mbuild_job
1025
1026          # AUF CRAY-RECHNERN IN JUELICH WIRD KEIN BENUTZER-PROFILE AUSGEFUEHRT
1027          # DIES WIRD HIER GETAN, UM PFADE USW. ZU SETZEN
1028       if [[ $remote_host = t3ej2 ]]
1029       then
1030          echo "set +vx"                       >>  mbuild_job
1031          echo ". .profile"                    >>  mbuild_job
1032          echo "set -x"                        >>  mbuild_job
1033       fi
1034
1035          # AUF CRAY-RECHNERN GELADENE MODULE AUFLISTEN
1036       if [[ $host = t3eb  || $host = t3eh  ||  $host = t3ej2 ]]
1037       then
1038          echo "module list"                   >>  mbuild_job
1039       fi
1040
1041
1042          # WECHSEL IN TEMPORAERES VERZEICHNIS
1043       echo "cd ${remote_md}"  >>  mbuild_job
1044
1045
1046          # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1047       echo  "scp  ${local_username}@${local_addres}:~/modell/code_3dp/palm_current_version/${mainprog}_sources.tar  ${mainprog}_sources.tar"  >>  mbuild_job
1048#       echo  "[[ \$? != 0 ]]  &&  (echo "+++ scp failed"; exit)"  >>  mbuild_job
1049
1050
1051          # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN
1052       echo  "[[ -f ${mainprog}_current_version.tar ]]  &&  tar -xvf  ${mainprog}_current_version.tar"  >>  mbuild_job
1053
1054
1055          # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN
1056       echo  "tar -xvf  ${mainprog}_sources.tar"              >>  mbuild_job
1057
1058
1059          # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1060       echo  "make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "  >>  mbuild_job
1061       echo  "chmod  u+w  *"                                  >>  mbuild_job
1062
1063          # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN
1064       echo  "tar -cvf  ${mainprog}_current_version.tar  *.f90  *.o"  >>  mbuild_job
1065
1066
1067          # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN
1068       echo  "make  clean"                                    >>  mbuild_job
1069       echo  "rm ${mainprog}_sources.tar"                     >>  mbuild_job
1070       echo  "rm *.f90 Makefile"                              >>  mbuild_job
1071
1072
1073
1074          # JOB MITTELS SUBJOB STARTEN
1075       printf "\n  *** sending batch job to remote host"
1076#       subjob  $xoption  -h $remote_host  -q $queue  -m $memory  -t $cputime  -v  mbuild_job
1077
1078
1079          # JOBFILE LOESCHEN
1080#       rm  aljob
1081
1082    else
1083
1084       if [[ $remote_host != $local_host ]]
1085       then
1086
1087             # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1088             # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT
1089          echo "  *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" "
1090          if [[ $remote_host != lctit ]]
1091          then
1092             ssh  ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"
1093          else
1094                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1095                # MIT SSH, DESHALB AUFRUF PER PIPE
1096             print "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"  |  ssh ${remote_username}@${remote_addres}  2>&1
1097          fi
1098          if [[ $local_host = decalpha ]]
1099          then
1100                # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES
1101                # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
1102                # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
1103             remote_md=`echo $remote_md | sed 's/\$HOME\///'`
1104             /bin/scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
1105          else
1106             scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
1107          fi
1108
1109
1110
1111             # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN
1112          echo "  *** untar previous update on remote host, if existing"
1113          if [[ $remote_host != lctit ]]
1114          then
1115             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"
1116          else
1117                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1118                # MIT SSH, DESHALB AUFRUF PER PIPE
1119             print  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1120          fi
1121
1122
1123             # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN
1124          echo "  *** untar actual sources on remote host"
1125          if [[ $remote_host != lctit ]]
1126          then
1127             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"
1128          else
1129                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1130                # MIT SSH, DESHALB AUFRUF PER PIPE
1131             print  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1132          fi
1133
1134
1135             # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1136             # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND
1137             # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE
1138             # Z.B. DIE PFADE ZUM COMPILER)
1139          echo "  *** execute \"make\" on remote host"
1140
1141          if [[ $remote_host = nech ]]
1142          then
1143             make_call_string="sxmake  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1144          else
1145             make_call_string="make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1146          fi
1147
1148          if [[ $remote_host = t3eh ]]
1149          then
1150       
1151             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
1152
1153          elif [[ $remote_host = t3ej2  ||  $remote_host = ibms  ||  $remote_host = ibmy ]]
1154          then
1155
1156             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
1157
1158          elif [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
1159          then
1160
1161             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
1162
1163          elif [[ $remote_host = lctit ]]
1164          then
1165
1166             echo  " "  >  ${remote_host}_last_make_protokoll
1167             while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
1168             do
1169                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
1170             done
1171
1172          else
1173
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
1176          fi
1177
1178          if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]]
1179          then
1180             printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1181             if [[ $silent = false ]]
1182             then
1183                answer=dummy
1184                printf "\n"
1185                while [[ "$answer" != c  &&  "$answer" != k ]]
1186                do
1187                   printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
1188                   read  answer
1189                   if [[ "$answer" = l ]]
1190                   then
1191                      more ${remote_host}_last_make_protokoll
1192                   fi
1193                done
1194                if [[ $answer = k ]]
1195                then
1196                   locat=user_abort; exit
1197                fi
1198             fi
1199          fi
1200
1201
1202
1203             # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN
1204          printf "\n  *** tar update on remote host ..."
1205          if [[ $remote_host != lctit ]]
1206          then
1207             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"
1208          else
1209                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1210                # MIT SSH, DESHALB AUFRUF PER PIPE
1211             print  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1212          fi
1213
1214
1215             # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN
1216#          printf "\n  *** \"make clean\" on remote host ..."
1217#          ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; make clean; rm ${mainprog}_sources.tar; rm *.f90 Makefile"
1218#          printf "\n"
1219
1220
1221             # NUR AUF EINEM HLRN-RECHNER UEBERSETZEN
1222          [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]  &&  ibm_hb_done=true
1223
1224       else
1225
1226             # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN
1227          echo "  *** execute \"make\" on local host"
1228
1229          make  PROG=$mainprog  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"  2>&1 | tee ${remote_host}_last_make_protokoll
1230
1231          if [[ $? != 0 ]]
1232          then
1233             printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1234             if [[ $silent = false ]]
1235             then
1236                answer=dummy
1237                printf "\n"
1238                while [[ "$answer" != c  &&  "$answer" != k ]]
1239                do
1240                   printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
1241                   read  answer
1242                   if [[ "$answer" = l ]]
1243                   then
1244                      more ${remote_host}_last_make_protokoll
1245                   fi
1246                done
1247                if [[ $answer = k ]]
1248                then
1249                   locat=user_abort; exit
1250                fi
1251             fi
1252          fi
1253
1254
1255             # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN
1256          printf "\n  *** tar update on local host ..."
1257          tar -cf  ${mainprog}_current_version.tar  *.$suf *.o *.mod
1258
1259             # NUR EINMAL AUF LCMUK UEBERSETZEN
1260          [[ $remote_host = lcmuk ]]  &&  lcmuk_done=true
1261
1262       fi
1263
1264    fi
1265 done
1266
1267
1268 if [[ $host_found = false ]]
1269 then
1270    if [[ $host = all ]]
1271    then
1272       printf "\n  +++ no hosts found in configuration file"
1273    else
1274       printf "\n  +++ host \"$host\" not found in configuration file"
1275    fi
1276    locat=config_file; exit
1277 fi
1278
1279
1280
1281    # ABSCHLIESSENDE ARBEITEN
1282 rm -f  hosts_found_in_config_file
1283
Note: See TracBrowser for help on using the repository browser.