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