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