Index: branches/ORCHIDEE_2_2/ORCHIDEE_OL/compile_orchidee_ol.sh
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE_OL/compile_orchidee_ol.sh	(revision 8393)
+++ branches/ORCHIDEE_2_2/ORCHIDEE_OL/compile_orchidee_ol.sh	(revision 8562)
@@ -57,4 +57,7 @@
 netcdf_lib=""
 
+## Arguments in order to compress temporary files after compilation
+tar=no
+comp_tar=yes
 
 #### Read arguments 
@@ -82,4 +85,7 @@
    When using [-parallel seq], [-without_xios] must as well be set.
   [-netcdf_lib_seq]: option to tell XIOS that linking with netcdf4 sequential library will be used instead of default netcdf4 parallel library
+  [-tar]: option to compress XIOS repository that takes many inodes without compilation
+  [-comp_tar]: option to compile and compress XIOS repository if compilation succed
+  [-notar]: do not compress XIOS repository
 
 
@@ -113,4 +119,7 @@
 	"-all_exec")        otherexec="-otherexec" ; shift ;;
 	"-netcdf_lib_seq")  netcdf_lib="--netcdf_lib netcdf4_seq"; shift ;;
+        "-tar")             tar=yes ; shift ;;
+        "-comp_tar")        comp_tar=yes ; shift ;;
+        "-notar")           comp_tar=no ; shift ;;
 	*)	            echo "unknown option "$1" , exiting..." ; exit 
     esac
@@ -128,4 +137,5 @@
 echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile 
 echo "   full_flag=$full_flag, full_xios=$full_xios, full_orch=$full_orch" >> $outfile 
+echo "   tar=$tar, comp_tar=$comp_tar" >> $outfile
 echo >> $outfile
 
@@ -134,4 +144,24 @@
     echo "Option -without_xios must be set if option [-parallel seq] is set"
     echo "Option -without_xios must be set if option [-parallel seq] is set" >> $outfile  
+    exit
+fi
+
+# Compress XIOS without compiling if tar=yes
+if [ $tar == yes ] ; then
+    cd $modipsl/modeles
+    echo "Option tar activated to compress XIOS. No compilation will be done."
+    echo >> $outfile
+    echo "option tar activated" >> $outfile
+    if [[ -d $modipsl/modeles/XIOS ]] ; then
+        tar -cf XIOS.tar XIOS
+        rm -rf XIOS
+        echo " Tar XIOS repository"
+        echo " Tar XIOS repository" >> $outfile
+    else
+        echo " No XIOS repository to compress"
+        echo " No XIOS repository to compress" >> $outfile
+    fi
+    echo "END OF SCRIPT"
+    echo "END OF SCRIPT" >> $outfile
     exit
 fi
@@ -213,4 +243,37 @@
 ## 2.2 Compile xios
 if [ $xios == xios ] ; then
+    cd $modipsl/modeles
+    # First check if XIOS needs to be decompressed
+    # In priority search for modeles/XIOS_${optmode}.tar but if it doesn't exist take
+    # the first which is found. 
+    echo; echo "NOW DECOMPRESS XIOS IF NEEDED"
+    if [[ -d $modipsl/modeles/XIOS ]] ; then
+        echo "Found XIOS -> no decompress needs to be done";  >> $outfile
+    elif [[ -f $modipsl/modeles/XIOS_${optmode}.tar ]]; then
+        echo >> $outfile
+        echo "Found XIOS_${optmode}.tar -> decompress repository" >> $outfile
+        tar -xf XIOS_${optmode}.tar >> $outfile 2>&1
+    elif [[ -f $modipsl/modeles/XIOS_prod.tar ]]; then
+        echo >> $outfile
+        echo "Found XIOS_prod.tar -> decompress repository" >> $outfile
+        tar -xf XIOS_prod.tar >> $outfile 2>&1
+    elif [[ -f $modipsl/modeles/XIOS_debug.tar ]]; then
+        echo >> $outfile
+        echo "Found XIOS_debug.tar -> decompress repository" >> $outfile
+        tar -xf XIOS_debug.tar >> $outfile 2>&1
+    elif [[ -f $modipsl/modeles/XIOS_dev.tar ]]; then
+        echo >> $outfile
+        echo "Found XIOS_dev.tar -> decompress repository" >> $outfile
+        tar -xf XIOS_dev.tar >> $outfile 2>&1
+    elif [[ -f $modipsl/modeles/XIOS.tar ]]; then
+        echo >> $outfile
+        echo "Found XIOS.tar -> decompress repository" >> $outfile
+        tar -xf XIOS.tar >> $outfile 2>&1
+    else
+        echo "XIOS source code was not found. Exit"
+        echo "XIOS source code was not found. Exit" >> $outfile
+        exit
+    fi
+    
     cd $modipsl/modeles/XIOS
     echo; echo "NOW COMPILE XIOS"
@@ -265,5 +328,11 @@
 if [ -f $modipsl/bin/teststomate ] ; then mv $modipsl/bin/teststomate  $modipsl/bin/teststomate_${optmode} ; fi
 
-
+if [ $comp_tar == yes ] && [ -d $modipsl/modeles/XIOS ] ; then
+    cd $modipsl/modeles
+    echo "Option comp_tar activated, now compress XIOS"
+    echo "Option comp_tar activated, now compress XIOS" >> $outfile
+    tar -cf XIOS_${optmode}.tar XIOS
+    rm -rf XIOS
+fi
 
 echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile
