Index: trunk/LMDZ.COMMON/makelmdz_fcm
===================================================================
--- trunk/LMDZ.COMMON/makelmdz_fcm	(revision 3574)
+++ trunk/LMDZ.COMMON/makelmdz_fcm	(revision 3576)
@@ -608,21 +608,23 @@
 current_date=$(date)
 
-# Determine version control system (SVN, Git or none)
-if command -v svn > /dev/null && svn info > /dev/null 2>&1; then
-    vcs="svn"
-    vcs_info=$(svn info $LMDGCM/..)
-    vcs_diff=$(svn diff $LMDGCM/..)
-elif command -v git > /dev/null && git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
-    vcs="git"
-    vcs_info=$(git log -1 --pretty=format:"%H%n%an%n%ad%n%s" $LMDGCM/..)
-    vcs_diff=$(git diff $LMDGCM/..)
-else
-    vcs="none"
-fi
-
-# Function to escape the simple quotation sign
-escape_signs() {
-    echo "$1" | sed "s/'/''/g"
-}
+# Iterate through subdirectories in $LMDGCM/../ to determine version control system
+vcs_info=""
+vcs_diff=""
+for dir in "$LMDGCM/.."/*; do
+    # Skip if it is not a directory or the name contains "git" or "svn"
+    [ -d "$dir" ] || continue
+    [[ "$dir" == *git* || "$dir" == *svn* ]] && continue
+
+    # Determine the version control system for each subdirectory
+    if command -v svn > /dev/null && svn info "$dir" > /dev/null 2>&1; then # SVN
+        vcs_info+="\n=== SVN Information for $dir ===\n$(svn info "$dir")\n"
+        vcs_diff+="\n=== SVN Diff for $dir ===\n$(svn diff "$dir")\n"
+    elif command -v git > /dev/null && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git
+        vcs_info+="\n=== Git Information for $dir ===\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s")\n"
+        vcs_diff+="\n=== Git Diff for $dir ===\n$(git -C "$dir" diff)\n"
+    else # None
+        vcs_info+="\n=== No version control system for $dir ===\n"
+    fi
+done
 
 # Generate the Fortran subroutine
@@ -653,45 +655,30 @@
 SUBROUTINE print_version_info()
 
-    write(*,*) '=== Compilation details ==='
-    write(*,*) 'Date: ${current_date}'
-    write(*,*) 'Command: ${compilation_command}'
+    write(*,'(A)') '======= Compilation details ======='
+    write(*,'(A)') 'Date: ${current_date}'
+    write(*,'(A)') 'Command: ${compilation_command}'
     write(*,*)
 EOF
 
-if [ "$vcs" == "svn" ]; then # SVN info
-    echo "    write(*,*) '===== SVN Information ====='" >> "$info_file"
+if [ -n "$vcs_info" ]; then
+    echo "    write(*,'(A)') '=== Version Control Information ==='" >> "$info_file"
     while IFS= read -r line; do
-        echo "    write(*,*) '${line//\"/\\\"}'" >> "$info_file"
-    done <<< "$vcs_info"
+        echo "    write(*,'(A)') '${line//\'/\'\'}'" >> "$info_file"
+    done <<< "$(echo -e "$vcs_info")"
+fi
+
+if [ -n "$vcs_diff" ]; then
     echo "    write(*,*)" >> "$info_file"
-    echo "    write(*,*) '======== SVN Diff ========='" >> "$info_file"
-    echo "    write(*,*) 'Writing SVN diff to file: ${diff_file}'" >> "$info_file"
-    echo "    open(unit = 1,file = \"${diff_file}\",status = 'replace')" >> "$info_file"
+    echo "    write(*,'(A)') '====== Version Control Diff ======='" >> "$info_file"
+    echo "    write(*,'(A)') 'Writing diff to file: ${diff_file}'" >> "$info_file"
+    echo "    open(unit = 1, file = \"${diff_file}\", status = 'replace', action = 'write')" >> "$info_file"
     while IFS= read -r line; do
-        escaped_line=$(escape_signs "$line")
-        echo "    write(1,*) '${escaped_line//\"/\\\"}'" >> "$info_file"
-    done <<< "$vcs_diff"
+        echo "    write(1,'(A)') '${line//\'/\'\'}'" >> "$info_file"
+    done <<< "$(echo -e "$vcs_diff")"
     echo "    close(1)" >> "$info_file"
-
-
-elif [ "$vcs" == "git" ]; then # Git info
-    echo "    write(*,*) '===== Git Information ====='" >> "$info_file"
-    while IFS= read -r line; do
-        echo "    write(*,*) \"${line//\"/\\\"}\"" >> "$info_file"
-    done <<< "$vcs_info"
-    echo "    write(*,*)" >> "$info_file"
-    echo "    write(*,*) '======== Git Diff ========='" >> "$info_file"
-    echo "    write(*,*) 'Writing Git diff to file: ${diff_file}'" >> "$info_file"
-    while IFS= read -r line; do
-        escaped_line=$(escape_signs "$line")
-        echo "    write(1,*) '${escaped_line//\"/\\\"}'" >> "$info_file"
-    done <<< "$vcs_diff"
-    echo "    close(1)" >> "$info_file"
-else # Non-versioned code
-    echo "    write(*,*) 'No version control information available.'" >> "$info_file"
-fi
-    echo "    write(*,*) '==========================='" >> "$info_file"
+fi
 
 cat << EOF >> "$info_file"
+    write(*,'(A)') '==================================='
 
 END SUBROUTINE print_version_info
