Index: palm/trunk/SCRIPTS/mbuild
===================================================================
--- palm/trunk/SCRIPTS/mbuild	(revision 818)
+++ palm/trunk/SCRIPTS/mbuild	(revision 892)
@@ -130,5 +130,7 @@
      # 08/03/12 - BjornM- bugfix: cpp directive for namelist check program
      #                    corrected
-
+     # 02/05/12 - Bjoern  - lcxt4 is now lcxe6, adjustments for lcxe6, 
+     #                      bugfixes for the parameter file check, initial 
+     #                      commands on ssh calls sourced out to .mrun.config
 
 
@@ -511,5 +513,5 @@
         (lck)            remote_addres=165.132.26.61;;
         (lctit)          remote_addres=10.1.6.170;;
-        (lcxt4)          remote_addres=129.177.20.113;;
+        (lcxe6)          remote_addres=129.177.20.113;;
         (lcxt5m)         remote_addres=193.166.211.144;;
         (decalpha)       remote_addres=165.132.26.56;;
@@ -842,4 +844,23 @@
 
 
+       # get login init commands, "::" is replacing a space
+    line=""
+    grep  "$remote_host_string" $config_file | grep "%login_init_cmd"  >  $tmp_mbuild
+    while read line1
+    do
+
+       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
+       then
+          line="$line1"
+       fi
+
+       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
+       then
+             # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
+          init_cmds=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
+       fi
+       init_cmds="${init_cmds};"
+    done < $tmp_mbuild
+
 
        # get modules to be loaded
@@ -861,6 +882,4 @@
 
     done < $tmp_mbuild
-
-
 
 
@@ -1011,5 +1030,4 @@
     if [[ $remote_host != $local_host ]]
     then
-
        if [[ $compile_utility_programs = false ]]
        then
@@ -1103,16 +1121,15 @@
           then
 
-             ssh  ${remote_username}@${remote_addres}  "$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
+             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
 
           elif [[ $remote_host = ibmh ]]
           then
 
-             print "$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
+             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
 
           elif [[ $remote_host = lcsgib  ||  $remote_host = lcsgih ]]
           then
-
 #             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
-             print "eval \`/sw/swdist/bin/modulesinit\`; $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
+             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
 
           elif [[ $remote_host = lctit ]]
@@ -1125,12 +1142,12 @@
              done
 
-          elif [[ $remote_host = lcxt4 ]]
-          then
-
-             ssh  ${remote_username}@${remote_addres} ". /opt/modules/default/init/ksh; $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
-
-          else
-
-             print "cd $module_calls ${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
+          elif [[ $remote_host = lcxe6 ]]
+          then
+
+             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
+
+          else
+
+             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
 
           fi
@@ -1265,13 +1282,14 @@
           fi
 
+
           if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
           then
 
-             ssh  ${remote_username}@${remote_addres}  "$module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR"
+             ssh  ${remote_username}@${remote_addres}  "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR"
 
           elif [[ $remote_host = ibmh ]]
           then
 
-             print "$module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres}
+             print "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres}
 
           elif [[ $remote_host = lctit ]]
@@ -1281,15 +1299,15 @@
              while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
              do
-                print "$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
+                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
              done
 
-          elif [[ $remote_host = lcxt4 ]]
-          then
-
-             ssh  ${remote_username}@${remote_addres} ". /opt/modules/default/init/ksh; $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll
-
-          else
-
-             print "$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
+          elif [[ $remote_host = lcxe6 ]]
+          then
+
+             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
+
+          else
+
+             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
 
           fi
@@ -1302,8 +1320,8 @@
     else
 
-          # workaround for lcxt4
-       if [[ $remote_host = lcxt4 ]]
-       then
-          . /opt/modules/default/init/ksh
+          # workaround for lcxe6
+       if [[ $remote_host = lcxe6 ]]
+       then
+          $init_cmds
        fi
 
@@ -1415,4 +1433,27 @@
              echo "  *** compiling check_namelist_files ..."
 
+             # GET CHECK OPTIONS
+             line=""
+             found=false
+             grep  "$remote_host_string" $config_file | grep "%cpp_options"  >  $tmp_mbuild
+             while read line1
+             do
+
+                if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
+                then
+                   line="$line1"
+                fi
+
+                if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
+                then
+                   # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING UND ALLE -D ENTFERNEN
+                   line="$line "
+                   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'`
+                   found=true
+                fi
+
+             done < $tmp_mbuild
+             copts_check="$copts_check -D__check -D__parallel"
+
              check_depository_path=${local_source_path}/../UTIL
              cd $check_depository_path
@@ -1423,7 +1464,5 @@
              rm -rf ${mainprog}_sources_check.tar
 
-             copts_check="-cpp -D__parallel -D__check"
-             make  -f Makefile_check $make_options F90=$compiler_name_ser  COPT="$copts_check"
-
+             make  -f Makefile_check $make_options  F90=$compiler_name_ser  COPT="$copts_check"
              tar -cf  check_namelist_files.tar Makefile_check check_namelist_files.x *.f90 *.o *.mod
              mv check_namelist_files.tar $check_depository_path
