Index: dynamico_lmdz/aquaplanet/LMDZ5/makelmdz_fcm
===================================================================
--- dynamico_lmdz/aquaplanet/LMDZ5/makelmdz_fcm	(revision 3832)
+++ dynamico_lmdz/aquaplanet/LMDZ5/makelmdz_fcm	(revision 3965)
@@ -35,4 +35,8 @@
 full=''
 nodyn=false
+
+arch_defined="FALSE"
+arch_path="arch"
+arch_default_path="arch"
 
 LMDGCM=`/bin/pwd`
@@ -180,6 +184,8 @@
 
       "-arch")
-	  arch=$2 ; shift ; shift ;;
-
+	  arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
+
+      "-arch_path")
+	  arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
       *)
 	  code="$1" ; shift ;;
@@ -210,7 +216,42 @@
 rm -rf .void_dir
 mkdir .void_dir
-rm -f arch.path
-ln -s arch/arch-${arch}.path ./arch.path
-source arch.path
+
+if [[ "$arch_defined" == "TRUE" ]]
+then
+  rm -f arch.path
+  rm -f arch.fcm
+  rm -f arch.env
+
+  if test -f $arch_path/arch-${arch}.path
+  then
+    ln -s $arch_path/arch-${arch}.path arch.path
+  elif test -f $arch_default_path/arch-${arch}.path
+  then
+    ln -s $arch_default_path/arch-${arch}.path arch.path
+  fi
+        
+  if test -f $arch_path/arch-${arch}.fcm
+  then
+    ln -s $arch_path/arch-${arch}.fcm arch.fcm
+  elif test -f $arch_default_path/arch-${arch}.fcm
+  then
+    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
+  fi
+
+  if test -f $arch_path/arch-${arch}.env
+  then
+    ln -s $arch_path/arch-${arch}.env arch.env
+  elif test -f $arch_default_path/arch-${arch}.env
+  then
+    ln -s $arch_default_path/arch-${arch}.env arch.env
+  else
+    ln -s .void_file arch.env
+  fi
+  source arch.env
+  source arch.path
+else
+  echo "Veuillez definir une architecture cible"
+  exit 1
+fi
 
 ########################################################################
@@ -261,6 +302,6 @@
 then
    CPP_KEY="$CPP_KEY INCA"
-   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
-   LIB="$LIB -L${INCA_LIBDIR} -lchimie"
+   INCLUDE="$INCLUDE ${INCA_INCDIR}"
+   LIB="$LIB ${INCA_LIBDIR} ${INCA_LIB}"
 fi
 
@@ -272,10 +313,10 @@
 	export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1
 	export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib
-	INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
-	LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io"
+	INCLUDE="$INCLUDE ${OASIS_INCDIR}"
+	LIB="$LIB ${OASIS_LIBDIR} ${OASIS_LIB}"
     else
 	CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
-	INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
-	LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu"
+	INCLUDE="$INCLUDE ${OASIS_INCDIR}"
+	LIB="$LIB ${OASIS_LIBDIR} ${OASIS_LIB}"
     fi
 fi
@@ -310,5 +351,5 @@
 #    For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
 #    option 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
-   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
+   INCLUDE="${INCLUDE} ${ORCHIDEE_INCDIR}"
    CPP_KEY="$CPP_KEY CPP_VEGET"
 # temporary, for Orchidee versions 1.9.* (before openmp activation)
@@ -321,10 +362,5 @@
       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
+   LIB="${LIB} ${ORCHIDEE_LIBDIR} ${ORCHIDEE_LIB}"
 elif [[ "$veget" != "false" ]] ; then
    echo "Option -v $veget does not exist"
@@ -348,18 +384,18 @@
 then
    CPP_KEY="$CPP_KEY CPP_IOIPSL"
-   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
-   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
+   INCLUDE="$INCLUDE ${IOIPSL_INCDIR}"
+   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}"
 elif [[ $io == mix ]]
 then
    # For now, xios implies also using ioipsl
    CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
-   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
-   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios"
+   INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
+   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
 elif [[ $io == xios ]]
 then
    # For now, xios implies also using ioipsl
    CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
-   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
-   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios"
+   INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
+   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
 fi
 
