# Author Anyes Taffard (ataffard@cern.ch) # UCIAnaCommon root stand-alone makefile # # run with: # make # make clean # --- External configuration ---------------------------------- include $(ROOTSYS)/test/Makefile.arch PKG = AnaUtils HDR = ../AnaUtils SRC = ../src # # Names for executables # EXEC1 = NtMerge # # Add here headers needed by the main program(s) # ANA1_DEPS = $(HDR)/NtMerge.h # # Add here all libraries needed to link against the executable # MYLIBS = $(ROOTLIBS) \ -lm ${UCIANA_LIB}/libNtuple.so \ $(UCIANA_LIB)/lib$(PKG).so EXTERNAL_LIBS = ${UCIANA_LIB}/libNtuple.so # # compile/link everything # all : shlib bin shlib : lib$(PKG).so bin: $(EXEC1) #For the dictionary generation, add all headers and .cxx file (so that cna find implementation of virtual functions) #Don't Use ClassImp() in the .cxx #For the linking, either specifically link all the libraries the code depends on, OR # use .rootmap file which can be generated via ./do_map for each class # do_map uses: rlibmap -o libAnaUtils.rootmap -l libAnaUtils.so -d libCore.so -c ../AnaUtils/AnaUtilsLinkDef.h #.rootmap file needs to be located with the library where root will find it. It tells ROOT what are the libraries to load to use *this* shared library #List here all the files gmake should check against for update to intiate recompilation lib$(PKG).so : $(HDR)/*.h $(SRC)/*.cxx @echo "Generating dictionary ..." @rootcint -f AnaUtilsDict.cxx -c -p -I$(ROOTCFLAGS) \ -I$(UCINTPROD)/UCINtuple/Ntuple/Ntuple/ \ -I$(HDR)/ -DDebug \ $(HDR)/TGuiUtils.h $(SRC)/TGuiUtils.cxx \ $(HDR)/NtAnaBase.h $(SRC)/NtAnaBase.cxx \ $(HDR)/NtMerge.h $(SRC)/NtMerge.cxx \ $(HDR)/AnaUtilsLinkDef.h @echo "Building library lib$(PKG).so ..." $(CXX) $(SOFLAGS) $(CXXFLAGS) \ -I$(UCINTPROD)/UCINtuple/Ntuple/Ntuple/ -I../AnaUtils AnaUtilsDict.cxx -o $@ @echo "Establishing links to lib$(PKG).so in $(WORKAREA)/lib ..." @test -d $(WORKAREA)/lib || mkdir $(WORKAREA)/lib @test -h ../$(PKG)/run/lib$(PKG).so || ln -sf ../UCIAnaCommon/$(PKG)/run/lib$(PKG).so $(UCIANA_LIB)/ # # Build an executable program from $(EXEC1)_main.cxx # $(EXEC1): lib$(PKG).so $(ANA1_DEPS) ../test/$(EXEC1)_main.cxx @echo "Building output file $(EXEC1)_main.o ..." $(CXX) $(CXXFLAGS) -I$(UCINTPROD)/UCINtuple/Ntuple/Ntuple/ -I../AnaUtils \ -c ../test/$(EXEC1)_main.cxx -o $(EXEC1)_main.o -DAnalysis=$(EXEC1) @echo "Making local copies of shared libs ..." @cp $(EXTERNAL_LIBS) . @echo $(EXTERNAL_LIBS) " copied successfully" @echo "Building executable $(EXEC1) ..." # $(CXX) $(EXEC1)_main.o $(ROOTLIBS) ./libNtuple.so ./libAnaUtils.so -o $(EXEC1) $(CXX) $(EXEC1)_main.o $(ROOTLIBS) ./libNtuple.so ./libAnaUtils.so -o $(EXEC1) @rm -f $(EXEC1)_main.o # # Directives to gmake for cleaning # clean: @rm -f $(EXEC1) *.o lib$(PKG).so libclean: @rm -f lib$(PKG).so binclean: @rm -f $(EXEC1) *.o