Index: /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_IRENE-AMD.fcm
===================================================================
--- /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_IRENE-AMD.fcm	(revision 6885)
+++ /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_IRENE-AMD.fcm	(revision 6886)
@@ -41,5 +41,6 @@
 %CPP                 cpp
 %FC                  mpif90 -c -cpp
-%FCFLAGS             -i4 -r8 -O3 -fp-model strict
+%PROD_FCFLAGS        -i4 -r8 -O3 -fp-model strict
+%DEBUG_FCFLAGS       -i4 -r8 -g -O0 -debug all -traceback -fp-model strict -ftrapuv -check all,noarg_temp_created -fpe-all0 -ftz -init=arrays,snan,huge
 %FFLAGS              %FCFLAGS
 %LD                  mpif90
Index: /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_IRENE.fcm
===================================================================
--- /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_IRENE.fcm	(revision 6885)
+++ /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_IRENE.fcm	(revision 6886)
@@ -32,18 +32,18 @@
 %OASIS_HOME          ${PWD}/../../../oasis3-mct/BLD
 
-%NCDF_INC            -I$NETCDFFORTRAN_INCDIR -I$NETCDF_INCDIR
-%NCDF_LIB            -L$NETCDFFORTRAN_LIBDIR -lnetcdff -L$NETCDF_LIBDIR -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz -lcurl
-
-%XIOS_INC            -I%XIOS_HOME/inc
-%XIOS_LIB            -L%XIOS_HOME/lib -lxios -lstdc++
-%OASIS_INC           -I%OASIS_HOME/build/lib/mct -I%OASIS_HOME/build/lib/psmile.MPI1
-%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip
+%NCDF_INC            -I${NETCDFC_INCDIR} -I${NETCDFFORTRAN_INCDIR}
+%NCDF_LIB            -L${NETCDFC_LIBDIR} -lnetcdf -L${NETCDFFORTRAN_LIBDIR} -lnetcdff 
+%XIOS_INC            -I%XIOS_HOME/inc 
+%XIOS_LIB            -L%XIOS_HOME/lib -lxios
+%OASIS_INC           -I%OASIS_HOME/build/lib/psmile.MPI1 
+%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lscrip -lmct -lmpeu
 
 %CPP                 cpp
 %FC                  mpif90 -c -cpp
-%FCFLAGS             -i4 -r8 -O3 -fp-model strict -xCORE-AVX512 -fno-alias
+%PROD_FCFLAGS        -i4 -r8 -O3 -fp-model strict  -xCORE-AVX512 -fno-alias
+%DEBUG_FCFLAGS       -i4 -r8 -g -O0 -debug all -traceback -fp-model strict -ftrapuv -check all,noarg_temp_created -fpe-all0 -ftz -init=arrays,snan,huge
 %FFLAGS              %FCFLAGS
 %LD                  mpif90
-%LDFLAGS
+%LDFLAGS             -lstdc++
 %FPPFLAGS            -P -traditional
 %AR                  ar
@@ -52,5 +52,2 @@
 %USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC
 %USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB
-
-%CC                  cc
-%CFLAGS              -O0
Index: /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_JEANZAY.fcm
===================================================================
--- /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_JEANZAY.fcm	(revision 6885)
+++ /CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/NEMO/arch-X64_JEANZAY.fcm	(revision 6886)
@@ -41,5 +41,6 @@
 %CPP                 cpp
 %FC                  mpiifort -c -cpp
-%FCFLAGS             -i4 -r8 -O3 -fp-model strict -xCORE-AVX512 -fno-alias
+%PROD_FCFLAGS        -i4 -r8 -O3 -fp-model strict -xCORE-AVX512 -fno-alias
+%DEBUG_FCFLAGS       -i4 -r8 -g -O0 -debug all -traceback -fp-model strict -ftrapuv -check all,noarg_temp_created -fpe-all0 -ftz -init=arrays,snan,huge
 %FFLAGS              %FCFLAGS
 %LD                  mpiifort
Index: /CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh
===================================================================
--- /CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh	(revision 6885)
+++ /CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh	(revision 6886)
@@ -454,11 +454,29 @@
 	echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"   >> $outfile
     fi
-    
+
+    # Compilation management
+    # Nemo debug ?
+    cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm   $mysrc_path/NEMO/arch-nemo.fcm
+    if [ $optmode == debug ] ; then
+       if (! grep -q "^%DEBUG_FCFLAGS"  $mysrc_path/NEMO/arch-nemo.fcm); then
+          echo "ERROR: You must defined '%DEBUG_FCFLAGS' in your arch file if you want to compile Nemo in debug mode using '-d' option"
+          exit 1
+       fi
+       # duplicate the lines starting with %DEBUG_XXX and replace, in the duplicated line, %DEBUG_XXX by %XXX
+       sed -i'' -e "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" $mysrc_path/NEMO/arch-nemo.fcm
+    else
+       if (! grep -q "^%PROD_FCFLAGS" $mysrc_path/NEMO/arch-nemo.fcm ); then
+          echo "WARNING: '%PROD_FCFLAGS' not defined in your arch file, makenemo will use '%FCFLAGS' instead"
+       fi
+       # duplicate the lines starting with %PROD_XXX and replace, in the duplicated line, %PROD_XXX by %XXX
+      sed -i'' -e "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" $mysrc_path/NEMO/arch-nemo.fcm
+    fi
+
     echo >> $outfile ; echo cd $nemo_root  >> $outfile
-    echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.   >> $outfile
-    echo >> $outfile
-    
-    cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.
-    
+    echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-nemo.fcm arch/CNRS/arch-${fcm_arch}.fcm   >> $outfile
+    echo >> $outfile
+
+    cd $nemo_root ; mv $mysrc_path/NEMO/arch-nemo.fcm   arch/CNRS/arch-${fcm_arch}.fcm
+
     # creation of config
     echo >> $outfile ; echo cd $nemo_root  >> $outfile
