diff --git a/scripts/mklib.sh b/scripts/mklib.sh
index 9b30862508c5b5154813304b0194801de3f43dfc..742aa376583aaef6e1739aea274e69a9d5a032de 100755
--- a/scripts/mklib.sh
+++ b/scripts/mklib.sh
@@ -27,7 +27,7 @@ fi
 
 rm -f "$obj" "$lib"
 
-$compile "$obj" "$file" && $link "$lib" "$obj"
+eval "$compile" "$obj" "$file" && $link "$lib" "$obj"
 
 
 
diff --git a/src/config/Makefile b/src/config/Makefile
index fe20ff3a8df5e56c54baf3a55662a0491068de00..57e26686ce6929220d8cda104d4d310736b684dc 100644
--- a/src/config/Makefile
+++ b/src/config/Makefile
@@ -40,7 +40,7 @@ Makefile.conf.xxd: ../../Makefile.conf
 # file to import compilation options inside a bash script
 compile_options.sh:
 	@echo Building compile_options.sh, a sourceable bash script with some compilation options
-	@echo "compile='"$(CXX) -c -I'\$$PLUMED_ROOT'/src $(CPPFLAGS) $(CXXFLAGS) -o"'" > $@
+	@echo "compile='"$(CXX) -c -I'$$PLUMED_ROOT'/src $(CPPFLAGS) $(CXXFLAGS) -o"'" > $@
 	@echo "link='"$(LDSO) -o"'" >> $@
 	@echo "soext='"$(SOEXT)"'" >> $@