diff --git a/scripts/mklib.sh b/scripts/mklib.sh index b3e2ffcd7a..de3454949c 100755 --- a/scripts/mklib.sh +++ b/scripts/mklib.sh @@ -12,7 +12,7 @@ if [ "$1" = --help ] ; then fi if [ "$1" = --options ] ; then - echo "--description --options --help -o" + echo "--description --options --help -o -n" exit 0 fi @@ -27,6 +27,7 @@ source "$PLUMED_ROOT"/src/config/compile_options.sh prefix="" lib="" +no_clobber="" files=() # empty array for opt do @@ -37,6 +38,8 @@ do prefix="--out=";; (--out=*) lib="${prefixopt#--out=}";; + (-n) + no_clobber=yes;; (-*) echo "ERROR: Unknown option $opt. Use --help for help." exit 1 ;; @@ -66,6 +69,10 @@ do fi done +if test -z "$no_clobber" ; then + recompile=yes +fi + if test $recompile = no ; then echo "$lib is already up to date" exit 0 @@ -148,5 +155,9 @@ fi eval "$link_command" "$PLUMED_MKLIB_LDFLAGS" $objs -o "$tmpdir/$lib" -# || true is necessary with recent coreutils -mv -n "$tmpdir/$lib" $lib || true +if test -n "$no_clobber" ; then + # || true is necessary with recent coreutils + mv -n "$tmpdir/$lib" $lib || true +else + mv "$tmpdir/$lib" $lib +fi diff --git a/src/core/PlumedMain.cpp b/src/core/PlumedMain.cpp index c16f7b1bb8..b34a2ae78a 100644 --- a/src/core/PlumedMain.cpp +++ b/src/core/PlumedMain.cpp @@ -1261,7 +1261,7 @@ void PlumedMain::load(const std::string& fileName) { // full path command, including environment setup // this will work even if plumed is not in the execution path or if it has been // installed with a name different from "plumed" - std::string cmd=config::getEnvCommand()+" \""+config::getPlumedRoot()+"\"/scripts/mklib.sh -o "+libName+" "+fileName; + std::string cmd=config::getEnvCommand()+" \""+config::getPlumedRoot()+"\"/scripts/mklib.sh -n -o "+libName+" "+fileName; if(std::getenv("PLUMED_LOAD_ACTION_DEBUG")) log<<"Executing: "<