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