Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:09

0001 #common definitions go in here
0002 CXX           = g++
0003 CXXFLAGS      = -O -Wall  -fPIC -g -ansi -Wextra -Wno-deprecated -std=c++17 -I. -I../../..
0004 LD            = g++
0005 LDFLAGS       = -O
0006 LIBDIR       = $(WORKDIR)
0007 AR            = ar
0008 ARFLAGS       = cr
0009 
0010 OS := $(shell uname -s)
0011 ifeq ($(OS),Darwin)
0012         SOFLAGS       = -dynamiclib
0013 else
0014         SOFLAGS       = -shared
0015 endif   
0016 
0017 ifndef ROOTSYS
0018 $(error *** Please set up Root)
0019 endif
0020 
0021 ifeq ("$(wildcard lib)","")
0022 $(shell mkdir lib)
0023 endif
0024 
0025 #
0026 # Add system headers here (hack around problem with makedepend
0027 # if you added file remove the dummyIncl directory to rewrite files
0028 #
0029 ifeq ("$(wildcard dummyIncl)","")
0030 $(shell mkdir dummyIncl)
0031 $(shell mkdir dummyIncl/sys)
0032 $(shell mkdir dummyIncl/ext)
0033 $(shell touch dummyIncl/TBranch.h)
0034 $(shell touch dummyIncl/TCanvas.h)
0035 $(shell touch dummyIncl/TChain.h)
0036 $(shell touch dummyIncl/TColor.h)
0037 $(shell touch dummyIncl/TEfficiency.h)
0038 $(shell touch dummyIncl/TFile.h)
0039 $(shell touch dummyIncl/TH1D.h)
0040 $(shell touch dummyIncl/TH1F.h)
0041 $(shell touch dummyIncl/TH2F.h)
0042 $(shell touch dummyIncl/TLatex.h)
0043 $(shell touch dummyIncl/TLegend.h)
0044 $(shell touch dummyIncl/TMath.h)
0045 $(shell touch dummyIncl/TROOT.h)
0046 $(shell touch dummyIncl/TStyle.h)
0047 $(shell touch dummyIncl/TSystem.h)
0048 $(shell touch dummyIncl/TTree.h)
0049 $(shell touch dummyIncl/algorithm)
0050 $(shell touch dummyIncl/array)
0051 $(shell touch dummyIncl/bitset)
0052 $(shell touch dummyIncl/cassert)
0053 $(shell touch dummyIncl/chrono)
0054 $(shell touch dummyIncl/cctype)
0055 $(shell touch dummyIncl/cmath)
0056 $(shell touch dummyIncl/ctime)
0057 $(shell touch dummyIncl/cstdlib)
0058 $(shell touch dummyIncl/cmath)
0059 $(shell touch dummyIncl/exception)
0060 $(shell touch dummyIncl/filesystem)
0061 $(shell touch dummyIncl/fstream)
0062 $(shell touch dummyIncl/iomanip)
0063 $(shell touch dummyIncl/iostream)
0064 $(shell touch dummyIncl/limits)
0065 $(shell touch dummyIncl/map)
0066 $(shell touch dummyIncl/memory)
0067 $(shell touch dummyIncl/set)
0068 $(shell touch dummyIncl/sstream)
0069 $(shell touch dummyIncl/string)
0070 $(shell touch dummyIncl/tuple)
0071 $(shell touch dummyIncl/vector)
0072 $(shell touch dummyIncl/unordered_map)
0073 $(shell touch dummyIncl/unordered_set)
0074 $(shell touch dummyIncl/utility)
0075 $(shell touch dummyIncl/algorithm)
0076 $(shell touch dummyIncl/ext/hash_set)
0077 $(shell touch dummyIncl/sys/time.h)
0078 $(shell touch dummyIncl/sys/stat.h)
0079 $(shell touch dummyIncl/sys/types.h)
0080 $(shell touch dummyIncl/ctime)
0081 $(shell touch dummyIncl/chrono)
0082 endif
0083 
0084 ifeq ("$(wildcard FWCore)","")
0085 $(shell mkdir FWCore)
0086 $(shell mkdir FWCore/MessageLogger)
0087 $(shell mkdir FWCore/MessageLogger/interface)
0088 $(shell mkdir FWCore/Utilities)
0089 $(shell mkdir FWCore/Utilities/interface)
0090 endif
0091 
0092 ifeq ("$(wildcard FWCore/Utilities/interface/Exception.h)","")
0093 $(shell echo "#ifndef L1Trigger_TrackFindingTracklet_interface_Exception_h" > FWCore/Utilities/interface/Exception.h)
0094 $(shell echo "#define L1Trigger_TrackFindingTracklet_interface_Exception_h" >> FWCore/Utilities/interface/Exception.h)
0095 $(shell echo "#include<exception>" >> FWCore/Utilities/interface/Exception.h)
0096 $(shell echo "namespace cms {" >> FWCore/Utilities/interface/Exception.h)
0097 $(shell echo "  class Exception{" >> FWCore/Utilities/interface/Exception.h)
0098 $(shell echo "  public:" >> FWCore/Utilities/interface/Exception.h)
0099 $(shell echo "    Exception(std::string type) { if(0) {std::cout<<type<<std::endl;} }" >> FWCore/Utilities/interface/Exception.h)
0100 $(shell echo "    ~Exception() { std::cout << std::endl;}" >> FWCore/Utilities/interface/Exception.h)
0101 $(shell echo "    template <class T> Exception& operator<<(T const& t) {std::cout << t;return *this;}" >> FWCore/Utilities/interface/Exception.h)
0102 $(shell echo "    Exception& operator<<(std::ostream& (*f)(std::ostream&)) {std::cout << f;return *this;}" >> FWCore/Utilities/interface/Exception.h)
0103 $(shell echo "    Exception& operator<<(std::ios_base& (*f)(std::ios_base&)) {std::cout << f;return *this;}" >> FWCore/Utilities/interface/Exception.h)
0104 $(shell echo "  };" >> FWCore/Utilities/interface/Exception.h)
0105 $(shell echo "};" >> FWCore/Utilities/interface/Exception.h)
0106 $(shell echo "#endif" >> FWCore/Utilities/interface/Exception.h)
0107 endif
0108 
0109 ifeq ("$(wildcard FWCore/MessageLogger/interface/MessageLogger.h)","")
0110 $(shell echo "#ifndef L1Trigger_TrackFindingTracklet_interface_Logger_h" > FWCore/MessageLogger/interface/MessageLogger.h)
0111 $(shell echo "#define L1Trigger_TrackFindingTracklet_interface_Logger_h" >> FWCore/MessageLogger/interface/MessageLogger.h)
0112 $(shell echo "#include<iostream>" >> FWCore/MessageLogger/interface/MessageLogger.h)
0113 $(shell echo "namespace edm {" >> FWCore/MessageLogger/interface/MessageLogger.h)
0114 # INFO statement
0115 $(shell echo "  class LogVerbatim{" >> FWCore/MessageLogger/interface/MessageLogger.h)
0116 $(shell echo "  public:" >> FWCore/MessageLogger/interface/MessageLogger.h)
0117 $(shell echo "    LogVerbatim(std::string type) { if(0) {std::cout<<type<<std::endl;} }" >> FWCore/MessageLogger/interface/MessageLogger.h)
0118 $(shell echo "    ~LogVerbatim() { std::cout << std::endl;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0119 $(shell echo "    template <class T> LogVerbatim& operator<<(T const& t) {std::cout << t;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0120 $(shell echo "    LogVerbatim& operator<<(std::ostream& (*f)(std::ostream&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0121 $(shell echo "    LogVerbatim& operator<<(std::ios_base& (*f)(std::ios_base&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0122 $(shell echo "  };" >> FWCore/MessageLogger/interface/MessageLogger.h)
0123 # WARNING statement
0124 $(shell echo "  class LogPrint{" >> FWCore/MessageLogger/interface/MessageLogger.h)
0125 $(shell echo "  public:" >> FWCore/MessageLogger/interface/MessageLogger.h)
0126 $(shell echo "    LogPrint(std::string type) { if(0) {std::cout<<type<<std::endl;} }" >> FWCore/MessageLogger/interface/MessageLogger.h)
0127 $(shell echo "    ~LogPrint() { std::cout << std::endl;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0128 $(shell echo "    template <class T> LogPrint& operator<<(T const& t) {std::cout << t;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0129 $(shell echo "    LogPrint& operator<<(std::ostream& (*f)(std::ostream&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0130 $(shell echo "    LogPrint& operator<<(std::ios_base& (*f)(std::ios_base&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0131 $(shell echo "  };" >> FWCore/MessageLogger/interface/MessageLogger.h)
0132 # another WARNING statement
0133 $(shell echo "  class LogWarning{" >> FWCore/MessageLogger/interface/MessageLogger.h)
0134 $(shell echo "  public:" >> FWCore/MessageLogger/interface/MessageLogger.h)
0135 $(shell echo "    LogWarning(std::string type) { if(0) {std::cout<<type<<std::endl;} }" >> FWCore/MessageLogger/interface/MessageLogger.h)
0136 $(shell echo "    ~LogWarning() { std::cout << std::endl;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0137 $(shell echo "    template <class T> LogWarning& operator<<(T const& t) {std::cout << t;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0138 $(shell echo "    LogWarning& operator<<(std::ostream& (*f)(std::ostream&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0139 $(shell echo "    LogWarning& operator<<(std::ios_base& (*f)(std::ios_base&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0140 $(shell echo "  };" >> FWCore/MessageLogger/interface/MessageLogger.h)
0141 # ERROR statement
0142 $(shell echo "  class LogProblem{" >> FWCore/MessageLogger/interface/MessageLogger.h)
0143 $(shell echo "  public:" >> FWCore/MessageLogger/interface/MessageLogger.h)
0144 $(shell echo "    LogProblem(std::string type) { if(0) {std::cout<<type<<std::endl;} }" >> FWCore/MessageLogger/interface/MessageLogger.h)
0145 $(shell echo "    ~LogProblem() { std::cout << std::endl;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0146 $(shell echo "    template <class T> LogProblem& operator<<(T const& t) {std::cout << t;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0147 $(shell echo "    LogProblem& operator<<(std::ostream& (*f)(std::ostream&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0148 $(shell echo "    LogProblem& operator<<(std::ios_base& (*f)(std::ios_base&)) {std::cout << f;return *this;}" >> FWCore/MessageLogger/interface/MessageLogger.h)
0149 $(shell echo "  };" >> FWCore/MessageLogger/interface/MessageLogger.h)
0150 #
0151 $(shell echo "};" >> FWCore/MessageLogger/interface/MessageLogger.h)
0152 $(shell echo "#endif" >> FWCore/MessageLogger/interface/MessageLogger.h)
0153 endif
0154 
0155 # reduceRange for standalone
0156 ifeq ("$(wildcard DataFormats/Math/interface)","")
0157 $(shell mkdir DataFormats)
0158 $(shell mkdir DataFormats/Math)
0159 $(shell mkdir DataFormats/Math/interface)
0160 endif
0161 
0162 ifeq ("$(wildcard DataFormats/Math/interface/deltaPhi.h)","")
0163 $(shell echo "#ifndef DataFormats_Math_interface_deltaPhi_h" > DataFormats/Math/interface/deltaPhi.h)
0164 $(shell echo "#define DataFormats_Math_interface_deltaPhi_h" >> DataFormats/Math/interface/deltaPhi.h)
0165 $(shell echo "namespace reco {" >> DataFormats/Math/interface/deltaPhi.h)
0166 $(shell echo "  inline double reduceRange(double phi) { assert(std::abs(phi) < 100.0); " >> DataFormats/Math/interface/deltaPhi.h)
0167 $(shell echo "    while (phi < -M_PI) { phi += 2 * M_PI; }" >> DataFormats/Math/interface/deltaPhi.h)
0168 $(shell echo "    while (phi > M_PI) { phi -= 2 * M_PI; }" >> DataFormats/Math/interface/deltaPhi.h)
0169 $(shell echo "    return phi; } " >> DataFormats/Math/interface/deltaPhi.h)
0170 $(shell echo "};" >> DataFormats/Math/interface/deltaPhi.h)
0171 $(shell echo "namespace angle0to2pi {" >> DataFormats/Math/interface/deltaPhi.h)
0172 $(shell echo " template <class valType> " >> DataFormats/Math/interface/deltaPhi.h)
0173 $(shell echo " inline constexpr valType make0To2pi(valType angle) {" >> DataFormats/Math/interface/deltaPhi.h)
0174 $(shell echo "   constexpr valType twoPi = 2*M_PI;" >> DataFormats/Math/interface/deltaPhi.h)
0175 $(shell echo "   constexpr valType oneOverTwoPi = 1. / twoPi;" >> DataFormats/Math/interface/deltaPhi.h)
0176 $(shell echo "  constexpr valType epsilon = 1.e-13;" >> DataFormats/Math/interface/deltaPhi.h)
0177 $(shell echo "  if ((std::abs(angle) <= epsilon) || (std::abs(twoPi - std::abs(angle)) <= epsilon))" >> DataFormats/Math/interface/deltaPhi.h)
0178 $(shell echo "    return (0.);" >> DataFormats/Math/interface/deltaPhi.h)
0179 $(shell echo "  if (std::abs(angle) > twoPi) { " >> DataFormats/Math/interface/deltaPhi.h)
0180 $(shell echo "    valType nFac = trunc(angle * oneOverTwoPi);" >> DataFormats/Math/interface/deltaPhi.h)
0181 $(shell echo "    angle -= (nFac * twoPi);" >> DataFormats/Math/interface/deltaPhi.h)
0182 $(shell echo "    if (std::abs(angle) <= epsilon)" >> DataFormats/Math/interface/deltaPhi.h)
0183 $(shell echo "      return (0.);" >> DataFormats/Math/interface/deltaPhi.h)
0184 $(shell echo "    } " >> DataFormats/Math/interface/deltaPhi.h)
0185 $(shell echo "    if (angle < 0.)" >> DataFormats/Math/interface/deltaPhi.h)
0186 $(shell echo "      angle += twoPi;" >> DataFormats/Math/interface/deltaPhi.h)
0187 $(shell echo "    return (angle);" >> DataFormats/Math/interface/deltaPhi.h)
0188 $(shell echo "  }" >> DataFormats/Math/interface/deltaPhi.h)
0189 $(shell echo "};" >> DataFormats/Math/interface/deltaPhi.h)
0190 $(shell echo "#endif" >> DataFormats/Math/interface/deltaPhi.h)
0191 endif
0192 
0193 #find out about the installed ROOT
0194 ROOTCONFIG   := $(ROOTSYS)/bin/root-config
0195 ROOTCFLAGS   := $(shell $(ROOTCONFIG) --cflags)
0196 ROOTLDFLAGS  := $(shell $(ROOTCONFIG) --ldflags) $(shell $(ROOTCONFIG) --libs --nonew --glibs)
0197 
0198 #append to options
0199 CXXFLAGS     += $(ROOTCFLAGS)
0200 LDFLAGS      += $(ROOTLDFLAGS)
0201 # Needed for ROOT-Tree
0202 #LDFLAGS      += -L./ FPGAEvent_cxx.so
0203 
0204 CXXFLAGS += -std=c++17 #fix, otherwise ROOT cflags overrule c++11
0205 
0206 LIBS = -lHtml
0207 
0208 ifneq ($(CMSSW_BASE),)
0209         ROOTFIT_INCLUDE := $(shell cd $(CMSSW_BASE); scram tool info roofitcore | grep INCLUDE= | sed 's|INCLUDE=||')
0210         ROOTFIT_LIBDIR := $(shell cd $(CMSSW_BASE); scram tool info roofitcore | grep LIBDIR= | sed 's|LIBDIR=||')
0211 
0212         CINTINCLUDES := -I$(ROOTFIT_INCLUDE)
0213 ifneq ($(ROOTFIT_INCLUDE),)
0214         CXXFLAGS     += -I$(ROOTFIT_INCLUDE)
0215 endif
0216         LDFLAGS      += -L$(ROOTFIT_LIBDIR)
0217 endif
0218 
0219 
0220 DEPDIR = .deps
0221 
0222 MAKEDEPEND = makedepend -I../../.. -IdummyIncl -f- $< | sed 's/..\/src/lib/' > .deps/$*.d
0223 
0224 SRCSTMP = $(wildcard ../src/*.cc)
0225 
0226 DONTCOMPILE = $(wildcard ../src/*ChannelAssignment*.cc)
0227 
0228 SRCS = $(filter-out $(DONTCOMPILE), $(SRCSTMP)) 
0229 
0230 OBJS = $(SRCS:../src/%.cc=lib/%.o)
0231 
0232 default: fpga
0233 
0234 fpga: fpga.a fpga.o
0235         $(LD) -o $@ fpga.o fpga.a $(LDFLAGS) $(LIBS)
0236 
0237 fpga.o: fpga.cc $(DEPDIR)/fpga.d | $(DEPDIR)
0238         @$(MAKEDEPEND)
0239         $(CXX) $(CXXFLAGS) -c fpga.cc -o $@
0240 
0241 fpga.a:$(OBJS) 
0242         @$(AR) $(ARFLAGS) $@ $?
0243 
0244 lib/%.o:../src/%.cc $(DEPDIR)/%.d | $(DEPDIR)
0245         @$(MAKEDEPEND)
0246         time $(CXX) $(CXXFLAGS) -o $@ -c $<
0247 
0248 $(DEPDIR): ; @mkdir -p $@
0249 
0250 %.d: ;
0251 
0252 DEPFILES := $(SRCS:../src/%.cc=$(DEPDIR)/%.d)
0253 $(DEPFILES):
0254 include $(wildcard $(DEPFILES)) 
0255 include $(wildcard $(DEPDIR)/fpga.d) 
0256 
0257 
0258 clean:
0259         @rm -f *.o
0260         @rm -f fpga
0261         @rm -f fpga.a
0262         @rm -rf DataFormats/
0263         @rm -rf FWCore/
0264         @rm -rf lib/
0265         @rm -rf dummyIncl/
0266         @rm -rf .deps/
0267         @rm -f *.pdf *.png
0268         @rm -f allprojections.txt matchcalculator.txt matcheff.txt matchengine.txt matchprocessor.txt trackletcalculator.txt trackletengine.txt trackletprocessor.txt
0269 
0270