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