#! 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++ HFILES = DCanvasInstructions.h DPadInstructions.h DPlotDrawer.h DPlotSet.h PlotDrawerLinkDef.h CCFILES = $(wildcard *.cc) $(BMS_OSNAME)/obj/PlotDrawerDict.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/libPlotDrawer.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/PlotDrawer @cp $(BMS_OSNAME)/lib/libPlotDrawer.so $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ @cp *.h $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/include/PlotDrawer/ ifeq ($(IS_CLING), 1) @cp $(BMS_OSNAME)/obj/PlotDrawerDict_rdict.pcm $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ @cp $(BMS_OSNAME)/obj/PlotDrawerDict.cc $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/ endif $(BMS_OSNAME)/obj/PlotDrawerDict.cc: $(HFILES) @echo "Generating dictionary PlotDrawerDict.cc ..." @rm -rf $(BMS_OSNAME)/obj/PlotDrawerDict.cc ifeq ($(IS_CLING), 1) @rm -rf $(BMS_OSNAME)/obj/PlotDrawerDict_rdict.pcm rootcling $@ -c $(INCLUDE) $^ else rootcint -f $@ -c $(INCLUDE) $^ endif @echo "done." $(BMS_OSNAME)/lib/libPlotDrawer.so: $(CCFILES) @echo "Linking libPlotDrawer.so ..." @rm -f $(BMS_OSNAME)/lib/libPlotDrawer.so $(C++) $(FLAGS) $(SLIB_OPTION) $(CCFILES) -o $(BMS_OSNAME)/lib/libPlotDrawer.so $(LIBS) @chmod 644 $(BMS_OSNAME)/lib/libPlotDrawer.so clean: @rm -rf $(BMS_OSNAME) @rm -rf $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/libPlotDrawer.so ifeq ($(IS_CLING), 1) @rm -rf $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/obj/PlotDrawerDict_rdict.pcm @rm -rf $(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/obj/PlotDrawerDict.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)