Index: XIOS/dev/XIOS_DEV_CMIP6/bld.cfg
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/bld.cfg	(revision 1496)
+++ XIOS/dev/XIOS_DEV_CMIP6/bld.cfg	(revision 1497)
@@ -8,6 +8,6 @@
 # ------------------------------------------------------------------------------
 
-inc arch.fcm
-inc config.fcm
+# Specifying the build directory
+inc bld_dir.cfg
 
 %CFLAGS           %BASE_CFLAGS %COMPIL_CFLAGS
@@ -15,14 +15,29 @@
 %LD_FLAGS         %ARCH_LD %BASE_LD
 
-
-dest::root   $PWD
-
 bld::infile_ext::cpp   C::SOURCE
 bld::infile_ext::conf  CPP::INCLUDE
 bld::infile_ext::hpp   CPP::INCLUDE
 
+# IMPORTANT: as the build directory may not necessarily coincide with the source directory, 
+# each source subfolder should be declared individually
+search_src           false
+src::xios                               $PWD/src
+src::xios::config                       $PWD/src/config
+src::xios::date                         $PWD/src/date
+src::xios::filter                       $PWD/src/filter
+src::xios::functor                      $PWD/src/functor
+src::xios::interface::c                 $PWD/src/interface/c
+src::xios::interface::c_attr            $PWD/src/interface/c_attr
+src::xios::interface::fortran           $PWD/src/interface/fortran
+src::xios::interface::fortran_attr      $PWD/src/interface/fortran_attr
+src::xios::io                           $PWD/src/io
+src::xios::node                         $PWD/src/node
+src::xios::parse_expr                   $PWD/src/parse_expr
+src::xios::test                         $PWD/src/test
+src::xios::transformation               $PWD/src/transformation
+src::xios::transformation::Functions    $PWD/src/transformation/Functions
+src::xios::type                         $PWD/src/type
 
-search_src           true
-src::zzz .
+
 #src::date $PWD/extern/boost/src/date_time
 src::blitz $PWD/extern/blitz/src
@@ -60,6 +75,6 @@
 # Pre-process code before analysing dependencies
 bld::pp    false          
-bld::pp::interface/fortran              true
-bld::pp::interface/fortran_attr         true
+bld::pp::xios::interface::fortran              true
+bld::pp::xios::interface::fortran_attr         true
 bld::excl_dep        use::mod_prism_get_comm
 bld::excl_dep        use::mod_prism_get_localcomm_proto
Index: XIOS/dev/XIOS_DEV_CMIP6/make_xios
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/make_xios	(revision 1496)
+++ XIOS/dev/XIOS_DEV_CMIP6/make_xios	(revision 1497)
@@ -5,4 +5,7 @@
 use_oasis="false"
 oasis="oasis3_mct"
+build_path="./"
+build_dir="./"
+build_suffixed="false"
 use_extern_boost="false"
 use_extern_blitz="false"
@@ -11,6 +14,6 @@
 netcdf_lib="netcdf4_par"
 compil_mode="prod"
-arch_path="arch"
-arch_default_path="arch"
+arch_path=$PWD/"arch"
+arch_default_path=$PWD/"arch"
 arch_defined="FALSE"
 arch_path_defined="FALSE"
@@ -30,5 +33,8 @@
 	    echo "       [--avail] : to know available target architectures "
 	    echo "       [--full] : to generate dependencies and recompile from scratch"
-	    echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler"i
+	    echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler"
+        echo "       [--build_path : absolute or relative path to the build directory"
+        echo "       [--build_dir : name of the build directory"
+        echo "       [--build_suffixed : generate automatically suffixed name of the build directory (e.g. config_X64_CURIE_prod)"
         echo "       [--use_extern_boost : to use external boost library"
         echo "       [--use_extern_blitz : to use external blitz library"
@@ -48,4 +54,7 @@
          "--full")  compil_full="true"  ; shift ;;
          "--use_oasis")  use_oasis="true" oasis=$2 ; shift ; shift  ;;
