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