From c4853a5887cb305471c6a06466f0a8256eb171ce Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Tue, 3 Oct 2017 14:50:17 +0200
Subject: [PATCH] Store Makefile.conf in config.txt

---
 scripts/config.sh                  | 6 ++++++
 src/config/Makefile                | 2 +-
 src/maketools/update-config-txt.sh | 4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/config.sh b/scripts/config.sh
index 727d3e8ca..a5a0df583 100755
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -13,6 +13,8 @@ Options:
                     check if plumed has features words
   module [word1 [word2]..]
                     check if plumed has enables modules words
+  makefile_conf
+                    dumps the Makefile.conf file
 
 Examples:
 
@@ -48,6 +50,10 @@ do
     ;;
   (has) action=has ;;
   (module) action=module ;;
+  (makefile_conf)
+    echo "$configfile" | awk '{if($1=="makefile_conf") { gsub("^makefile_conf ",""); print} }'
+    exit 0
+    ;;
   (*)
     checklist="$checklist $opt"
   esac
diff --git a/src/config/Makefile b/src/config/Makefile
index b02391589..815ca6972 100644
--- a/src/config/Makefile
+++ b/src/config/Makefile
@@ -23,7 +23,7 @@ obj: all
 
 config.txt: ../../Makefile.conf
 	@echo "Updating config.txt file"
-	@ ../maketools/update-config-txt.sh config.txt $(CPPFLAGS)
+	@makefile_conf="$(realpath ../../Makefile.conf)" ../maketools/update-config-txt.sh config.txt $(CPPFLAGS)
 
 version.h:
 	@echo "Updating version.h"
diff --git a/src/maketools/update-config-txt.sh b/src/maketools/update-config-txt.sh
index 4efebe16f..887e0c747 100755
--- a/src/maketools/update-config-txt.sh
+++ b/src/maketools/update-config-txt.sh
@@ -131,6 +131,10 @@ echo
 echo "# list of modules"
 echo "# syntax: module name on/off (default-on/default-off/always)"
 echo "$modules" | sort
+echo
+echo "# Makefile.conf file"
+echo "# syntax: makefile_conf followed by a single space followed by a line from makefile_conf"
+cat "$makefile_conf" | awk '{printf("makefile_conf %s\n",$0)}'
 
 }> $file~
 
-- 
GitLab