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