source: palm/trunk/SCRIPTS/mbuild @ 496

Last change on this file since 496 was 493, checked in by raasch, 14 years ago

New:
---
Output in NetCDF4-format. New d3par-parameter netcdf_data_format.

(check_open, check_parameters, close_file, data_output_2d, data_output_3d, header, modules, netcdf, parin)

Modules to be loaded for compilation (mbuild) or job execution (mrun)
can be given in the configuration file using variable modules. Example:

%modules ifort/11.0.069:netcdf lcsgih parallel

This method replaces the (undocumented) mpilib-variable.

WARNING: All fixed settings of modules in the scripts mbuild, mrun, and subjob
have been removed! Please set the modules variable appropriately in your
configuration file. (mbuild, mrun, subjob)

Changed:


Parameters netcdf_64bit and netcdf_64bit_3d have been removed. Use
netcdf_data_format = 2 for choosing the classic 64bit-offset format (this is
the default). The offset-format can not be set independently for the
3d-output-data any more.

Parameters netcdf_format_mask, netcdf_format_mask_av, and variables
nc_format_mask, format_parallel_io removed. They are replaced by the new
parameter netcdf_data_format. (check_open, close_file,
data_output_mask, header, init_masks, modules, parin)

Errors:


bugfix in trunk/UTIL/Makefile: forgot to compile for interpret_config

Bugfix: timeseries data have to be collected by PE0 (user_statistics)

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