Index: palm/trunk/SCRIPTS/mbuild_new
===================================================================
--- palm/trunk/SCRIPTS/mbuild_new	(revision 21)
+++ palm/trunk/SCRIPTS/mbuild_new	(revision 22)
@@ -1,4 +1,4 @@
 #!/bin/ksh
-# mbuild - Programmuebersetzungsscript   Version:  @(#)MBUILD 1.0    10/02/07
+# mbuild - Programmuebersetzungsscript   Version:  @(#)MBUILD 1.0    28/02/07
 
      # Prozedur zur Uebersetzung von Programmteilen mittels make-Mechanismus
@@ -79,8 +79,10 @@
      # 07/02/07 - Siggi - adapted for RIAM (neck)
      # 10/02/07 - Siggi - all hpmuk-related code removed
+     # 28/02/07 - Siggi - compilation of utility programs added (option -u)
 
 
 
     # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
+ compile_utility_programs=false
  config_file=.mrun.config
  host=all
@@ -122,5 +124,5 @@
 
     # SHELLSCRIPT-OPTIONEN EINLESEN
- while  getopts  :c:h:m:rs:  option
+ while  getopts  :c:h:m:rs:u  option
  do
    case  $option  in
@@ -130,4 +132,5 @@
        (r)   remote_mode=batch;;
        (s)   suf=$OPTARG;;
+       (u)   compile_utility_programs=true;;
        (\?)  printf "\n  +++ unknown option $OPTARG \n";
              locat=parameter; exit;;
@@ -754,4 +757,5 @@
     fi
 
+    remote_ud=${remote_source_path}/../UTIL
 
        # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN
@@ -1222,4 +1226,99 @@
 
 
+             # GLEICHE AKTIONEN FUER DIE UTILITY-PROGRAMME DURCHFUEHREN
+             # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
+             # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT
+          if [[ $compile_utility_programs = true ]]
+          then
+
+             echo "  *** copying utility programs to \"${remote_addres}:${remote_ud}/\" "
+             cd  ${local_source_path}/../UTIL
+             echo "      remote_ud=\"$remote_ud\" "
+
+             if [[ $remote_host != lctit ]]
+             then
+                ssh  ${remote_username}@${remote_addres} "[[ ! -d ${remote_ud} ]]  &&  (echo \"  *** ${remote_ud} will be created\"; mkdir -p  ${remote_ud})"
+             else
+                   # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
+                   # MIT SSH, DESHALB AUFRUF PER PIPE
+                print "[[ ! -d ${remote_ud} ]]  &&  (echo \"  *** ${remote_ud} will be created\"; mkdir -p  ${remote_ud})"  |  ssh ${remote_username}@${remote_addres}  2>&1
+             fi
+
+             if [[ $local_host = decalpha ]]
+             then
+                   # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES
+                   # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
+                   # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
+                remote_ud=`echo $remote_ud | sed 's/\$HOME\///'`
+                /bin/scp  Makefile  *.f90  ${remote_username}@${remote_addres}:${remote_ud}
+             else
+                scp  Makefile  *.f90  ${remote_username}@${remote_addres}:${remote_ud}
+             fi
+
+
+
+                # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
+                # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND
+                # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE
+                # Z.B. DIE PFADE ZUM COMPILER)
+             echo "  *** execute \"make\" on remote host"
+
+             if [[ $remote_host = nech ]]
+             then
+                make_call_string="sxmake  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
+             else
+                make_call_string="make  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
+             fi
+
+             if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
+             then
+
+                ssh  ${remote_username}@${remote_addres}  "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll
+
+             elif [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
+             then
+
+                print "export OBJECT_MODE=64; 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 = lctit ]]
+             then
+
+                echo  " "  >  ${remote_host}_last_make_protokoll
+                while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
+                do
+                   print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+                done
+
+             else
+
+                print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+
+             fi
+
+             if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]]
+             then
+                printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
+                if [[ $silent = false ]]
+                then
+                   answer=dummy
+                   printf "\n"
+                   while [[ "$answer" != c  &&  "$answer" != k ]]
+                   do
+                      printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
+                      read  answer
+                      if [[ "$answer" = l ]]
+                      then
+                         more ${remote_host}_last_make_protokoll
+                      fi
+                   done
+                   if [[ $answer = k ]]
+                   then
+                      locat=user_abort; exit
+                   fi
+                fi
+             fi
+          fi    # ENDE UEBERSETZUNG DER UTILITY-PROGRAMME
+
+
              # NUR AUF EINEM HLRN-RECHNER UEBERSETZEN
           [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]  &&  ibm_hb_done=true
@@ -1228,4 +1327,5 @@
 
              # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN
