######################################################################## # Makefile to create dial_root sources. # # David Adams # January 2005 # # For use with CTG. # # List of packages is taken from FULLDEPS which CTG builds from # LIBDEPS of this and depend packages. # ######################################################################## # Function to find header file for a component. hdrfile = $(shell find $(reldir)$(dir $(call pkgcomp, $(1))) \ -name $(strip $(1)).h \ ) # Function to find package/component for a component. pkgcomp = $(filter %/$(strip $(1)), $(pkgcomps) ) ######################################################################## # Release directory reldir := $(shell ctg_devdir)/ # Fetch the pkgmgr name for root from external/root rootpkg := $(shell cat $(reldir)/external/root/external/NAME) # Setup command for rootcint. rootsetup := pkgsetup.sh $(rootpkg) -b bin -l lib -e ROOTSYS== ######################################################################## # Packages packages := $(shell cat ../FULLDEPS) packages := $(filter-out external/gsoap_gsi, $(packages)) packages := $(filter-out external/root, $(packages)) packages := $(filter-out dataset/dataset_mysqlpp, $(packages)) # Packages with directories pkgdirs := $(foreach pkg, $(packages), $(reldir)$(pkg)) # package/component list pkgcomps := #pkgcomps += dial/dial_root/string pkgloop := $(foreach pkg, $(filter-out dial/dial_root, $(packages)), \ $(shell echo $(pkg)) ) pkgcomps += $(foreach pkg, $(filter-out dial/dial_root, $(packages)), \ $(foreach comp, \ $(shell dir=$(reldir)$(pkg); \ rfile=$$dir/ROOTDICT; \ cfile=$$dir/COMPONENTS; \ if test -r $$rfile; then cat $$rfile; else \ if test -r $$cfile; then cat $$cfile; fi; fi), \ $(pkg)/$(comp) \ ) \ ) # component names components := $(foreach pcomp, $(pkgcomps), $(notdir $(pcomp))) # List of dictionary cxx files to be created. dicts := $(foreach comp, $(components), $(comp)Dict.cxx ) # List of dictionary header files to be created. dicthdrs := $(foreach comp, $(components), $(comp)Dict.h ) # List of Link def files to be created. linkdefs := $(foreach comp, $(components), $(comp)LinkDef.h ) # List of dictionary component test files to be created. ctests := $(foreach comp, $(components), $(comp)Dict_t.cxx ) # Include directories. incdirs := $(foreach pkg, $(packages), $(reldir)$(pkg)) #Include string. includes := $(foreach dir, $(incdirs), -I$(dir)) # CPP flags. cppflags := -DDEFECT_GCC_2_95 -DDEFECT_ROOT_3_01 # Add extra definitions. components += Extra dicts += ExtraDict.cxx dicthdrs += ExtraDict.h ######################################################################## # Components which have to be processed without a linkdef due to # defects in rootcint (root release 3.03.09). #bad_components := Path Environment #bad_components += EventIdList ContentIdList DatasetIdList #bad_components += Job # ROOT 3.05.04 bad_components := bad_dicts := $(foreach comp,$(bad_components),$(comp)Dict.cxx) ######################################################################## all: $(dicts) $(ctests) ctest_interface root_interface show_reldir: @echo $(reldir) show_packages: @for pkg in $(packages); do echo $$pkg; done show_pkgcomps: @for pcomp in $(pkgcomps); do \ echo $$pcomp; \ done show_components: @for comp in $(components); do \ echo $$comp; \ done show_dicts: @for dict in $(dicts); do \ echo $$dict; \ done show_incdirs: @for inc in $(incdirs); do \ echo $$inc; \ done .INTERMEDIATE: %LinkDef.h .INTERMEDIATE: stringLinkDef.h # Run rootcint for additional. ExtraDict.cxx: Extra.h ExtraLinkDef.h @echo Making dictionary $@ @rm -f $@ @. $(rootsetup); rootcint $@ -c $(includes) Extra.h ExtraLinkDef.h # Run rootcint to create dictionary source and header %Dict.cxx: %LinkDef.h @echo Making dictionary $@ . $(rootsetup); rootcint $@ -c $(includes) $(call hdrfile,$*) $< @rm $< # Workaround for rootcint problems. $(bad_dicts): @echo Making dictionary $@ with ROOT workaround @. $(rootsetup); rootcint $@ -c $(includes) $(call hdrfile,$(patsubst %Dict.cxx,%,$@)) # Create link def file needed for rootcint %LinkDef.h: @if ! test -r $(@D); then mkdir -p $(@D); fi @echo "#ifdef __CINT__" > $@ @echo "" >> $@ @echo "#pragma link off all globals;" >> $@ @echo "#pragma link off all classes;" >> $@ @echo "#pragma link off all functions;" >> $@ @echo "" >> $@ @echo "#pragma link C++ defined_in "$(call hdrfile,$*)";" >> $@ @echo "#pragma link C++ nestedclasses;" >> $@ @echo "#pragma link C++ nestedtypedefs;" >> $@ @echo "" >> $@ @echo "#endif" >> $@ # Special link def for string class stringLinkDef.h: @if ! test -r $(@D); then mkdir $(@D); fi @echo @echo Making string link def $@ @echo "#ifdef __CINT__" > $@ @echo "" >> $@ @echo "#pragma link off all globals;" >> $@ @echo "#pragma link off all classes;" >> $@ @echo "#pragma link off all functions;" >> $@ @echo "" >> $@ @echo "#pragma link C++ class string;" >> $@ @echo "#pragma link C++ function operator==(const string&, const string&);" >> $@ @echo "#pragma link C++ function operator+(const string&, const string&);" >> $@ @echo "" >> $@ @echo "#endif" >> $@ # Component tests. # Dummy for now. %Dict_t.cxx: @echo Making component test $@ @echo "// "$@ > $@ @echo "" >> $@ @echo "int "$(basename $@)"() {" >> $@ @echo " return 0;" >> $@ @echo "}" >> $@ @echo "" >> $@ @echo "#ifdef CTEST_MAIN" >> $@ @echo "int main() {" >> $@ @echo " return "$(basename $@)"();" >> $@ @echo "}" >> $@ @echo "#endif" >> $@ # ctest interface files .PHONY: ctest_interface ctest_interface: ../COMPONENTS ../COMPONENTS:: @echo @echo Building $@ @rm -f $@ @touch $@ @for pkg in $(components); do echo $${pkg}Dict >> $@; done # ROOT files .PHONY: root_interface force root_interface: ../root/old_load_dial.cxx force: ../root/old_load_dial.cxx: force @echo @echo Building $@ @echo "// "$@ > $@ @echo "" >> $@ @echo "// This file was generated by dial/dial_root/src/Makefile." >> $@ @echo "// Do not modify directly." >> $@ @echo "// "`date` >> $@ @echo "" >> $@ @echo "" >> $@ @echo "#include " >> $@ @echo "#include " >> $@ @echo "#include " >> $@ @echo "#include \"TSystem.h\"" >> $@ @echo "#include \"TROOT.h\"" >> $@ @echo "" >> $@ @echo "using std::string;" >> $@ @echo "using std::vector;" >> $@ @echo "using std::cout;" >> $@ @echo "using std::endl;" >> $@ @echo "" >> $@ @echo "" >> $@ @echo "int load_dial() {" >> $@ @echo "" >> $@ @echo " string libdir = \"$$CMTCONFIG\";" >> $@ @echo "" >> $@ @echo " vector libs;" >> $@ @FLAVOR=gcc32dbg; \ for lib in globus_io; do \ echo " libs.push_back(\"lib"$${lib}_$$FLAVOR".so\");" >> $@; \ done @echo " libs.push_back(\"libxerces-c.so\");" >> $@ @echo " libs.push_back(\"libsqlplus.so\");" >> $@ @echo " libs.push_back(\"libmysqlclient.so\");" >> $@ @echo "" >> $@ @echo " libs.push_back(\"libTable.so\");" >> $@ @echo "" >> $@ @echo " libs.push_back(\"$(reldir)dial/dial_root/cernlib/libcernlib.so\");" >> $@ @echo "" >> $@ @echo " vector pkgs;" >> $@ @echo " vector pkgdirs;" >> $@ @for syspkg in $(packages); do \ pkg=`echo $$syspkg | sed 's#.*/##'`; \ echo " pkgs.push_back(\"$(notdir $$pkg)\");" >> $@; \ done @for dir in $(pkgdirs); do \ echo " pkgdirs.push_back(\"$$dir\");" >> $@; \ done @echo "" >> $@ @echo " string cppflags = \"$(cppflags)\";" >> $@ @echo "" >> $@ @echo " string macpath = TROOT::GetMacroPath();" >> $@ @echo " for ( unsigned int i=0; i> $@ @echo " string pkg = pkgs[i];" >> $@ @echo " string dir = pkgdirs[i];" >> $@ @echo " string lib = dir + \"/\" + libdir + \"/lib\" + pkg + \".so\";" >> $@ @echo " libs.push_back(lib);" >> $@ @echo " macpath = dir + \"/src:\" + macpath;" >> $@ @echo " cppflags += \" -I\" + dir;" >> $@ @echo " string line = \".include \" + dir;" >> $@ @echo " gROOT->ProcessLine(line.c_str());" >> $@ @echo " }" >> $@ @echo "" >> $@ @echo " for ( unsigned int i=0; i> $@ @echo " string lib = libs[i];" >> $@ @echo " cout << \"... Loading \" << lib << endl;" >> $@ @echo " int stat = gSystem->Load(lib.c_str());" >> $@ @echo " if ( stat != 0 ) return stat;" >> $@ @echo " }" >> $@ @echo "" >> $@ @echo " gSystem->SetIncludePath(cppflags.c_str());" >> $@ @echo " TROOT::SetMacroPath(macpath.c_str());" >> $@ @echo "" >> $@ @echo " return 0;" >> $@ @echo "}" >> $@ .PHONY: clean clean: @rm -rf $(dicts) $(dicthdrs) $(ctests) $(linkdefs) @rm -f G__* @rm -f ../COMPONENTS @rm -f ../root/old_load_dial.cxx