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