Index: palm/trunk/SCRIPTS/palmbuild
===================================================================
--- palm/trunk/SCRIPTS/palmbuild	(revision 2488)
+++ palm/trunk/SCRIPTS/palmbuild	(revision 2489)
@@ -27,4 +27,7 @@
 # -----------------
 # $Id$
+# ask for compilation, if SOURCES_FOR_RUN_... exists
+# 
+# 2487 2017-09-21 11:30:10Z raasch
 # bugfix: abort in case of compiling/linking errors in silent mode
 # 
@@ -70,9 +73,12 @@
           printf "\n\n *** palmbuild finished \n\n"
           exit 0
-       fi' exit
+       fi
+       rm -rf ${source_path}/${host_identifier}_last_make_protocol
+      ' exit
 
 
     # IN CASE OF TERMINAL-BREAK:
  trap 'printf "\n\n +++ palmbuild killed by \"^C\" \n\n"
+       rm -rf ${source_path}/${host_identifier}_last_make_protocol
        exit
       ' 2
@@ -509,7 +515,7 @@
           echo "  *** creating utilities on remote host"
           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\" "
-          echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protokoll
-
-          if [[ $(grep -c MAKE_ERROR ${host_identifier}_last_make_protokoll) != 0 ]]
+          echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protocol
+
+          if [[ $(grep -c MAKE_ERROR ${host_identifier}_last_make_protocol) != 0 ]]
           then
              printf "\a\n  +++ error(s) occurred during compiling or linking of utilities"
@@ -525,5 +531,5 @@
                    if [[ "$answer" = l ]]
                    then
-                      more ${host_identifier}_last_make_protokoll
+                      more ${host_identifier}_last_make_protocol
                    fi
                 done
@@ -546,7 +552,7 @@
           echo "  *** compile PALM sources on remote host"
           make_call_string="make  $make_options  PROG=$program_name  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
-          echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protokoll
-
-          if [[ $(grep -c MAKE_ERROR ${host_identifier}_last_make_protokoll) != 0 ]]
+          echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protocol
+
+          if [[ $(grep -c MAKE_ERROR ${host_identifier}_last_make_protocol) != 0 ]]
           then
              printf "\a\n  +++ error(s) occurred during compiling or linking for host \"$host_identifier\" "
@@ -561,5 +567,5 @@
                    if [[ "$answer" = l ]]
                    then
-                      more ${host_identifier}_last_make_protokoll
+                      more ${host_identifier}_last_make_protocol
                    fi
                 done
@@ -585,7 +591,23 @@
        then
 
-             # FIRST CHECK, IF A DEPOSITORY EXISTS ON THE REMOTE MACHINE
-          echo  "[[ ! -d ${make_depository} ]]  &&  echo depository not found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protokoll
-
+             # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS
+             # AND ASK, IF THEY SHALL BE USED
+          echo  "[[ -d $fast_io_catalog/SOURCES_FOR_RUN_$fname ]]  &&  echo sources for run found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1  >  ${host_identifier}_last_make_protocol
+          if [[ $(grep -c "sources for run found" ${host_identifier}_last_make_protocol) != 0 ]]
+          then
+             printf "\a\n  *** compiled sources for run \"$fname\" found on remote host in folder"
+             printf "\n      $fast_io_catalog/SOURCES_FOR_RUN_$fname"  
+             answer=dummy
+             printf "\n\n"
+             while [[ "$answer" != y  &&  "$answer" != n ]]
+             do
+                printf "  >>> shall they be used (y/n) ? "
+                read  answer
+             done
+             if [[ $answer = y ]]
+             then
+                exit
+             fi
+          fi
 
              # COPY MAKE DEPOSITORY ON REMOTE MACHINE TO SOURCES_FOR_RUN_...
@@ -608,7 +630,7 @@
              [[ "$module_commands" != "" ]]  &&  module_commands=${module_commands}";"
              echo "  *** execute \"make\" on remote host"
-             echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/SOURCES_FOR_RUN_$fname; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protokoll
-
-             if [[ $(grep -c MAKE_ERROR ${host_identifier}_last_make_protokoll) != 0 ]]
+             echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/SOURCES_FOR_RUN_$fname; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protocol
+
+             if [[ $(grep -c MAKE_ERROR ${host_identifier}_last_make_protocol) != 0 ]]
              then
                 printf "\a\n  +++ error(s) occurred during compiling or linking for host \"$host_identifier\" "
@@ -623,5 +645,5 @@
                       if [[ "$answer" = l ]]
                       then
-                         more ${host_identifier}_last_make_protokoll
+                         more ${host_identifier}_last_make_protocol
                       fi
                    done
@@ -644,5 +666,5 @@
        fi
 
-       rm -rf  ${host_identifier}_last_make_protokoll
+       rm -rf  ${host_identifier}_last_make_protocol
 
 
@@ -704,5 +726,5 @@
           echo "  *** compile PALM sources on local host"
 
-          make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"  2>&1 | tee ${host_identifier}_last_make_protokoll
+          make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"  2>&1 | tee ${host_identifier}_last_make_protocol
 
           if [[ $? != 0 ]]
@@ -719,5 +741,5 @@
                    if [[ "$answer" = l ]]
                    then
-                      more ${host_identifier}_last_make_protokoll
+                      more ${host_identifier}_last_make_protocol
                    fi
                 done
@@ -743,5 +765,24 @@
              # COLLECTED IN DIRECTORY SOURCES_FOR_RUN_...
 
-             # FIRST CHECK, IF A DEPOSITORY EXISTS ON THE LOCAL MACHINE
+             # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS
+             # AND ASK, IF THEY SHALL BE USED
+          if [[ -d $fast_io_catalog/SOURCES_FOR_RUN_$fname ]]
+          then
+             printf "\a\n  *** compiled sources for run \"$fname\" found on local host in folder"
+             printf "\n      $fast_io_catalog/SOURCES_FOR_RUN_$fname"  
+             answer=dummy
+             printf "\n\n"
+             while [[ "$answer" != y  &&  "$answer" != n ]]
+             do
+                printf "  >>> shall they be used (y/n) ? "
+                read  answer
+             done
+             if [[ $answer = y ]]
+             then
+                exit
+             fi
+          fi
+
+             # SECOND CHECK, IF A DEPOSITORY EXISTS ON THE LOCAL MACHINE
           if [[ ! -d ${make_depository} ]]
           then
