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