diff --git a/developer-doc/InstallationLayout.txt b/developer-doc/InstallationLayout.txt index c7f2b48425063f078162ebb556b7fbb8e43a4f0f..db91d41d8da68e7913288fb4b9a92f078f266baf 100644 --- a/developer-doc/InstallationLayout.txt +++ b/developer-doc/InstallationLayout.txt @@ -71,7 +71,7 @@ When using an installed copy of plumed one can override the hard code values by PLUMED_ROOT PLUMED_INCLUDEDIR PLUMED_HTMLDIR and PLUMED_PROGRAM_NAME before launching plumed. Notice that to enforce a consistent behavior of scripts and plumed executable the same logic needed to -be implemented twice. One implementation is found in the src/config/Config.cpp file, another implementation +be implemented twice. One implementation is found in the src/config/Config.inc.in file, another implementation is prependend to the installed scripts by the src/config/Makefile. Also consider that environment is inherited by subprocesses. That means that if you want to diff --git a/src/config/.gitignore b/src/config/.gitignore index 68b4c544bf0dd97e6eb2d9f14d17fc1a696af017..1ed6d52bd32c4053a193839176d02c3b36bcda59 100644 --- a/src/config/.gitignore +++ b/src/config/.gitignore @@ -1,6 +1,6 @@ /compile_options.sh -/Config.cpp -/ConfigInstall.cpp /install* /version.h /config.txt +/Config.inc +/ConfigInstall.inc diff --git a/src/config/Config.cpp b/src/config/Config.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eb06096336a545ce151c8abd09d3e75122c14750 --- /dev/null +++ b/src/config/Config.cpp @@ -0,0 +1,24 @@ +/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Copyright (c) 2016 The plumed team + (see the PEOPLE file at the root of the distribution for a list of names) + + See http://www.plumed.org for more information. + + This file is part of plumed, version 2. + + plumed is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + plumed is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with plumed. If not, see <http://www.gnu.org/licenses/>. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + +#include "Config.h" +#include "Config.inc" diff --git a/src/config/Config.cpp.in b/src/config/Config.inc.in similarity index 100% rename from src/config/Config.cpp.in rename to src/config/Config.inc.in diff --git a/src/config/ConfigInstall.cpp b/src/config/ConfigInstall.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4f6b9862d147b6560b175322b1d50df4e2f7aa07 --- /dev/null +++ b/src/config/ConfigInstall.cpp @@ -0,0 +1,24 @@ +/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Copyright (c) 2016 The plumed team + (see the PEOPLE file at the root of the distribution for a list of names) + + See http://www.plumed.org for more information. + + This file is part of plumed, version 2. + + plumed is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + plumed is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with plumed. If not, see <http://www.gnu.org/licenses/>. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + +#include "Config.h" +#include "ConfigInstall.inc" diff --git a/src/config/Makefile b/src/config/Makefile index 23ec182622ccee9638093b93a2559ad0f6ed511f..a6c54df916a6afec2bf3ffb3ed4e1c22b16fcb22 100644 --- a/src/config/Makefile +++ b/src/config/Makefile @@ -11,12 +11,12 @@ endif .PHONY: all obj ifdef PLUMED_FORCE -.PHONY: ConfigInstall.cpp Config.cpp version.h +.PHONY: ConfigInstall.inc Config.inc version.h endif # default target all: - $(MAKE) PLUMED_FORCE=yes ConfigInstall.cpp Config.cpp version.h config.txt + $(MAKE) PLUMED_FORCE=yes ConfigInstall.inc Config.inc version.h config.txt $(MAKE) Config.o ConfigInstall.o compile_options.sh obj: all @@ -29,9 +29,9 @@ version.h: @echo "Updating version.h" @ ../maketools/update-version.sh version.h -ConfigInstall.cpp: Config.cpp.in - @echo "Updating ConfigInstall.cpp" - @sed "s/@SOEXT@/$(SOEXT)/g" Config.cpp.in | \ +ConfigInstall.inc: Config.inc.in + @echo "Updating ConfigInstall.inc" + @sed "s/@SOEXT@/$(SOEXT)/g" Config.inc.in | \ sed "s/@ISINSTALLED@/true/g" | \ sed "s|@PLUMED_ROOT@|$(libdir)/$(program_name)|g" | \ sed "s|@htmldir@|$(htmldir)|g" | \ @@ -42,8 +42,8 @@ ConfigInstall.cpp: Config.cpp.in rm $@~ # file to import compilation options inside c++ -Config.cpp: Config.cpp.in - @echo "Updating Config.cpp" +Config.inc: Config.inc.in + @echo "Updating Config.inc" @sed "s/@SOEXT@/$(SOEXT)/g" $< | \ sed "s/@ISINSTALLED@/false/g" | \ sed "s|@htmldir@|xxxxNAxxxx|g" | \ @@ -57,8 +57,8 @@ links: @echo Nothing to do in $(CURDIR) -Config.o: Config.cpp Makefile.conf.xxd version.h -ConfigInstall.o: ConfigInstall.cpp Makefile.conf.xxd version.h +Config.o: Config.inc Makefile.conf.xxd version.h +ConfigInstall.o: ConfigInstall.inc Makefile.conf.xxd version.h Makefile.conf.xxd: ../../Makefile.conf cat ../../Makefile.conf | xxd -i > Makefile.conf.xxd @@ -72,9 +72,9 @@ compile_options.sh: .PHONY: clean clean: - rm -f Config.cpp compile_options.sh Makefile_conf version.h config.txt + rm -f Config.inc compile_options.sh Makefile_conf version.h config.txt rm -fr deps - rm -f Config.cpp ConfigInstall.cpp compile_options.sh install.conf + rm -f Config.inc ConfigInstall.inc compile_options.sh install.conf rm -f $(CLEANLIST) # generic makefile rules diff --git a/src/lib/Makefile b/src/lib/Makefile index d9c18b2f48fbf48bf0e41d7ff64adc2aa17a7453..641fabc8236b33d652b72a9c17388644be223dd5 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -291,7 +291,7 @@ lib-shared: $(PLUMED_KERNEL) $(PLUMED_SHARED_OBJ) $(PLUMED_MAIN_SHARED) $(PLUMED $(PLUMED_SCRIPTS_EXE): @echo "#! /bin/bash" > $@ @echo "echo 'NOTE: shell only version, useful when plumed is cross compiled' >&2" >> $@ -# The logic implemented here should be the same as in config/Config.cpp.in +# The logic implemented here should be the same as in config/Config.inc.in # Please keep them consistent ifeq ($(PLUMED_INSTALL),Install) # If plumed is installed, single paths can be overridden using env vars