Index: LMDZ5/branches/testing/makelmdz
===================================================================
--- LMDZ5/branches/testing/makelmdz	(revision 2720)
+++ LMDZ5/branches/testing/makelmdz	(revision 2787)
@@ -32,6 +32,11 @@
 full=""
 
+arch_defined="FALSE"
+arch_path="arch"
+arch_default_path="arch"
+
 # guess a default 'arch'
 arch="local" # start with assuming we're on a local machine with local arch file
+arch_defined="TRUE" # and thus also set arch_defined to true 
 ## try to recognise machine and infer arch from it
 machine=`hostname`
@@ -127,4 +132,5 @@
 [-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
 [-ext_src path]            : path to an additional set of routines to compile with the model
+[-arch_path path]          : path to architecture files (default: $arch_default_path)
  -arch nom_arch            : target architecture 
  exec                      : executable to build
@@ -204,5 +210,8 @@
 
       "-arch")
-	  arch=$2 ; shift ; shift ;;
+	  arch=$2 ; arch_defined="TRUE" ; shift ; shift ;;
+
+      "-arch_path")
+	  arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
 
       *)
@@ -218,21 +227,44 @@
 rm -rf .void_dir
 mkdir .void_dir
-rm -f arch.path
-if [[ -r arch/arch-${arch}.path ]]
-then
-  ln -s arch/arch-${arch}.path ./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 architecture PATH and ENV files
+  source arch.env
   source arch.path
 else
-  echo "Error: missing arch/arch-${arch}.path file !"
-  exit
-fi
-rm -f arch.fcm
-if [[ -r arch/arch-${arch}.fcm ]]
-then
-  ln -s arch/arch-${arch}.fcm arch.fcm
-else
-  echo "Error: missing arch/arch-${arch}.fcm file !"
-  exit
-fi
+  echo "You must define a target architecture"
+  exit 1
+fi
+
 ########################################################################
 # Definition des clefs CPP, des chemins des includes et modules
