From 5d555df7330d9f10a917a69f1b135dbefdf776b2 Mon Sep 17 00:00:00 2001 From: Andrey Popov Date: Wed, 13 Apr 2016 14:05:17 +0200 Subject: [PATCH] Rename library and environmental variable pointing to installation path For the sake of backward compatibility, a variable with the old name is still exported, and a symlink with the old name of the library is provided. --- Makefile | 11 ++++++----- Makefile.inc | 2 +- env.sh | 3 ++- include/mensura/core/FileInPath.hpp | 10 +++++----- include/mensura/extensions/PileUpWeight.hpp | 4 ++-- modules/PECReader/Makefile | 4 ++-- modules/core/Makefile | 2 +- modules/core/src/FileInPath.cpp | 6 +++--- modules/extensions/Makefile | 2 +- modules/external/BTagCalibration/Makefile | 2 +- modules/external/JERC/Makefile | 2 +- test/Makefile | 8 ++++---- 12 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 751ffdf..3671ec2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Check if the installation path of PECFwk is provided -ifeq ($(PEC_FWK_INSTALL), ) - $(error Mandatory environment variable PEC_FWK_INSTALL is not set) +ifeq ($(MENSURA_INSTALL), ) + $(error Mandatory environment variable MENSURA_INSTALL is not set) endif # Make sure ROOT is available @@ -37,7 +37,7 @@ MODULES := $(MODULES_STATIC) $(MODULES_SHARED) LIB_DIR := lib # Library built from modules that do not produce shared libraries on their own -MAIN_LIB_NAME := libPECFwk.so +MAIN_LIB_NAME := libmensura.so MAIN_LIB_PATH := $(LIB_DIR)/$(MAIN_LIB_NAME) @@ -54,14 +54,15 @@ $(MAIN_LIB_PATH): $(MODULES_STATIC) @ $(CC) -shared -Wl,-soname,$(MAIN_LIB_NAME).4 -o $@.4.0 \ -Wl,--whole-archive $(MODULE_STATIC_LIBS) -Wl,--no-whole-archive @ ln -sf $(MAIN_LIB_NAME).4.0 $@.4; ln -sf $(MAIN_LIB_NAME).4 $@ + @ ln -sf $(MAIN_LIB_NAME) $(LIB_DIR)/libPECFwk.so link-libs: $(MODULES_SHARED) @ mkdir -p $(LIB_DIR) @ cd $(LIB_DIR); for m in $(MODULES_SHARED); \ - do for f in `find $(PEC_FWK_INSTALL)/$(MODULES_DIR)/$$m/lib/ -regex ".*/lib.*\.so.*$$"`; \ + do for f in `find $(MENSURA_INSTALL)/$(MODULES_DIR)/$$m/lib/ -regex ".*/lib.*\.so.*$$"`; \ do ln -sf $$f .; done \ done - @ cd $(LIB_DIR); ln -sf $(wildcard $(PEC_FWK_INSTALL)/$(MODULES_DIR)/PECReader/lib/*.pcm) . + @ cd $(LIB_DIR); ln -sf $(wildcard $(MENSURA_INSTALL)/$(MODULES_DIR)/PECReader/lib/*.pcm) . $(MODULES): @ +make -s -C $(MODULES_DIR)/$@ diff --git a/Makefile.inc b/Makefile.inc index fcd4ed9..7a239b4 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,5 +1,5 @@ # Flags to control compilation and linking CC = g++ -INCLUDE = -I$(PEC_FWK_INSTALL)/include -I$(PEC_FWK_INSTALL) -I$(shell root-config --incdir) -I$(BOOST_ROOT)/include +INCLUDE = -I$(MENSURA_INSTALL)/include -I$(MENSURA_INSTALL) -I$(shell root-config --incdir) -I$(BOOST_ROOT)/include OPFLAGS = -O2 CFLAGS = -Wall -Wextra -Wno-unused-function -fPIC -std=c++14 $(INCLUDE) $(OPFLAGS) diff --git a/env.sh b/env.sh index a395826..2567420 100755 --- a/env.sh +++ b/env.sh @@ -38,7 +38,8 @@ function set_environment "-p") - export PEC_FWK_INSTALL=`pwd` + export MENSURA_INSTALL=`pwd` + export PEC_FWK_INSTALL=`pwd` # Provided for backward compatibility #echo "Framework-specific variables have been set" ;; esac diff --git a/include/mensura/core/FileInPath.hpp b/include/mensura/core/FileInPath.hpp index 6fa9159..3c2f3e4 100644 --- a/include/mensura/core/FileInPath.hpp +++ b/include/mensura/core/FileInPath.hpp @@ -13,7 +13,7 @@ * \class FileInPath * \brief Allows to resolve a (possibly) relative file path w.r.t. to several possible locations * - * A relative path is first resolved w.r.t. to $PEC_FWK_INSTALL/data/, then w.r.t. the current + * A relative path is first resolved w.r.t. to $MENSURA_INSTALL/data/, then w.r.t. the current * directory. Supports also an absolute path. */ class FileInPath @@ -22,7 +22,7 @@ class FileInPath /** * \brief Constructor * - * Reads the values of the PEC_FWK_INSTALL environmental variable and stores it in + * Reads the values of the MENSURA_INSTALL environmental variable and stores it in * intallPath. If the variable is not set, an exception is thrown. */ FileInPath(); @@ -33,7 +33,7 @@ class FileInPath * * If an absolute path is given, the method returns it unchanged after verifying that such * file exists. If the path is not absolute, the method tries to resolve it first w.r.t. - * $PEC_FWK_INSTALL/data/ then w.r.t. the current directory. If the path is resolved, which + * $MENSURA_INSTALL/data/ then w.r.t. the current directory. If the path is resolved, which * means it points to an existing file, an equivalent absolute path is returned. Otherwise * an exception is thrown. */ @@ -43,7 +43,7 @@ class FileInPath * \brief Resolves the file path * * Does precisely the same as Resolve(string const &), but tries to resolve a relative path - * w.r.t. $PEC_FWK_INSTALL/data/$prefix/ instead of $PEC_FWK_INSTALL/data/. + * w.r.t. $MENSURA_INSTALL/data/$prefix/ instead of $MENSURA_INSTALL/data/. */ std::string Resolve(std::string const &prefix, std::string const &path) const; @@ -51,7 +51,7 @@ class FileInPath /** * \brief Path in which the framework is intalled * - * Read from the environmental variable PEC_FWK_INSTALL. The path stored in this variable + * Read from the environmental variable MENSURA_INSTALL. The path stored in this variable * terminates with '/'. */ std::string installPath; diff --git a/include/mensura/extensions/PileUpWeight.hpp b/include/mensura/extensions/PileUpWeight.hpp index a8953a7..b562f6d 100644 --- a/include/mensura/extensions/PileUpWeight.hpp +++ b/include/mensura/extensions/PileUpWeight.hpp @@ -64,8 +64,8 @@ class PileUpWeight: public AnalysisPlugin * with any one). The second parameter is the name of a file with MC distributions over the * "true" number of pile-up interactions before any event selection (it might differ from * the nominal distribution due to a bug in random-number engine). The both file names are - * resolved w.r.t. directory $PEC_FWK_INSTALL/data/PileUp/. The last parameter is a - * desired systematical variation as defined in [1]. + * resolved w.r.t. directory $MENSURA_INSTALL/data/PileUp/. The last parameter is a desired + * systematical variation as defined in [1]. * [1] https://twiki.cern.ch/twiki/bin/view/CMS/PileupSystematicErrors */ PileUpWeight(std::string const &name, std::string const &dataPUFileName, diff --git a/modules/PECReader/Makefile b/modules/PECReader/Makefile index 8dba922..908e9cb 100644 --- a/modules/PECReader/Makefile +++ b/modules/PECReader/Makefile @@ -1,5 +1,5 @@ # Standard definitions -include $(PEC_FWK_INSTALL)/Makefile.inc +include $(MENSURA_INSTALL)/Makefile.inc # Paths to source and object files @@ -45,7 +45,7 @@ $(OBJ_DIR)/%.o: $(SOURCE_DIR)/%.cpp $(SOURCE_DIR)/$(DICT_CPP_NAME).cpp: $(SOURCE_DIR)/classes.h $(SOURCE_DIR)/classes_def.xml @ cd $(SOURCE_DIR); \ - rootcling -f $(DICT_CPP_NAME).cpp -s $(LIB_NAME) -I$(PEC_FWK_INSTALL)/include \ + rootcling -f $(DICT_CPP_NAME).cpp -s $(LIB_NAME) -I$(MENSURA_INSTALL)/include \ classes.h classes_def.xml @ touch -r $(SOURCE_DIR)/$(DICT_CPP_NAME).cpp $(SOURCE_DIR)/$(DICT_PCM_NAME) #^ In the first command of the recipe, rootcling produces cpp and pcm files. The $(DICT_PATH) diff --git a/modules/core/Makefile b/modules/core/Makefile index b73923d..068893c 100644 --- a/modules/core/Makefile +++ b/modules/core/Makefile @@ -1,5 +1,5 @@ # Standard definitions -include $(PEC_FWK_INSTALL)/Makefile.inc +include $(MENSURA_INSTALL)/Makefile.inc # Paths to source and object files diff --git a/modules/core/src/FileInPath.cpp b/modules/core/src/FileInPath.cpp index 8ffff6c..e764bf2 100644 --- a/modules/core/src/FileInPath.cpp +++ b/modules/core/src/FileInPath.cpp @@ -13,11 +13,11 @@ using namespace std; FileInPath::FileInPath() { // Read the install path from the environment - char const *path = getenv("PEC_FWK_INSTALL"); + char const *path = getenv("MENSURA_INSTALL"); if (not path) throw runtime_error("FileInPath::FileInPath: Mandatory environment variable " - "PEC_FWK_INSTALL is not defined."); + "MENSURA_INSTALL is not defined."); installPath = path; @@ -54,7 +54,7 @@ string FileInPath::Resolve(string const &prefix, string const &path) const canonicalPrefix += '/'; - // Try to resolve the path w.r.t. $PEC_FWK_INSTALL/data/ + // Try to resolve the path w.r.t. $MENSURA_INSTALL/data/ string tryPath = installPath + "/data/" + canonicalPrefix + path; if (boost::filesystem::exists(tryPath)) diff --git a/modules/extensions/Makefile b/modules/extensions/Makefile index b73923d..068893c 100644 --- a/modules/extensions/Makefile +++ b/modules/extensions/Makefile @@ -1,5 +1,5 @@ # Standard definitions -include $(PEC_FWK_INSTALL)/Makefile.inc +include $(MENSURA_INSTALL)/Makefile.inc # Paths to source and object files diff --git a/modules/external/BTagCalibration/Makefile b/modules/external/BTagCalibration/Makefile index b73923d..068893c 100644 --- a/modules/external/BTagCalibration/Makefile +++ b/modules/external/BTagCalibration/Makefile @@ -1,5 +1,5 @@ # Standard definitions -include $(PEC_FWK_INSTALL)/Makefile.inc +include $(MENSURA_INSTALL)/Makefile.inc # Paths to source and object files diff --git a/modules/external/JERC/Makefile b/modules/external/JERC/Makefile index b73923d..068893c 100644 --- a/modules/external/JERC/Makefile +++ b/modules/external/JERC/Makefile @@ -1,5 +1,5 @@ # Standard definitions -include $(PEC_FWK_INSTALL)/Makefile.inc +include $(MENSURA_INSTALL)/Makefile.inc # Paths to source and object files diff --git a/test/Makefile b/test/Makefile index 7497310..0f11178 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,6 +1,6 @@ # Check if an installation path of PECFwk is provided -ifeq ($(PEC_FWK_INSTALL), ) - $(error Mandatory environment variable PEC_FWK_INSTALL is not set) +ifeq ($(MENSURA_INSTALL), ) + $(error Mandatory environment variable MENSURA_INSTALL is not set) endif # Make sure ROOT is available @@ -15,11 +15,11 @@ endif # Flags to control compilation and linking -INCLUDE := -I$(PEC_FWK_INSTALL)/include -I$(shell root-config --incdir) +INCLUDE := -I$(MENSURA_INSTALL)/include -I$(shell root-config --incdir) OPFLAGS := -O2 CFLAGS := -Wall -Wextra -std=c++14 $(INCLUDE) $(OPFLAGS) LDFLAGS := $(shell root-config --libs) -lTreePlayer -lHistPainter \ - -L$(PEC_FWK_INSTALL)/lib -lPECFwk -lPECReader -Wl,-rpath=$(PEC_FWK_INSTALL)/lib \ + -L$(MENSURA_INSTALL)/lib -lmensura -lPECReader -Wl,-rpath=$(MENSURA_INSTALL)/lib \ -L$(BOOST_ROOT)/lib -lboost_filesystem -Wl,-rpath=$(BOOST_ROOT)/lib