+          echo " "
           echo "  *** execute \"make\" on local host"
 
@@ -1260,4 +1360,16 @@
           tar -cf  ${mainprog}_current_version.tar  *.$suf *.o *.mod
 
+
+             # COMPILE THE UTILITY PROGRAMS
+          if [[ $compile_utility_programs = true ]]
+          then
+             printf "\n\n"
+             echo "  *** compiling the utility programs ..."
+             cd ${local_source_path}/../UTIL
+             make  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"
+             cd  -  > /dev/null
+          fi
+
+
              # NUR EINMAL AUF LCMUK UEBERSETZEN
           [[ $remote_host = lcmuk ]]  &&  lcmuk_done=true
Index: palm/trunk/SCRIPTS/mrun_new
===================================================================
--- palm/trunk/SCRIPTS/mrun_new	(revision 21)
+++ palm/trunk/SCRIPTS/mrun_new	(revision 22)
@@ -109,4 +109,5 @@
      # 14/02/07 - Siggi  - dvrp support for neck added
      # 28/02/07 - Siggi  - empty lines in configuration file are accepted
+     #                     mrun_path replaced by PALM_BIN
 
 
@@ -243,27 +244,28 @@
  trap 'if [[ $locat != localhost ]]
        then
-          if [[ ! -f ${mrun_path}/statistik/mrun_statistik ]]
-          then
-             cat  >  ${mrun_path}/statistik/mrun_statistik  <<  %STATEND%
-MRUN-calls on $localhost
-
-date and time                      user        localhost   remotehost  termination mrun-command
---------------------------------------------------------------------------------------------------------------------
-%STATEND%
-             chmod  666  ${mrun_path}/statistik/mrun_statistik
-          fi
-
-             # EINTRAG IN DIE STATISTIK-DATEI
-          string4=$host
-          string5=$locat
-          if [[ "$job_on_file" = ""  &&  $locat != control_c  &&  $locat != user_abort ]]
-          then
-             if [[ $do_batch = true ]]
-             then
-                printf "$string1$string2$string3$string4$string5$mrun_com \n"  >>  ${mrun_path}/statistik/mrun_statistik
-             else
-                printf "$string1$string2$string3$string4$string5$mc \n"  >>  ${mrun_path}/statistik/mrun_statistik
-             fi
-          fi
+#          if [[ ! -f ${mrun_path}/statistik/mrun_statistik ]]
+#          then
+#             cat  >  ${mrun_path}/statistik/mrun_statistik  <<  %STATEND%
+#MRUN-calls on $localhost
+#
+#date and time                      user        localhost   remotehost  termination mrun-command
+#--------------------------------------------------------------------------------------------------------------------
+#%STATEND%
+#             chmod  666  ${mrun_path}/statistik/mrun_statistik
+#          fi
+#
+#             # EINTRAG IN DIE STATISTIK-DATEI
+#          string4=$host
+#          string5=$locat
+#          if [[ "$job_on_file" = ""  &&  $locat != control_c  &&  $locat != user_abort ]]
+#          then
+#             if [[ $do_batch = true ]]
+#             then
+#                printf "$string1$string2$string3$string4$string5$mrun_com \n"  >>  ${mrun_path}/statistik/mrun_statistik
+#             else
+#                printf "$string1$string2$string3$string4$string5$mc \n"  >>  ${mrun_path}/statistik/mrun_statistik
+#             fi
+#          fi
+          continue
        fi
 
@@ -313,33 +315,28 @@
 
 
+    # CHECK IF THE PATH FOR THE PALM BINARIES (SCRIPTS+UTILITY-PROGRAMS) HAS
+    # BEEN SET
+ if [[ "$PALM_BIN" = "" ]]
+ then
+    printf "\n  +++ environment variable PALM_BIN has not been set"
+    printf "\n      please set it to the directory where the PALM scripts are located"
+    locat=palm_bin; exit
+ fi
+
+
     # EVTL. NAMEN DES LOKALEN RECHNERS MIT UEBERGREIFENDEM NAMEN VERSEHEN
  case  $localhost_realname  in
