source: palm/trunk/SCRIPTS/mbuild_new @ 4

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

Initial repository layout and content

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