+         "--build_path")  build_path=$2     ; shift ; shift ;;
+         "--build_dir")  build_dir=$2     ; shift ; shift ;;
+         "--build_suffixed")  build_suffixed="true" ; shift  ;;
          "--use_extern_boost")  use_extern_boost="true" ; shift  ;;
          "--use_extern_blitz")  use_extern_blitz="true" ; shift  ;;
@@ -73,4 +82,17 @@
 fi
 
+# Definition of the root directory of the build 
+if [[ "$build_suffixed" == "true" ]]; then
+    install_dir=$PWD/${build_path}/config_${arch}_${compil_mode}
+else
+    install_dir=$PWD/${build_path}/${build_dir}
+fi
+mkdir -p $install_dir
+
+rm -f ${PWD}/bld_dir.cfg
+echo "inc    ${install_dir}/arch.fcm" >> ${PWD}/bld_dir.cfg 
+echo "inc    ${install_dir}/config.fcm" >> ${PWD}/bld_dir.cfg
+echo "dir::root  ${install_dir}"   >> ${PWD}/bld_dir.cfg
+
 # VÃ©rification de la prÃ©sence d'un identifiant d'architecture.
 
@@ -87,35 +109,35 @@
 if [[ "$arch_defined" == "TRUE" ]]
 then
-  rm -f arch.path
-  rm -f arch.fcm
-  rm -f arch.env
+  rm -f ${install_dir}/arch.path
+  rm -f ${install_dir}/arch.fcm
+  rm -f ${install_dir}/arch.env
 
   if test -f $arch_path/arch-${arch}.path
   then
-    ln -s $arch_path/arch-${arch}.path arch.path
+    ln -s $arch_path/arch-${arch}.path ${install_dir}/arch.path
   elif test -f $arch_default_path/arch-${arch}.path
   then
-    ln -s $arch_default_path/arch-${arch}.path arch.path
+    ln -s $arch_default_path/arch-${arch}.path ${install_dir}/arch.path
   fi
         
   if test -f $arch_path/arch-${arch}.fcm
   then
-    ln -s $arch_path/arch-${arch}.fcm arch.fcm
+    ln -s $arch_path/arch-${arch}.fcm ${install_dir}/arch.fcm
   elif test -f $arch_default_path/arch-${arch}.fcm
   then
-    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
+    ln -s $arch_default_path/arch-${arch}.fcm ${install_dir}/arch.fcm
   fi
 
   if test -f $arch_path/arch-${arch}.env
   then
-    ln -s $arch_path/arch-${arch}.env arch.env
+    ln -s $arch_path/arch-${arch}.env ${install_dir}/arch.env
   elif test -f $arch_default_path/arch-${arch}.env
   then
-    ln -s $arch_default_path/arch-${arch}.env arch.env
+    ln -s $arch_default_path/arch-${arch}.env ${install_dir}/arch.env
   else
-    ln -s .void_file arch.env
+    ln -s .void_file ${install_dir}/arch.env
   fi
-  source arch.env
-  source arch.path
+  source ${install_dir}/arch.env
+  source ${install_dir}/arch.path
 else
       echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!"
@@ -225,12 +247,12 @@
 XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
 
-rm -f config.fcm
-echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
-echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
-echo "%CPP_KEY       $XIOS_CPPKEY"   >> config.fcm
-
-echo "%CBASE_INC     $XIOS_CINCDIR" >> config.fcm     
-echo "%FBASE_INC     $XIOS_FINCDIR" >> config.fcm
-echo "%ARCH_LD       $XIOS_LIB"     >> config.fcm 
+rm -f ${install_dir}/config.fcm
+echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> ${install_dir}/config.fcm
+echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> ${install_dir}/config.fcm
+echo "%CPP_KEY       $XIOS_CPPKEY"   >> ${install_dir}/config.fcm
+
+echo "%CBASE_INC     $XIOS_CINCDIR" >> ${install_dir}/config.fcm     
+echo "%FBASE_INC     $XIOS_FINCDIR" >> ${install_dir}/config.fcm
+echo "%ARCH_LD       $XIOS_LIB"     >> ${install_dir}/config.fcm 
 
 echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
