Index: LMDZ5/branches/testing/makelmdz
===================================================================
--- LMDZ5/branches/testing/makelmdz	(revision 1795)
+++ LMDZ5/branches/testing/makelmdz	(revision 1864)
@@ -306,5 +306,5 @@
   FLAG_PARA=''
 else
-  FLAG_PARA="par"
+  FLAG_PARA="$paramem"
 fi
 
@@ -351,28 +351,27 @@
 fi
 
-if [[ "$veget" == "orchidee2.0" ]]
-then
-# orchidee2.0 : 
-# Compile with ORCHIDEE 2.0 (or more recent)
+
+#==============================================================================
+if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ]
+then
+
+   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    CPP_KEY="$CPP_KEY CPP_VEGET"
-   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
-   LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}orchidee "
-elif [[ "$veget" == "orchidee1.9" ]]
-then
-# orchidee1.9 : 
-# Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
-   CPP_KEY="$CPP_KEY CPP_VEGET ORCHIDEE_NOOPENMP"
-   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
-   LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
-elif [[ "$veget" == "true" ]]
-then
-# true : 
-# Obsolete, for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
-# For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
-   CPP_KEY="$CPP_KEY CPP_VEGET"
-   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
-   LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
-elif [[ "$veget" != "false" ]]
-then
+# temporary, for Orchidee versions 1.9.* (before openmp activation)
+   if [[ "$veget" == "orchidee1.9" ]] ; then
+      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
+   fi
+   if [[ "$veget" == "orchidee2.0" ]] ; then
+      orch_libs="sechiba parameters stomate parallel orglob orchidee"
+   else
+      orch_libs="sechiba parameters stomate parallel orglob"
+   fi
+   LIB="${LIB} -L${ORCH_LIBDIR}"
+   for lib in ${orch_libs} ; do
+      if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then
+         LIB="${LIB} -l${LIBPREFIX}$lib "
+      fi
+   done
+elif [[ "$veget" != "false" ]] ; then
    echo "Option -v $veget does not exist"
    echo "Use ./makelmdz -h for more information"
@@ -380,4 +379,5 @@
 fi
 
+#===============================================================================
 if [[ $io == ioipsl ]]
 then
@@ -453,35 +453,23 @@
 ########################################################################
 
-dimension=`echo $dim | wc -w`
-echo dimension $dimension
-
-if (( $dimension == 3 ))
-then
-  cd $LIBFGCM/grid
-  \rm fxyprim.h
-  cp -p fxy_${grille}.h fxyprim.h
+if (( $dimc == 3 )) ; then
+   cd $LIBFGCM/grid
+   \rm fxyprim.h
+   cp -p fxy_${grille}.h fxyprim.h
+   filtre="FILTRE=$filtre"
+   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d${FLAG_PARA} '
+elif (( $dimc == 2 )) ; then
+   filtre="FILTRE= L_FILTRE= "
+   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn2d'
+elif (( $dimc == 1 )) ; then
+   filtre="L_DYN= DYN= FILTRE= L_FILTRE= DIRMAIN=phy$physique "
+   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d' # Pas tres propre
 else
-  echo "Probleme dans les dimensions de la dynamique !!"
-  echo "Non reactive pour l'instant !!!"
-fi
-
-######################################################################
-# Gestion du filtre qui n'existe qu'en 3d.
-######################################################################
-
-if (( `expr $dimc \> 2` == 1 ))
-then
-   filtre="FILTRE=$filtre"
-else
-   filtre="FILTRE= L_FILTRE= "
-fi
-echo MACRO FILTRE $filtre
-
-echo $dimc
+   echo Dimension dimc=$dimc pas prevu ; exit
+fi
 
 ######################################################################
 # Creation du suffixe de la configuration
 ######################################################################
-
 
 SUFF_NAME=_${dim_full}
@@ -531,4 +519,5 @@
 ########################################################################
 cd $LMDGCM
+
 find libf -name '*.[Fh]' -print > tmp77
 find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print > tmp90
@@ -560,10 +549,6 @@
 
 # library directory name:
-if [[ "$parallel" == "none" ]]
-then 
-  nomlib=${arch}_${physique}_${dim_full}_${grille}_${compil_mod}
-else
-  nomlib=${arch}_${physique}_${dim_full}_${grille}_${compil_mod}_${FLAG_PARA}
-fi
+nomlib=`echo ${arch}_${physique}_${dim_full}_${grille}_${compil_mod}_parall${parallel}_${CPP_KEY}_${FLAG_PARA} | sed -e 's/ //g' -e 's/-//g ' | sed -e 's/CPP_//g'`
+echo $nomlib
 
 if [[ ! -d "${LIBOGCM}/${nomlib}" ]]
@@ -585,5 +570,5 @@
   INCLUDE="$INCLUDE"' -I$(LIBF)/phy'"$physique"
 fi
-INCLUDE="$INCLUDE"' -I$(LIBF)/dyn'${dimc}'d'$FLAG_PARA' -I'${LIBOGCM}/${nomlib}
+INCLUDE="$INCLUDE"' -I'${LIBOGCM}/${nomlib}
 
 # ranlib utility (check it exists or else default to ls)
@@ -645,5 +630,5 @@
 DIM=$dimc \
 FLAG_PARA=$FLAG_PARA \
-L_ADJNT="$adjnt" \
+L_ADJNT=$adjnt \
 L_COSP="$lcosp" \
 L_CHIMIE="$libchimie" \
@@ -660,4 +645,5 @@
 PROG=$code
 
+
 if [[ -r $LIBFGCM/grid/dimensions.h ]]
 then
