[2380] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | # palmbuild - script for compiling the PALM code and its utility programs |
---|
| 4 | |
---|
| 5 | #------------------------------------------------------------------------------# |
---|
[2696] | 6 | # This file is part of the PALM model system. |
---|
[2380] | 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 | # |
---|
[2696] | 19 | # Copyright 2017-2017 Leibniz Universitaet Hannover |
---|
[2380] | 20 | #------------------------------------------------------------------------------# |
---|
| 21 | # |
---|
| 22 | # Current revisions: |
---|
| 23 | # ------------------ |
---|
| 24 | # |
---|
[2410] | 25 | # |
---|
[2380] | 26 | # Former revisions: |
---|
| 27 | # ----------------- |
---|
| 28 | # $Id: palmbuild 2696 2017-12-14 17:12:51Z kanani $ |
---|
[2566] | 29 | # informative messages switched of almost completely in silent mode |
---|
| 30 | # two header blocks merged into one |
---|
| 31 | # |
---|
| 32 | # 2506 2017-09-29 08:30:37Z raasch |
---|
[2506] | 33 | # option -V added to check for an existing SOURCES_FOR_RUN_... folder |
---|
| 34 | # host configuration added to SOURCES_FOR_RUN_... folder name |
---|
| 35 | # SOURCES_FOR_RUN_... folder is deleted in case of compilation errors |
---|
| 36 | # host_identifier renamed host_configuration |
---|
| 37 | # |
---|
| 38 | # 2500 2017-09-25 11:10:03Z raasch |
---|
[2500] | 39 | # bugfix for r2492 |
---|
| 40 | # |
---|
| 41 | # 2492 2017-09-21 14:18:48Z raasch |
---|
[2489] | 42 | # ask for compilation, if SOURCES_FOR_RUN_... exists |
---|
| 43 | # |
---|
| 44 | # 2487 2017-09-21 11:30:10Z raasch |
---|
[2487] | 45 | # bugfix: abort in case of compiling/linking errors in silent mode |
---|
| 46 | # |
---|
| 47 | # 2422 2017-09-08 08:25:41Z raasch |
---|
[2422] | 48 | # initial revision |
---|
[2410] | 49 | # |
---|
[2380] | 50 | #------------------------------------------------------------------------------# |
---|
| 51 | # palmbuild - script for compiling the PALM code and its utility programs |
---|
| 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 | # |
---|
| 56 | # @note This script does not work on MAC OS |
---|
| 57 | #------------------------------------------------------------------------------# |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | # VARIABLE DECLARATIONS + DEFAULT VALUES |
---|
| 61 | calltime="" |
---|
| 62 | column1="" |
---|
| 63 | column2="" |
---|
[2506] | 64 | host_configuration=default |
---|
[2380] | 65 | locat=normal |
---|
| 66 | makefile="" |
---|
| 67 | make_options="" |
---|
| 68 | module_commands="" |
---|
| 69 | program_name=palm |
---|
| 70 | remote_ip="" |
---|
| 71 | silent=false |
---|
| 72 | ssh_key="" |
---|
| 73 | suf=f90 |
---|
[2506] | 74 | use_existing_sources_folder=false |
---|
[2422] | 75 | version="palmbuild 1.0 Rev$Rev: 2316 $" |
---|
[2380] | 76 | working_directory=`pwd` |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | # ERROR HANDLING |
---|
| 81 | # IN CASE OF EXIT: |
---|
[2506] | 82 | trap 'rm -rf ${source_path}/${host_configuration}_last_make_protocol |
---|
| 83 | if [[ $locat != normal ]] |
---|
[2380] | 84 | then |
---|
| 85 | printf "\n\n +++ palmbuild killed \n\n" |
---|
| 86 | exit 1 |
---|
| 87 | else |
---|
[2566] | 88 | if [[ $silent = false ]] |
---|
| 89 | then |
---|
| 90 | printf "\n\n *** palmbuild finished \n\n" |
---|
| 91 | fi |
---|
[2380] | 92 | exit 0 |
---|
[2489] | 93 | fi |
---|
| 94 | ' exit |
---|
[2380] | 95 | |
---|
| 96 | |
---|
| 97 | # IN CASE OF TERMINAL-BREAK: |
---|
| 98 | trap 'printf "\n\n +++ palmbuild killed by \"^C\" \n\n" |
---|
[2506] | 99 | rm ${source_path}/${host_configuration}_last_make_protocol |
---|
[2380] | 100 | exit |
---|
| 101 | ' 2 |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | # READ SHELLSCRIPT-OPTIONS |
---|
[2506] | 106 | while getopts :d:h:m:s:S:uvV option |
---|
[2380] | 107 | do |
---|
| 108 | case $option in |
---|
| 109 | (d) fname=$OPTARG;; |
---|
[2506] | 110 | (h) host_configuration=$OPTARG;; |
---|
[2380] | 111 | (m) makefile=$OPTARG;; |
---|
| 112 | (s) suf=$OPTARG;; |
---|
| 113 | (S) source_list="$OPTARG";; |
---|
| 114 | (v) silent=true;; |
---|
[2506] | 115 | (V) use_existing_sources_folder=true;; |
---|
[2380] | 116 | (\?) printf "\n +++ unknown option $OPTARG \n"; |
---|
| 117 | locat=parameter; exit;; |
---|
| 118 | esac |
---|
| 119 | done |
---|
| 120 | |
---|
| 121 | |
---|
[2506] | 122 | # BUILD THE CONFIGURATION-FILE NAME AND THE SOURCES_FOR_RUN-FOLDER NAME |
---|
| 123 | config_file=.palm.config.$host_configuration |
---|
| 124 | sources_for_run_catalog=SOURCES_FOR_RUN_${host_configuration}_$fname |
---|
[2380] | 125 | |
---|
| 126 | |
---|
| 127 | # CHECK, IF CONFIGURATION-FILE EXISTS |
---|
| 128 | if [[ ! -f $config_file ]] |
---|
| 129 | then |
---|
| 130 | printf "\n +++ configuration file: " |
---|
| 131 | printf "\n $config_file" |
---|
| 132 | printf "\n does not exist" |
---|
| 133 | locat=configuration; exit |
---|
| 134 | fi |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | # ### is this really required? |
---|
| 138 | config_file=$PWD/$config_file |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | # READ VARIABLE SETTINGS FROM CONFIG FILE LINE BY LINE |
---|
| 142 | while read line |
---|
| 143 | do |
---|
| 144 | |
---|
| 145 | # FIRST REPLACE ENVIRONMENT-VARIABLES BY THEIR RESPECTIVE VALUES |
---|
| 146 | eval line=\"$line\" |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | # INTERPRET THE LINE |
---|
| 150 | if [[ "$(echo $line)" = "" ]] |
---|
| 151 | then |
---|
| 152 | |
---|
| 153 | # EMPTY LINE, NO ACTION |
---|
| 154 | continue |
---|
| 155 | |
---|
| 156 | elif [[ "$(echo $line | cut -c1)" = "#" ]] |
---|
| 157 | then |
---|
| 158 | |
---|
| 159 | # LINE IS A COMMENT LINE |
---|
| 160 | continue |
---|
| 161 | |
---|
| 162 | elif [[ "$(echo $line | cut -c1)" = "%" ]] |
---|
| 163 | then |
---|
| 164 | |
---|
| 165 | # LINE DEFINES AN ENVIRONMENT-VARIABLE |
---|
| 166 | var=`echo $line | cut -d" " -s -f1 | cut -c2-` |
---|
| 167 | value=`echo $line | cut -d" " -s -f2-` |
---|
| 168 | |
---|
| 169 | # REPLACE ":" BY " " IN COMPILER- CPP- OR LINKER-OPTIONS, |
---|
| 170 | # "::" IS REPLACED BY ":". |
---|
| 171 | #value=`echo $value | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | # VALUE FROM THE CONFIGURATION-FILE IS ASSIGNED TO THE |
---|
| 175 | # ENVIRONMENT-VARIABLE, BUT ONLY IF NO VALUE HAS BEEN ALREADY |
---|
| 176 | # ASSIGNED WITHIN THIS SCRIPT (E.G. BY SCRIPT-OPTIONS). |
---|
| 177 | # NON-ASSIGNED VARIABLES HAVE VALUE "" OR 0 (IN CASE OF INTEGER). |
---|
| 178 | # HENCE THE GENERAL RULE IS: SCRIPT-OPTION OVERWRITES THE |
---|
| 179 | # CONFIGURATION-FILE. |
---|
| 180 | if [[ "$(eval echo \$$var)" = "" || "$(eval echo \$$var)" = "0" ]] |
---|
| 181 | then |
---|
| 182 | eval export $var="\$value" |
---|
| 183 | |
---|
| 184 | # TERMINAL OUTPUT OF ENVIRONMENT-VARIABLES, IF TRACEBACK IS SWITCHED on |
---|
| 185 | if [[ $do_trace = true ]] |
---|
| 186 | then |
---|
| 187 | printf "\n*** ENVIRONMENT-VARIABLE $var = $value" |
---|
| 188 | fi |
---|
| 189 | fi |
---|
| 190 | |
---|
| 191 | else |
---|
| 192 | |
---|
| 193 | # SKIP ALL OTHER LINES |
---|
| 194 | continue |
---|
| 195 | |
---|
| 196 | fi |
---|
| 197 | |
---|
| 198 | done < $config_file |
---|
| 199 | |
---|
| 200 | |
---|
[2404] | 201 | # CHECK, IF THE BASE DIRECTORY PATH HAS BEEN GIVEN |
---|
| 202 | if [[ "$base_directory" = "" ]] |
---|
| 203 | then |
---|
| 204 | printf "\n +++ no base directory found in configuration file" |
---|
| 205 | locat=config_file; exit |
---|
| 206 | else |
---|
| 207 | if [[ ! -d $base_directory ]] |
---|
| 208 | then |
---|
| 209 | printf "\n\n +++ base directory \"$base_directory\" " |
---|
| 210 | printf "\n does not exist" |
---|
| 211 | locat=source_path; exit |
---|
| 212 | fi |
---|
| 213 | fi |
---|
| 214 | |
---|
| 215 | |
---|
[2380] | 216 | # CHECK SOURCE-CODE PATH |
---|
| 217 | if [[ "$source_path" = "" ]] |
---|
| 218 | then |
---|
| 219 | printf "\n +++ no source path found in configuration file" |
---|
| 220 | locat=config_file; exit |
---|
| 221 | else |
---|
| 222 | if [[ ! -d $source_path ]] |
---|
| 223 | then |
---|
| 224 | printf "\n\n +++ source path \"$source_path\" " |
---|
| 225 | printf "\n does not exist" |
---|
| 226 | locat=source_path; exit |
---|
| 227 | fi |
---|
| 228 | fi |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | # CHECK MAKEFILE |
---|
| 232 | [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
| 233 | if [[ ! -f $makefile ]] |
---|
| 234 | then |
---|
| 235 | printf "\n +++ makefile: " |
---|
| 236 | printf "\n $makefile" |
---|
| 237 | printf "\n does not exist" |
---|
| 238 | locat=makefile; exit |
---|
| 239 | fi |
---|
| 240 | |
---|
| 241 | |
---|
| 242 | # CHECK COMPILERNAME |
---|
| 243 | if [[ "$compiler_name" = "" ]] |
---|
| 244 | then |
---|
| 245 | printf "\n +++ no compiler name found in configuration file" |
---|
| 246 | locat=config_file; exit |
---|
| 247 | fi |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | # CHECK SERIAL COMPILERNAME |
---|
| 251 | if [[ "$compiler_name_ser" = "" ]] |
---|
| 252 | then |
---|
| 253 | printf "\n +++ no compiler name for serial compilation in configuration file" |
---|
| 254 | locat=config_file; exit |
---|
| 255 | fi |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | # DETERMINE SSH-KEY TO BE USED |
---|
| 259 | if [[ "$ssh_key" != "" ]] |
---|
| 260 | then |
---|
| 261 | ssh_key="-i $HOME/.ssh/`echo $line | cut -d" " -s -f2`" |
---|
| 262 | fi |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | #CHECK CPP-OPTIONS |
---|
| 266 | if [[ "$cpp_options" = "" ]] |
---|
| 267 | then |
---|
| 268 | printf "\n +++ WARNING: no cpp-options found in configuration file" |
---|
| 269 | fi |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | # CHECK SETTINGS IN CASE OF COMPILING ON REMOTE MACHINE |
---|
| 273 | if [[ "$remote_ip" != "" ]] |
---|
| 274 | then |
---|
| 275 | |
---|
| 276 | if [[ "$remote_username" = "" ]] |
---|
| 277 | then |
---|
| 278 | printf "\n +++ no user name given in configuration file" |
---|
| 279 | locat=config_file; exit |
---|
| 280 | fi |
---|
| 281 | |
---|
| 282 | # GET SOURCE AND DEPOSITORY PATH ON THE REMOTE MACHINE WITHOUT EVALUATING |
---|
| 283 | # THE $ |
---|
| 284 | # IF NOT GIVEN, USE THE LOCAL SOURCE AND DEPOSITORY PATH |
---|
| 285 | line=`grep %remote_source_path $config_file` |
---|
| 286 | if [[ "$line" != "" ]] |
---|
| 287 | then |
---|
| 288 | remote_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 289 | else |
---|
| 290 | line=`grep %source_path $config_file` |
---|
| 291 | remote_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 292 | fi |
---|
| 293 | |
---|
[2404] | 294 | line=`grep %base_directory $config_file` |
---|
[2506] | 295 | make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${host_configuration} |
---|
[2380] | 296 | |
---|
| 297 | else |
---|
| 298 | |
---|
[2506] | 299 | make_depository=${base_directory}/MAKE_DEPOSITORY_${host_configuration} |
---|
[2380] | 300 | |
---|
| 301 | fi |
---|
| 302 | |
---|
| 303 | # HEADER-OUTPUT (PART1: MESSAGES CONCERNING THE LOCAL HOST) |
---|
| 304 | if [[ $silent = false ]] |
---|
| 305 | then |
---|
[2566] | 306 | calltime=$(date) |
---|
| 307 | printf "\n" |
---|
| 308 | printf "#------------------------------------------------------------------------# \n" |
---|
| 309 | printf "| %-40s%30s | \n" "$version" "$calltime" |
---|
| 310 | printf "| | \n" |
---|
| 311 | printf "| %-13s%-57s | \n" "called on:" "$(hostname) (IP:$local_ip)" |
---|
| 312 | column2=$(echo $config_file | cut -c1-57 ) |
---|
| 313 | printf "| %-13s%-57s | \n" "config file:" "$column2" |
---|
| 314 | line=$(echo "$config_file" | cut -c58-) |
---|
| 315 | while [[ "$line" != "" ]] |
---|
[2380] | 316 | do |
---|
[2566] | 317 | column1="" |
---|
| 318 | column2=$(echo $line | cut -c1-57 ) |
---|
| 319 | printf "| %-13s%-57s | \n" "$column1" "$column2" |
---|
| 320 | line=$(echo "$line" | cut -c58-) |
---|
[2380] | 321 | done |
---|
[2566] | 322 | column2=$(echo $makefile | cut -c1-57 ) |
---|
| 323 | printf "| %-13s%-57s | \n" "makefile:" "$column2" |
---|
| 324 | line=$(echo "$makefile" | cut -c58-) |
---|
| 325 | while [[ "$line" != "" ]] |
---|
| 326 | do |
---|
| 327 | column1="" |
---|
| 328 | column2=$(echo $line | cut -c1-57 ) |
---|
| 329 | printf "| %-13s%-57s | \n" "$column1" "$column2" |
---|
| 330 | line=$(echo "$line" | cut -c58-) |
---|
| 331 | done |
---|
| 332 | column2=$(echo $source_path | cut -c1-57 ) |
---|
| 333 | printf "| %-13s%-57s | \n" "source path:" "$column2" |
---|
| 334 | line=$(echo "$source_path" | cut -c58-) |
---|
| 335 | while [[ "$line" != "" ]] |
---|
| 336 | do |
---|
| 337 | column1="" |
---|
| 338 | column2=$(echo $line | cut -c1-57 ) |
---|
| 339 | printf "| %-13s%-57s | \n" "$column1" "$column2" |
---|
| 340 | line=$(echo "$line" | cut -c58-) |
---|
| 341 | done |
---|
| 342 | printf "| | \n" |
---|
| 343 | |
---|
[2380] | 344 | if [[ "$remote_ip" != "" ]] |
---|
| 345 | then |
---|
[2506] | 346 | column2="$host_configuration" |
---|
[2566] | 347 | printf "| %-20s%-50s | \n" "host configuration:" "$column2" |
---|
[2404] | 348 | column2=$(echo "$make_depository" | cut -c1-50 ) |
---|
[2380] | 349 | printf "| %-20s%-50s | \n" "remote depository:" "$column2" |
---|
| 350 | else |
---|
[2506] | 351 | column2="$host_configuration" |
---|
[2420] | 352 | printf "| %-20s%-50s | \n" "host identifier:" "$column2" |
---|
[2404] | 353 | column2=$(echo "$make_depository" | cut -c1-50 ) |
---|
[2380] | 354 | printf "| %-20s%-50s | \n" "local depository:" "$column2" |
---|
| 355 | fi |
---|
[2404] | 356 | line=$(echo "$make_depository" | cut -c51-) |
---|
| 357 | while [[ "$line" != "" ]] |
---|
| 358 | do |
---|
| 359 | column1="" |
---|
| 360 | column2=$(echo "$line" | cut -c1-50 ) |
---|
| 361 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
| 362 | line=$(echo "$line" | cut -c51-) |
---|
| 363 | done |
---|
[2566] | 364 | |
---|
[2380] | 365 | if [[ "$remote_ip" != "" ]] |
---|
| 366 | then |
---|
| 367 | printf "| %-20s%-50s | \n" "remote username:" "$remote_username" |
---|
| 368 | printf "| %-20s%-50s | \n" "remote address:" "$remote_ip" |
---|
| 369 | else |
---|
| 370 | printf "| %-20s%-50s | \n" "username:" "$local_username" |
---|
| 371 | printf "| %-20s%-50s | \n" "address:" "$local_ip" |
---|
| 372 | fi |
---|
[2566] | 373 | |
---|
[2380] | 374 | printf "| %-20s%-50s | \n" "compiler:" "$compiler_name" |
---|
| 375 | printf "| %-20s%-50s | \n" "serial compiler:" "$compiler_name_ser" |
---|
[2566] | 376 | |
---|
[2380] | 377 | if [[ "$make_options" != "" ]] |
---|
| 378 | then |
---|
| 379 | printf "| %-20s%-50s | \n" "make options:" "$make_options" |
---|
| 380 | fi |
---|
| 381 | column2=$(echo "$cpp_options" | cut -c1-50 ) |
---|
| 382 | printf "| %-20s%-50s | \n" "cpp options:" "$column2" |
---|
| 383 | line=$(echo "$cpp_options" | cut -c51-) |
---|
| 384 | while [[ "$line" != "" ]] |
---|
| 385 | do |
---|
| 386 | column1="" |
---|
| 387 | column2=$(echo "$line" | cut -c1-50 ) |
---|
| 388 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
| 389 | line=$(echo "$line" | cut -c51-) |
---|
| 390 | done |
---|
| 391 | column2=$(echo "$compiler_options" | cut -c1-50 ) |
---|
| 392 | printf "| %-20s%-50s | \n" "compiler options:" "$column2" |
---|
| 393 | line=$(echo "$compiler_options" | cut -c51-) |
---|
| 394 | while [[ "$line" != "" ]] |
---|
| 395 | do |
---|
| 396 | column1="" |
---|
| 397 | column2=$(echo "$line" | cut -c1-50 ) |
---|
| 398 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
| 399 | line=$(echo "$line" | cut -c51-) |
---|
| 400 | done |
---|
[2388] | 401 | column2=$(echo "$linker_options" | cut -c1-50 ) |
---|
| 402 | printf "| %-20s%-50s | \n" "linker options:" "$column2" |
---|
| 403 | line=$(echo "$linker_options" | cut -c51-) |
---|
[2380] | 404 | while [[ "$line" != "" ]] |
---|
| 405 | do |
---|
| 406 | column1="" |
---|
| 407 | column2=$(echo "$line" | cut -c1-50 ) |
---|
| 408 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
| 409 | line=$(echo "$line" | cut -c51-) |
---|
| 410 | done |
---|
| 411 | if [[ "$login_init_cmd" != "" ]] |
---|
| 412 | then |
---|
| 413 | column2=$(echo "$login_init_cmd" | cut -c1-50 ) |
---|
| 414 | printf "| %-20s%-50s | \n" "login init command:" "$column2" |
---|
| 415 | line=$(echo "$login_init_cmd" | cut -c51-) |
---|
| 416 | while [[ "$line" != "" ]] |
---|
| 417 | do |
---|
| 418 | column1="" |
---|
| 419 | column2=$(echo "$line" | cut -c1-50 ) |
---|
| 420 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
| 421 | line=$(echo "$line" | cut -c51-) |
---|
| 422 | done |
---|
| 423 | fi |
---|
| 424 | if [[ "$module_commands" != "" ]] |
---|
| 425 | then |
---|
| 426 | column2=$(echo "$module_commands" | cut -c1-50 ) |
---|
| 427 | printf "| %-20s%-50s | \n" "module command(s):" "$column2" |
---|
| 428 | line=$(echo "$module_commands" | cut -c51-) |
---|
| 429 | while [[ "$line" != "" ]] |
---|
| 430 | do |
---|
| 431 | column1="" |
---|
| 432 | column2=$(echo "$line" | cut -c1-50 ) |
---|
| 433 | printf "| %-20s%-50s | \n" "$column1" "$column2" |
---|
| 434 | line=$(echo "$line" | cut -c51-) |
---|
| 435 | done |
---|
| 436 | fi |
---|
| 437 | printf "#------------------------------------------------------------------------# \n" |
---|
| 438 | |
---|
[2566] | 439 | answer=dummy |
---|
| 440 | printf "\n" |
---|
| 441 | while [[ "$answer" != y && "$answer" != Y && "$answer" != c && "$answer" != C && "$answer" != s && "$answer" != S && "$answer" != a && "$answer" != A ]] |
---|
| 442 | do |
---|
| 443 | printf " >>> continue (y(es)/c(ontinue)/a(bort)) ? " |
---|
| 444 | read answer |
---|
| 445 | done |
---|
| 446 | if [[ $answer = a || $answer = A ]] |
---|
[2380] | 447 | then |
---|
[2566] | 448 | locat=user_abort; exit |
---|
[2380] | 449 | fi |
---|
[2566] | 450 | if [[ $answer = c || $answer = C ]] |
---|
| 451 | then |
---|
| 452 | silent=true |
---|
| 453 | fi |
---|
| 454 | fi |
---|
[2380] | 455 | |
---|
| 456 | |
---|
[2566] | 457 | # TAR THE SOURCES AND MAKEFILES |
---|
| 458 | # UTILITIES ARE TEMPORARILY COPIED TO THE SOURCE DIRECTORY IN ORDER TO TAR |
---|
| 459 | # THEM TOO |
---|
| 460 | if [[ $silent = false ]] |
---|
| 461 | then |
---|
| 462 | printf "\n\n *** tar of makefile and source files in" |
---|
| 463 | printf "\n $source_path\n" |
---|
| 464 | fi |
---|
| 465 | cd $source_path |
---|
| 466 | cp -p ../UTIL/combine_plot_fields.f90 . |
---|
| 467 | cp -p ../UTIL/compare_palm_logs.f90 . |
---|
| 468 | cp -p ../UTIL/Makefile_utilities . |
---|
| 469 | tar -cf ${program_name}_sources.tar Makefile* *.$suf |
---|
| 470 | rm combine_plot_fields.f90 compare_palm_logs.f90 Makefile_utilities |
---|
| 471 | |
---|
| 472 | |
---|
| 473 | # MAKE ON REMOTE HOST |
---|
| 474 | if [[ "$remote_ip" != "" ]] |
---|
| 475 | then |
---|
| 476 | |
---|
| 477 | # NEXT IS THE BRANCH FOR CREATING THE MAKE_DEPOSITORY_... |
---|
| 478 | if [[ "$fname" = "" ]] |
---|
[2380] | 479 | then |
---|
| 480 | |
---|
[2566] | 481 | # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST |
---|
| 482 | # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST |
---|
| 483 | if [[ $silent = false ]] |
---|
[2380] | 484 | then |
---|
[2566] | 485 | echo " " |
---|
[2404] | 486 | echo " *** copying \"${program_name}_sources.tar\" to \"${remote_ip}:${make_depository}/\" " |
---|
| 487 | echo "[[ ! -d ${make_depository} ]] && (echo \" *** ${make_depository} will be created\"; mkdir -p ${make_depository})" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
| 488 | scp $ssh_key ${source_path}/${program_name}_sources.tar ${remote_username}@${remote_ip}:${make_depository}/${program_name}_sources.tar |
---|
[2566] | 489 | else |
---|
| 490 | echo "[[ ! -d ${make_depository} ]] && mkdir -p ${make_depository}" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
| 491 | scp $ssh_key ${source_path}/${program_name}_sources.tar ${remote_username}@${remote_ip}:${make_depository}/${program_name}_sources.tar > /dev/null |
---|
| 492 | fi |
---|
[2380] | 493 | |
---|
| 494 | |
---|
| 495 | |
---|
[2566] | 496 | |
---|
| 497 | # UNTAR PREVIOUS UPDATE ON REMOTE HOST, IF EXISTING |
---|
| 498 | if [[ $silent = false ]] |
---|
| 499 | then |
---|
[2380] | 500 | echo " *** untar previous update on remote host, if existing" |
---|
[2566] | 501 | fi |
---|
| 502 | echo "cd ${make_depository}; [[ -f ${program_name}_current_version.tar ]] && tar -xf ${program_name}_current_version.tar" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
[2380] | 503 | |
---|
| 504 | |
---|
[2566] | 505 | # UNTAR CURRENT SOURCES ON REMOTE HOST |
---|
| 506 | if [[ $silent = false ]] |
---|
| 507 | then |
---|
[2380] | 508 | echo " *** untar current sources on remote host" |
---|
[2566] | 509 | fi |
---|
| 510 | echo "cd ${make_depository}; tar -xf ${program_name}_sources.tar" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
[2380] | 511 | |
---|
| 512 | |
---|
[2566] | 513 | # CREATE INIT AND MODULE COAMMNDS |
---|
| 514 | [[ "$login_init_cmd" != "" ]] && login_init_cmd=${login_init_cmd}";" |
---|
| 515 | [[ "$module_commands" != "" ]] && module_commands=${module_commands}";" |
---|
[2380] | 516 | |
---|
| 517 | |
---|
[2566] | 518 | # FIRST CREATE EXECUTABLES FOR THE UTILITY ROUTINES |
---|
| 519 | if [[ $silent = false ]] |
---|
| 520 | then |
---|
[2380] | 521 | echo " " |
---|
| 522 | echo " *** creating utilities on remote host" |
---|
[2566] | 523 | fi |
---|
| 524 | make_call_string="make -f Makefile_utilities $make_options F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$linker_options\" " |
---|
| 525 | echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol |
---|
[2380] | 526 | |
---|
[2566] | 527 | if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]] |
---|
| 528 | then |
---|
| 529 | printf "\a\n +++ error(s) occurred during compiling or linking of utilities" |
---|
| 530 | printf "\n for host configuration \"$host_configuration\" " |
---|
| 531 | if [[ $silent = false ]] |
---|
[2380] | 532 | then |
---|
[2566] | 533 | answer=dummy |
---|
| 534 | printf "\n" |
---|
| 535 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 536 | do |
---|
| 537 | printf " >>> continue / list errors / kill palmbuild (c/l/k) ? " |
---|
| 538 | read answer |
---|
| 539 | if [[ "$answer" = l ]] |
---|
[2380] | 540 | then |
---|
[2566] | 541 | more ${host_configuration}_last_make_protocol |
---|
[2380] | 542 | fi |
---|
[2566] | 543 | done |
---|
| 544 | if [[ $answer = k ]] |
---|
| 545 | then |
---|
[2487] | 546 | locat=user_abort; exit |
---|
[2380] | 547 | fi |
---|
[2566] | 548 | else |
---|
| 549 | # ABORT ANYWAY |
---|
| 550 | locat=user_abort; exit |
---|
[2380] | 551 | fi |
---|
[2566] | 552 | fi |
---|
[2380] | 553 | |
---|
| 554 | |
---|
[2566] | 555 | # NOW COMPILE THE PALM CODE |
---|
| 556 | # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND |
---|
| 557 | # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE |
---|
| 558 | # MAY E.G. MISS THE COMPILER-PATHS) |
---|
| 559 | if [[ $silent = false ]] |
---|
| 560 | then |
---|
[2380] | 561 | echo " " |
---|
| 562 | echo " *** compile PALM sources on remote host" |
---|
[2566] | 563 | fi |
---|
| 564 | make_call_string="make $make_options PROG=$program_name F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$linker_options\" " |
---|
| 565 | echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol |
---|
[2380] | 566 | |
---|
[2566] | 567 | if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]] |
---|
| 568 | then |
---|
| 569 | printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " |
---|
| 570 | if [[ $silent = false ]] |
---|
[2380] | 571 | then |
---|
[2566] | 572 | answer=dummy |
---|
| 573 | printf "\n" |
---|
| 574 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 575 | do |
---|
| 576 | printf " >>> continue / list errors / kill palmbuild (c/l/k) ? " |
---|
| 577 | read answer |
---|
| 578 | if [[ "$answer" = l ]] |
---|
[2380] | 579 | then |
---|
[2566] | 580 | more ${host_configuration}_last_make_protocol |
---|
[2380] | 581 | fi |
---|
[2566] | 582 | done |
---|
| 583 | if [[ $answer = k ]] |
---|
| 584 | then |
---|
[2487] | 585 | locat=user_abort; exit |
---|
[2380] | 586 | fi |
---|
[2566] | 587 | else |
---|
| 588 | # ABORT ANYWAY |
---|
| 589 | locat=user_abort; exit |
---|
[2380] | 590 | fi |
---|
[2566] | 591 | fi |
---|
[2380] | 592 | |
---|
[2566] | 593 | # TAR UPDATED VERSION ON THE REMOTE HOST |
---|
| 594 | if [[ $silent = false ]] |
---|
| 595 | then |
---|
[2380] | 596 | printf "\n *** tar update on remote host ..." |
---|
[2566] | 597 | fi |
---|
| 598 | echo "cd ${make_depository}; chmod u+w *; tar -cf ${program_name}_current_version.tar ${program_name} *.f90 *.o *.mod *.x" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
[2380] | 599 | |
---|
| 600 | |
---|
[2566] | 601 | # NOW COMES THE BRANCH FOR CREATING THE EXECUTABLE FOR THE CURRENT RUN |
---|
| 602 | # INCLUDING E.G. USER-INTERFACE ROUTINES. ALSO ADD OTHER UTILITY EXECUTABLES. EVERYTHING IS |
---|
| 603 | # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_... |
---|
| 604 | elif [[ "$fname" != "" ]] |
---|
| 605 | then |
---|
| 606 | |
---|
| 607 | # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS |
---|
| 608 | # AND ASK, IF THEY SHALL BE USED |
---|
| 609 | echo "[[ -d ${fast_io_catalog}/${sources_for_run_catalog} ]] && echo sources for run found" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 > ${host_configuration}_last_make_protocol |
---|
| 610 | if [[ $(grep -c "sources for run found" ${host_configuration}_last_make_protocol) != 0 && $use_existing_sources_folder = true ]] |
---|
[2380] | 611 | then |
---|
[2566] | 612 | printf "\a\n *** compiled sources for run \"$fname\" found on remote host in folder" |
---|
| 613 | printf "\n ${fast_io_catalog}/${sources_for_run_catalog}" |
---|
| 614 | printf "\n will be used!" |
---|
| 615 | exit |
---|
| 616 | fi |
---|
[2380] | 617 | |
---|
[2566] | 618 | # COPY MAKE DEPOSITORY ON REMOTE MACHINE TO SOURCES_FOR_RUN_... |
---|
| 619 | if [[ $silent = false ]] |
---|
| 620 | then |
---|
[2506] | 621 | printf "\n *** copy MAKE_DEPOSITORY_${host_configuration} on remote host to $sources_for_run_catalog \n" |
---|
[2566] | 622 | fi |
---|
| 623 | echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}; mkdir -p ${fast_io_catalog}/${sources_for_run_catalog}; cp ${make_depository}/${program_name}_current_version.tar ${fast_io_catalog}/${sources_for_run_catalog}; cd ${fast_io_catalog}/${sources_for_run_catalog}; tar xf ${program_name}_current_version.tar" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
[2380] | 624 | |
---|
| 625 | |
---|
[2566] | 626 | # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... ON THE REMOTE MACHINE |
---|
| 627 | if [[ $silent = false ]] |
---|
| 628 | then |
---|
[2506] | 629 | printf "\n *** copy ${base_directory}/${sources_for_run_catalog}" |
---|
| 630 | printf "\n to $sources_for_run_catalog on remote host \n" |
---|
[2566] | 631 | fi |
---|
| 632 | scp -q $ssh_key ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*} ${remote_username}@${remote_ip}:${fast_io_catalog}/${sources_for_run_catalog} |
---|
[2380] | 633 | |
---|
| 634 | |
---|
[2566] | 635 | # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY |
---|
| 636 | if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]] |
---|
| 637 | then |
---|
| 638 | |
---|
| 639 | make_call_string="make $make_options PROG=$program_name F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$linker_options\" " |
---|
| 640 | [[ "$login_init_cmd" != "" ]] && login_init_cmd=${login_init_cmd}";" |
---|
| 641 | [[ "$module_commands" != "" ]] && module_commands=${module_commands}";" |
---|
| 642 | if [[ $silent = false ]] |
---|
[2380] | 643 | then |
---|
| 644 | echo " *** execute \"make\" on remote host" |
---|
[2566] | 645 | fi |
---|
| 646 | echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/${sources_for_run_catalog}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol |
---|
[2380] | 647 | |
---|
[2566] | 648 | if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]] |
---|
| 649 | then |
---|
| 650 | printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " |
---|
| 651 | if [[ $silent = false ]] |
---|
[2380] | 652 | then |
---|
[2566] | 653 | answer=dummy |
---|
| 654 | printf "\n" |
---|
| 655 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 656 | do |
---|
| 657 | printf " >>> continue / list errors / kill palmbuild (c/l/k) ? " |
---|
| 658 | read answer |
---|
| 659 | if [[ "$answer" = l ]] |
---|
[2380] | 660 | then |
---|
[2566] | 661 | more ${host_configuration}_last_make_protocol |
---|
[2380] | 662 | fi |
---|
[2566] | 663 | done |
---|
| 664 | if [[ $answer = k ]] |
---|
| 665 | then |
---|
[2506] | 666 | echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
[2487] | 667 | locat=user_abort; exit |
---|
[2380] | 668 | fi |
---|
[2566] | 669 | else |
---|
| 670 | # ABORT ANYWAY |
---|
| 671 | echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 |
---|
| 672 | locat=user_abort; exit |
---|
[2380] | 673 | fi |
---|
[2566] | 674 | fi |
---|
[2380] | 675 | |
---|
[2566] | 676 | else |
---|
[2380] | 677 | |
---|
[2566] | 678 | echo " *** nothing to compile for this run" |
---|
[2380] | 679 | |
---|
| 680 | fi |
---|
| 681 | |
---|
[2566] | 682 | fi |
---|
[2380] | 683 | |
---|
[2566] | 684 | rm -rf ${source_path}/${host_configuration}_last_make_protocol |
---|
[2380] | 685 | |
---|
| 686 | |
---|
[2566] | 687 | # MAKE ON LOCAL HOST |
---|
| 688 | else |
---|
[2380] | 689 | |
---|
[2566] | 690 | |
---|
| 691 | # NEXT IS THE BRANCH FOR CREATING THE MAKE_DEPOSITORY_... ON THE |
---|
| 692 | # LOCAL HOST |
---|
| 693 | if [[ "$fname" = "" ]] |
---|
| 694 | then |
---|
| 695 | |
---|
| 696 | # SET THE ENVIRONMENT (EXECUTE INIT AND MODULE COMMANDS) |
---|
| 697 | if [[ "$login_init_cmd" != "" ]] |
---|
[2380] | 698 | then |
---|
[2566] | 699 | $login_init_cmd |
---|
| 700 | fi |
---|
[2380] | 701 | |
---|
[2566] | 702 | if [[ "$module_commands" != "" ]] |
---|
| 703 | then |
---|
| 704 | $module_commands |
---|
| 705 | fi |
---|
[2380] | 706 | |
---|
| 707 | |
---|
[2566] | 708 | # CREATE MAKE-DEPOSITORY, IF IT DOES NOT EXIST |
---|
| 709 | eval make_depository=$make_depository |
---|
| 710 | if [[ ! -d $make_depository ]] |
---|
| 711 | then |
---|
| 712 | if mkdir -p $make_depository |
---|
[2380] | 713 | then |
---|
[2566] | 714 | if [[ $silent = false ]] |
---|
[2380] | 715 | then |
---|
| 716 | printf "\n\n *** directory for local make depository:" |
---|
[2404] | 717 | printf "\n $make_depository" |
---|
[2380] | 718 | printf "\n was created\n" |
---|
| 719 | fi |
---|
[2566] | 720 | else |
---|
| 721 | printf "\n +++ directory for local make depository:" |
---|
| 722 | printf "\n $make_depository" |
---|
| 723 | printf "\n cannot be created" |
---|
| 724 | locat=local_depository; exit |
---|
[2380] | 725 | fi |
---|
[2566] | 726 | fi |
---|
[2380] | 727 | |
---|
[2566] | 728 | # COPY SOURCE-CODE FROM REPOSITORY TO MAKE-DEPOSITORY |
---|
| 729 | if [[ $silent = false ]] |
---|
| 730 | then |
---|
[2380] | 731 | echo " " |
---|
| 732 | echo " *** untar current source sources on local host in" |
---|
[2404] | 733 | echo " $make_depository" |
---|
[2566] | 734 | fi |
---|
| 735 | cd $make_depository |
---|
| 736 | cp $source_path/${program_name}_sources.tar . |
---|
| 737 | tar xf ${program_name}_sources.tar |
---|
[2380] | 738 | |
---|
| 739 | |
---|
[2566] | 740 | # FIRST CREATE EXECUTABLES FOR THE UTILITY ROUTINES |
---|
| 741 | if [[ $silent = false ]] |
---|
| 742 | then |
---|
[2380] | 743 | echo " " |
---|
| 744 | echo " *** creating utilities on local host" |
---|
[2566] | 745 | fi |
---|
| 746 | make -f Makefile_utilities $make_options F90=$compiler_name F90_SER=$compiler_name_ser COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$linker_options" |
---|
[2380] | 747 | |
---|
| 748 | |
---|
[2566] | 749 | # CALL MAKE ON LOCAL HOST USING THE OPTIONS DETERMINED FURTHER ABOVE |
---|
| 750 | if [[ $silent = false ]] |
---|
| 751 | then |
---|
[2380] | 752 | echo " " |
---|
| 753 | echo " *** compile PALM sources on local host" |
---|
[2566] | 754 | fi |
---|
[2380] | 755 | |
---|
[2566] | 756 | make $make_options PROG=$program_name F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$linker_options" 2>&1 | tee ${host_configuration}_last_make_protocol |
---|
[2380] | 757 | |
---|
[2566] | 758 | if [[ $? != 0 ]] |
---|
| 759 | then |
---|
| 760 | printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " |
---|
| 761 | if [[ $silent = false ]] |
---|
[2380] | 762 | then |
---|
[2566] | 763 | answer=dummy |
---|
| 764 | printf "\n" |
---|
| 765 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 766 | do |
---|
| 767 | printf " >>> continue / list errors / kill palmbuild (c/l/k) ? " |
---|
| 768 | read answer |
---|
| 769 | if [[ "$answer" = l ]] |
---|
[2380] | 770 | then |
---|
[2566] | 771 | more ${host_configuration}_last_make_protocol |
---|
[2380] | 772 | fi |
---|
[2566] | 773 | done |
---|
| 774 | if [[ $answer = k ]] |
---|
| 775 | then |
---|
[2487] | 776 | locat=user_abort; exit |
---|
[2380] | 777 | fi |
---|
[2566] | 778 | else |
---|
| 779 | # ABORT ANYWAY |
---|
| 780 | locat=user_abort; exit |
---|
[2380] | 781 | fi |
---|
[2566] | 782 | fi |
---|
[2380] | 783 | |
---|
| 784 | |
---|
[2566] | 785 | # TAR NEW VERSION ON LOCAL HOST |
---|
| 786 | if [[ $silent = false ]] |
---|
| 787 | then |
---|
[2380] | 788 | printf "\n *** tar update on local host ..." |
---|
[2566] | 789 | fi |
---|
| 790 | tar -cf ${program_name}_current_version.tar ${program_name} *.$suf *.o *.mod *.x |
---|
[2380] | 791 | |
---|
[2566] | 792 | else |
---|
[2380] | 793 | |
---|
[2566] | 794 | # NOW COMES THE BRANCH FOR CREATING THE EXECUTABLE FOR THE CURRENT RUN |
---|
| 795 | # INCLUDING E.G. USER-INTERFACE ROUTINES. ALSO ADD OTHER UTILITY EXECUTABLES. EVERYTHING IS |
---|
| 796 | # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_... |
---|
[2380] | 797 | |
---|
[2566] | 798 | # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS |
---|
| 799 | # AND ASK, IF THEY SHALL BE USED |
---|
| 800 | if [[ -d ${fast_io_catalog}/${sources_for_run_catalog} && $use_existing_sources_folder = true ]] |
---|
| 801 | then |
---|
| 802 | printf "\a\n *** compiled sources for run \"$fname\" found on local host in folder" |
---|
| 803 | printf "\n ${fast_io_catalog}/${sources_for_run_catalog}" |
---|
| 804 | printf "\n will be used!" |
---|
| 805 | exit |
---|
| 806 | fi |
---|
[2489] | 807 | |
---|
[2566] | 808 | # SECOND CHECK, IF A DEPOSITORY EXISTS ON THE LOCAL MACHINE |
---|
| 809 | if [[ ! -d ${make_depository} ]] |
---|
| 810 | then |
---|
| 811 | printf "\n +++ directory for local make depository:" |
---|
| 812 | printf "\n $make_depository" |
---|
| 813 | printf "\n not found. Please run \"palmbuild -h $host_configuration\" " |
---|
| 814 | locat=make_depository; exit |
---|
| 815 | fi |
---|
[2380] | 816 | |
---|
| 817 | |
---|
[2566] | 818 | # COPY MAKE DEPOSITORY ON LOCAL MACHINE TO SOURCES_FOR_RUN_... |
---|
| 819 | if [[ $silent = false ]] |
---|
| 820 | then |
---|
[2506] | 821 | printf "\n *** copy MAKE_DEPOSITORY_${host_configuration} on local host to " |
---|
| 822 | printf "\n ${fast_io_catalog}/${sources_for_run_catalog} \n" |
---|
[2566] | 823 | fi |
---|
| 824 | rm -rf ${fast_io_catalog}/${sources_for_run_catalog} |
---|
| 825 | mkdir -p ${fast_io_catalog}/${sources_for_run_catalog} |
---|
| 826 | cp ${make_depository}/${program_name}_current_version.tar ${fast_io_catalog}/${sources_for_run_catalog} |
---|
| 827 | cd $fast_io_catalog/${sources_for_run_catalog} |
---|
| 828 | tar xf ${program_name}_current_version.tar |
---|
[2380] | 829 | |
---|
| 830 | |
---|
[2566] | 831 | # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... |
---|
| 832 | # IN THE FAST_IO_CATALOG ON THE LOCAL MACHINE |
---|
| 833 | if [[ $silent = false ]] |
---|
| 834 | then |
---|
[2506] | 835 | printf "\n *** copy ${base_directory}/${sources_for_run_catalog} to" |
---|
| 836 | printf "\n ${fast_io_catalog}/${sources_for_run_catalog} on local host \n" |
---|
[2566] | 837 | fi |
---|
| 838 | cp ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*} ${fast_io_catalog}/${sources_for_run_catalog} |
---|
[2380] | 839 | |
---|
| 840 | |
---|
[2566] | 841 | # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY |
---|
| 842 | if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]] |
---|
| 843 | then |
---|
| 844 | |
---|
| 845 | if [[ $silent = false ]] |
---|
[2380] | 846 | then |
---|
| 847 | echo " *** execute \"make\" on local host" |
---|
[2566] | 848 | fi |
---|
| 849 | [[ "$login_init_cmd" != "" ]] && $login_init_cmd |
---|
| 850 | [[ "$module_commands" != "" ]] && $module_commands |
---|
[2380] | 851 | |
---|
[2566] | 852 | make $make_options PROG=$program_name F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$linker_options" |
---|
[2380] | 853 | |
---|
[2566] | 854 | if [[ $? != 0 ]] |
---|
| 855 | then |
---|
| 856 | |
---|
| 857 | printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " |
---|
| 858 | if [[ $silent = false ]] |
---|
[2380] | 859 | then |
---|
[2566] | 860 | answer=dummy |
---|
| 861 | printf "\n" |
---|
| 862 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 863 | do |
---|
| 864 | printf " >>> continue / kill palmbuild (c/k) ? " |
---|
| 865 | read answer |
---|
| 866 | done |
---|
| 867 | if [[ $answer = k ]] |
---|
[2380] | 868 | then |
---|
[2506] | 869 | rm -rf ${fast_io_catalog}/${sources_for_run_catalog} |
---|
[2487] | 870 | locat=user_abort; exit |
---|
[2380] | 871 | fi |
---|
[2566] | 872 | else |
---|
| 873 | # ABORT ANYWAY |
---|
| 874 | rm -rf ${fast_io_catalog}/${sources_for_run_catalog} |
---|
| 875 | locat=user_abort; exit |
---|
[2380] | 876 | fi |
---|
[2566] | 877 | fi |
---|
[2380] | 878 | |
---|
[2566] | 879 | else |
---|
[2380] | 880 | |
---|
[2566] | 881 | echo " *** nothing to compile for this run" |
---|
[2380] | 882 | |
---|
[2566] | 883 | fi |
---|
[2380] | 884 | |
---|
| 885 | fi |
---|
[2566] | 886 | fi |
---|