#! gnumake # DOCUMENTATION: https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuideChapters/AddingaClass.pdf C++ = g++ INCLUDE = -I. ROOTFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags) CXXFLAGS = -O -Wall -fPIC FLAGS = $(CXXFLAGS) $(ROOTFLAGS) $(INCLUDE) ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs) LIBS = $(ROOTGLIBS) -L/usr/lib64/ -lstdc++ -L$(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ -lPlotData HFILES = DFitFunctor.h DFitFunctors_Data.h DFitFunctors_Gaussians.h DFitGroup.h DPlotFitter.h DFitControl.h DFitFunctors_BreitWigners.h DFitFunctors_Extended.h DFitFunctors_Miscellaneous.h DFitUtilities.h PlotFitterLinkDef.h CCFILES = $(wildcard *.cc) $(BMS_OSNAME)/obj/PlotFitterDict.cc IS_DARWIN = $(shell echo $BMS_OSNAME | grep -c Darwin) ifneq ("$(wildcard $(ROOTSYS)/bin/rootcling)","") IS_CLING = 1 else IS_CLING = 0 endif ifeq ($(IS_DARWIN), 1) SLIB_OPTION = -dynamiclib else SLIB_OPTION = -shared endif all: install install: build_it install_it build_it: mkdir_build $(BMS_OSNAME)/lib/libPlotFitter.so mkdir_build: @mkdir -p $(BMS_OSNAME)/lib @mkdir -p $(BMS_OSNAME)/obj install_it: @mkdir -p $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib @mkdir -p $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/include @mkdir -p $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/include/PlotFitter @cp $(BMS_OSNAME)/lib/libPlotFitter.so $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ @cp *.h $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/include/PlotFitter/ ifeq ($(IS_CLING), 1) @cp $(BMS_OSNAME)/obj/PlotFitterDict_rdict.pcm $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ @cp $(BMS_OSNAME)/obj/PlotFitterDict.cc $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ endif $(BMS_OSNAME)/obj/PlotFitterDict.cc: $(HFILES) @echo "Generating dictionary PlotFitterDict.cc ..." @rm -rf $(BMS_OSNAME)/obj/PlotFitterDict.cc ifeq ($(IS_CLING), 1) @rm -rf $(BMS_OSNAME)/obj/PlotFitterDict_rdict.pcm rootcling $@ -c $(INCLUDE) $^ else rootcint -f $@ -c $(INCLUDE) $^ endif @echo "done." $(BMS_OSNAME)/lib/libPlotFitter.so: $(CCFILES) @echo "Linking libPlotFitter.so ..." @rm -f $(BMS_OSNAME)/lib/libPlotFitter.so $(C++) $(FLAGS) $(SLIB_OPTION) $(CCFILES) -o $(BMS_OSNAME)/lib/libPlotFitter.so $(LIBS) @chmod 644 $(BMS_OSNAME)/lib/libPlotFitter.so clean: @rm -rf $(BMS_OSNAME) @rm -rf $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/libPlotFitter.so ifeq ($(IS_CLING), 1) @rm -rf $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/obj/PlotFitterDict_rdict.pcm @rm -rf $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/obj/PlotFitterDict.cc endif env: @echo C++ $(C++) @echo BMS_OSNAME $(BMS_OSNAME) @echo INCLUDE $(INCLUDE) @echo FLAGS $(FLAGS) @echo LIBS $(LIBS) @echo IS_DARWIN $(IS_DARWIN) @echo SLIB_OPTION $(SLIB_OPTION) @echo IS_CLING $(IS_CLING)