From b22ed559487cc1509a60b8053f69b977308ce46e Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Sun, 19 Jul 2015 19:05:37 -0400
Subject: [PATCH] Fixed install suffix.

Using "_" instead of "-" to avoid clashes.

Actually, the problem was that doing
make install PLUMED_SUFFIX=2
make install
The second install would have canceled the executables installed
by the first install. This is because install assumes names such as
plumed-* to be scripts installed for cross compiling
---
 CHANGES/v2.1.txt                   |  3 +++
 src/maketools/update-plumedroot.sh |  2 +-
 user-doc/Installation.txt          | 16 +++++++++++++---
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/CHANGES/v2.1.txt b/CHANGES/v2.1.txt
index f68c1c6c2..f4645ec8b 100644
--- a/CHANGES/v2.1.txt
+++ b/CHANGES/v2.1.txt
@@ -227,6 +227,9 @@ For users:
   Notice that this bug was present also in v2.0 but in a different form.
   More information here (\issue{162}), including a workaround that allows masses to be fixed
   without repatching.
+- When installing with PLUMED_LIBSUFFIX an underscore is used as separator instead of a dash.
+  E.g. `make install PLUMED_LIBSUFFIX=2.1` will result in an executable named `plumed_v2.1`.
+  This fix a potential problem (see \ref Installation).
 - Fixed erroneously reported message about MPI at the end of ./configure.
 - Changed warning message about undocumented components.
 - PLUMED now says in the log file if it was compiled from a dirty git repository.
diff --git a/src/maketools/update-plumedroot.sh b/src/maketools/update-plumedroot.sh
index af7a2d2db..873d36d03 100755
--- a/src/maketools/update-plumedroot.sh
+++ b/src/maketools/update-plumedroot.sh
@@ -14,7 +14,7 @@ prefix="${prefix:=/usr/local}"
 PLUMED_PREFIX="${PLUMED_PREFIX:=$prefix}"
 
 PLUMED_LIBSUFFIX="${PLUMED_LIBSUFFIX:=}"
-test -n "$PLUMED_LIBSUFFIX" && PLUMED_LIBSUFFIX="-${PLUMED_LIBSUFFIX}"
+test -n "$PLUMED_LIBSUFFIX" && PLUMED_LIBSUFFIX="_${PLUMED_LIBSUFFIX}"
 PLUMED_ROOT="${PLUMED_PREFIX}/lib/plumed${PLUMED_LIBSUFFIX}/"
 
 {
diff --git a/user-doc/Installation.txt b/user-doc/Installation.txt
index d2f9a86e8..23caecba7 100644
--- a/user-doc/Installation.txt
+++ b/user-doc/Installation.txt
@@ -341,11 +341,21 @@ define the environment variable PLUMED_LIBSUFFIX using:
 > export PLUMED_LIBSUFFIX=v2.0
 > make install
 \endverbatim
-This will install a plumed executable named "plumed-v2.0". All the other files will be renamed similarly,
-e.g. the PLUMED library will be loaded with "-lplumed-v2.0" and the PLUMED header files
-will be included with "#include <plumed-v2.0/tools/Vector.h>". This trick is useful if you
+This will install a plumed executable named "plumed_v2.0". All the other files will be renamed similarly,
+e.g. the PLUMED library will be loaded with "-lplumed_v2.0" and the PLUMED header files
+will be included with "#include <plumed_v2.0/tools/Vector.h>". This trick is useful if you
 do not want to set up modules, but we believe that using modules as described above is more flexible.
 
+\warning Until version 2.1.3, the added suffix was in the form `-suffix` instead of `_suffix`.
+This could cause clashes with the fact that plumed reserved names with a `-something` appended
+for scripts used in cross compiling  (see below).
+As a consequence, by doing
+\verbatim
+> make install PLUMED_LIBSUFFIX=v2.0
+> make install
+\endverbatim
+The second install would remove all the executables installed by the first install.
+
 \section Patching Patching your MD code
 
 In case your MD code is not supporting PLUMED already, you should modify it.
-- 
GitLab