-     (atmos)                mrun_path=/home/siggi/pub
-                            localhost=lcide;;
-     (bora|breva|elephanta|gallego|gregale|hababai|irifi|levanto|maestro|orkan|ostria|poniente|quanero|scirocco|vorias)  mrun_path=/home/raasch/pub
-                            localhost=lcmuk;;
-     (breg*-en0|berni*-en0) mrun_path=/home/b/niksiraa/pub
-                            localhost=ibmb; archive_system=tivoli;;
-     (cs*)                  mrun_path=/pf/b/b323011/pub
-                            localhost=nech; archive_system=ut;;
-     (gate|n-sx)            mrun_path=/home/DSRC/NC/tatuyama/pub
-                            PATH=$PATH:/usr/bin/nqsII:$mrun_path
-                            localhost=neck;;
-     (ground.yonsei.ac.kr)  mrun_path=/usr/users/raasch/pub
-                            localhost=decalpha;;
-     (gfdl3.yonsei.ac.kr)   mrun_path=/usr2/users/raasch/pub
-                            localhost=decalpha;;
-     (gfdl5)                mrun_path=/usr1/users/raasch/pub
-                            localhost=ibmy;;
-     (gwdk081.gwdg.de|gwdk082.gwdg.de|gwdk083.gwdg.de)  mrun_path=/usr/users/sraasch/pub
-                            localhost=ibm;;
-     (hreg*-en0|hanni*-en0) mrun_path=/home/h/niksiraa/pub
-                            localhost=ibmh; archive_system=tivoli;;
-     (nobel*)               mrun_path=/edun/z051nyg/pub
-                            localhost=ibms;;
-     (sun1|sun2)            mrun_path=/home/nhbksira/pub/
-                            localhost=unics;;
-     (tgg*)                 mrun_path=/home2/usr5/mkanda/pub
-                            localhost=lctit;;
+     (atmos)                localhost=lcide;;
+     (bora|breva|elephanta|gallego|gregale|hababai|irifi|levanto|maestro|orkan|ostria|poniente|quanero|scirocco|vorias)  localhost=lcmuk;;
+     (breg*-en0|berni*-en0) localhost=ibmb; archive_system=tivoli;;
+     (cs*)                  localhost=nech; archive_system=ut;;
+     (gate|n-sx)            PATH=$MRUN_BIN:$PATH:/usr/bin/nqsII; localhost=neck;;
+     (ground.yonsei.ac.kr)  localhost=decalpha;;
+     (gfdl3.yonsei.ac.kr)   localhost=decalpha;;
+     (gfdl5)                localhost=ibmy;;
+     (hreg*-en0|hanni*-en0) localhost=ibmh; archive_system=tivoli;;
+     (nobel*)               localhost=ibms;;
+     (sun1|sun2)            localhost=unics;;
+     (tgg*)                 localhost=lctit;;
      (*)                    printf "\n  +++ Host \"$localhost_realname\" not admitted for mrun \n"
                             locat=localhost; exit;;
@@ -3794,5 +3791,5 @@
        # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN
     echo  "cat > $mrun_script_name <<\"%END%\""  >>  $jobfile
-    cat   ${mrun_path}/$mrun_script_name         >>  $jobfile
+    cat   ${PALM_BIN}/$mrun_script_name          >>  $jobfile
     echo  "%END%"                                >>  $jobfile
     if [[ $host = lctit ]]
@@ -3849,5 +3846,5 @@
 
        # EBENSO LOKALEN MRUN-KATALOG UEBERGEBEN 
-    echo  "LOCAL_MRUN_PATH=$mrun_path"                  >>  $jobfile
+    echo  "LOCAL_MRUN_PATH=$PALM_BIN"                   >>  $jobfile
     echo  "export LOCAL_MRUN_PATH"                      >>  $jobfile
 
Index: palm/trunk/UTIL/Makefile
===================================================================
--- palm/trunk/UTIL/Makefile	(revision 22)
+++ palm/trunk/UTIL/Makefile	(revision 22)
@@ -0,0 +1,45 @@
+#------------------------------------------------------------------------------!
+#
+# Actual revisions:
+# -----------------
+# Initial revision
+# 
+#
+# Former revisions:
+# -----------------
+# $Id $
+#
+# Description:
+# ------------
+# Makefile for generating the utility programs needed by mrun and palm
+#------------------------------------------------------------------------------!
+
+PROG1 =  ../SCRIPTS/combine_plot_fields.x
+PROG2 =  ../SCRIPTS/interpret_config.x
+
+OBJS1 =  combine_plot_fields.o
+OBJS2 =  interpret_config.o
+
+CC = cc
+CFLAGS = -O
+
+F90 =
+COPT =
+F90FLAGS =
+LDFLAGS =
+
+.SUFFIXES: $(SUFFIXES) .f90
+
+
+all: $(PROG1) $(PROG2)
+
+$(PROG1): $(OBJS1)
+	$(F90) -o $(PROG1) $(OBJS1) $(LDFLAGS)
+
+$(PROG2): $(OBJS2)
+	$(F90) -o $(PROG2) $(OBJS2) $(LDFLAGS)
+
+.f90.o:
+	$(F90) $(F90FLAGS) $(COPT) -c $<
+
+
