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