Index: /LMDZ5/trunk/makelmdz
===================================================================
--- /LMDZ5/trunk/makelmdz	(revision 2249)
+++ /LMDZ5/trunk/makelmdz	(revision 2250)
@@ -284,4 +284,13 @@
 for inc in $archfileline ; do INCLUDE="$INCLUDE `echo $inc | grep '\-I'`" ; done
 
+phys_root=$physique
+if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
+if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
+if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
+if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
+if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
+if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi
+if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
+
 if [[ "$physique" != "nophys" ]]
 then
@@ -291,8 +300,8 @@
    lib_phy='-lphy'"$physique"
    CPP_KEY="$CPP_KEY CPP_PHYS"
-   if [[ "${physique:0:3}" == "lmd" ]]
-   then
-   #For lmd physics, default planet type is Earth
-   CPP_KEY="$CPP_KEY CPP_EARTH"
+   if [[ $phys_root == "lmd" ]]
+      then
+      #For lmd physics, default planet type is Earth
+      CPP_KEY="$CPP_KEY CPP_EARTH"
    fi
 fi
@@ -501,9 +510,9 @@
    src_dirs="$src_dirs $filtre dyn3d_common dyn3d${FLAG_PARA}"
    if [[ $physique != "nophys" ]] ; then
-     src_dirs="$src_dirs dynlonlat_phylonlat dynlonlat_phylonlat/phy${physique}"
+     src_dirs="$src_dirs dynlonlat_phylonlat dynlonlat_phylonlat/phy${phys_root}"
      libdyn_phy="-ldynlonlat_phylonlat"
      LIBDYN_PHYS='$(LIBO)/libdynlonlat_phylonlat.a'
      INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat'
-     INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat_'"${physique}"
+     INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat/'"phy${phys_root}"
    fi
    cd $LIBFGCM/grid
@@ -561,7 +570,4 @@
 cd $LMDGCM
 
-find libf -name '*.[Fh]' -print | sort > tmp77
-#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print > tmp90
-find libf -name '*.F90' -print | sort > tmp90
 
 if [[ -r .makelmdz ]]
@@ -579,18 +585,34 @@
 fi
 
-if [[ $configuration_change == "true" || ! ( -r makefile ) || ! ( -r liste_des_sources_f90 ) || ! ( -r liste_des_sources_f77 ) || ` diff tmp77 liste_des_sources_f77 | wc -w ` -ne 0 || ` diff tmp90 liste_des_sources_f90 | wc -w ` -ne 0 ]]
+mkdir -p make_dir
+suf_make=`echo $src_dirs | sed -e 's/\//_/g' -e 's/ /_/g'`
+echo suf_make $suf_make
+
+\rm tmp77 tmp90
+for dir in $src_dirs ; do
+find libf/$dir -name '*.[Fh]' -print | sort >> tmp77
+find libf/$dir -name '*.F90' -print | sort >> tmp90
+done
+
+liste77=make_dir/liste_des_sources_f77_$suf_make
+liste90=make_dir/liste_des_sources_f90_$suf_make
+makefile=make_dir/makefile_$suf_make
+
+if [[ $configuration_change == "true" || ! ( -r $makefile ) || ! ( -r $liste_90 ) || ! ( -r $liste_77 ) || ` diff tmp77 $liste_77 | wc -w ` -ne 0 || ` diff tmp90 $liste_90 | wc -w ` -ne 0 ]]
 then
   echo "les fichiers suivants ont ete crees ou detruits"
   echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
-  diff liste_des_sources_f77 tmp77
-  diff liste_des_sources_f90 tmp90
-  \cp -f tmp77 liste_des_sources_f77
-  \cp -f tmp90 liste_des_sources_f90
+  diff $liste77 tmp77
+  diff $liste90 tmp90
+  \cp -f tmp77 $liste77
+  \cp -f tmp90 $liste90
   echo "Recreating the makefile"
   echo "src_dirs: $src_dirs"
   ./create_make_gcm $src_dirs > tmp 
-  \mv -f tmp makefile
+  \mv -f tmp $makefile
   echo "New makefile created"
 fi
+
+ln -sf $makefile makefile
 
 #Create a .makelmdz file containing main compilation option for later comparisons
@@ -609,6 +631,6 @@
   dirmain=phy$physique
   source_code=${code}.F90
-elif [[ -r $LMDGCM/libf/dynlonlat_phylonlat/phy$physique/${code}.F90 ]] ; then
-  dirmain="dynlonlat_phylonlat/phy${physique}"
+elif [[ -r $LMDGCM/libf/dynlonlat_phylonlat/phy$phys_root/${code}.F90 ]] ; then
+  dirmain="dynlonlat_phylonlat/phy${phys_root}"
   source_code=${code}.F90
 elif [[ -r $LMDGCM/libf/phy$physique/dyn1d/${code}.F90 ]] ; then
Index: /LMDZ5/trunk/makelmdz_fcm
===================================================================
--- /LMDZ5/trunk/makelmdz_fcm	(revision 2249)
+++ /LMDZ5/trunk/makelmdz_fcm	(revision 2250)
@@ -226,9 +226,18 @@
 fi
 
+phys_root=$physique
+if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
+if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
+if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
+if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
+if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
+if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi
+if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
+
 if [[ "$physique" != "nophys" ]]
 then
    #We'll use some physics
    CPP_KEY="$CPP_KEY CPP_PHYS"
-   if [[ "${physique:0:3}" == "lmd" ]]
+   if [[ "${phys_root}" == "lmd" ]]
    then
    #For lmd physics, default planet type is Earth
@@ -237,5 +246,5 @@
    # set the dyn/phys interface path
    DYN_PHYS_PATH="${LIBFGCM}/dynlonlat_phylonlat"
-   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynlonlat_phylonlat/phy${physique}"
+   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynlonlat_phylonlat/phy${phys_root}"
 fi
 
