forked from dteague/Analyzer
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
110 lines (76 loc) · 2.76 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
# Paths for CMSSW libraries:
#ifndef CMSSW_RELEASE_BASE
# If you're using a patched CMSSW release, some of the libs are still in the base release, so you also have to look there.
CMSSW_RELEASE_BASE_NOPATCH := $(shell echo $(CMSSW_RELEASE_BASE) | sed -e 's/-patch//' -e 's/_patch.//')
CMSSW_BOOST_BASE := $(shell cat $(CMSSW_RELEASE_BASE)/config/toolbox/$(SCRAM_ARCH)/tools/selected/boost.xml | grep 'name="BOOST_BASE"' | sed -e 's/.*default="//' | sed -e 's/"\/>//')
CMSSW_LIB_PATHS := -L$(CMSSW_BASE)/lib/$(SCRAM_ARCH)
CMSSW_LIB_PATHS += -L$(CMSSW_RELEASE_BASE)/lib/$(SCRAM_ARCH)
CMSSW_LIB_PATHS += -L$(CMSSW_RELEASE_BASE_NOPATCH)/lib/$(SCRAM_ARCH)
CMSSW_LIB_PATHS += -L$(CMSSW_BOOST_BASE)/lib
# For the headers there are symlinks.
CMSSW_INC_PATHS := -isystem$(CMSSW_BASE)/src
CMSSW_INC_PATHS += -isystem$(CMSSW_RELEASE_BASE)/src
CMSSW_INC_PATHS += -isystem$(CMSSW_BOOST_BASE)/include
#endif
ifndef MYANA
MYANA:=SpecialAna
endif
CXX = g++
CXXFLAGS += -Wall $(ROOTCFLAGS) -I./
CXXSPEED = -O3
LD = g++
LDFLAGS += -Wall $(ROOTLIBS) -lGenVector
LDSPEED = -O3
EXTRA_CFLAGS:= -DMYANA=$(MYANA)/SpechialAnalysis.h
EXTRA_LDFLAGS:=
# Gather all additional flags
EXTRA_CFLAGS += $(CMSSW_INC_PATHS)
EXTRA_LDFLAGS += $(CMSSW_LIB_PATHS) $(CMSSW_LIBS)
ifdef FAST
CXXSPEED= -Ofast
LDSPEED= -Ofast
endif
CXXFLAGS+=$(CXXSPEED)
LDFLAGS+=$(LDSPEED)
##This will make it very slow
ifdef DEBUG
CXXFLAGS = -Og -g -pg -Wall $(ROOTCFLAGS) -I./
LDFLAGS = -Og -g -Wall $(ROOTLIBS) -lGenVector
endif
CXXFLAGS+=$(EXTRA_CFLAGS) -Wno-deprecated
LDFLAGS+=$(EXTRA_LDFLAGS)
LIBS=
SRCDIR = src
BTAGDIR = $(SRCDIR)/btagging
MT2DIR = $(SRCDIR)/mt2
OBJDIR = obj
EXE = Analyzer
#------------------------------------------------------------------------------
SOURCES = $(wildcard src/*.cc)
OBJECTS = $(SOURCES:$(SRCDIR)/%.cc=$(OBJDIR)/%.o)
BTAGSRC = $(wildcard $(BTAGDIR)/*.cpp)
BTAGOBJ = $(BTAGSRC:$(BTAGDIR)/%.cpp=$(OBJDIR)/%.o)
MT2SRC = $(wildcard $(MT2DIR)/*.cc)
MT2OBJ = $(MT2SRC:$(MT2DIR)/%.cc=$(OBJDIR)/%.o)
MYANASRC = $(wildcard $(MYANA)/*.cc)
MYANAOBJ = $(MYANASRC:$(MYANA)/%.cc=$(OBJDIR)/%.o)
#------------------------------------------------------------------------------
all: $(EXE)
$(EXE): $(OBJECTS) $(BTAGOBJ) $(MT2OBJ) $(MYANAOBJ)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
obj/main.o: src/main.cc
$(CXX) $(CXXFLAGS) -c $< -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cc $(SRCDIR)/%.h
$(CXX) $(CXXFLAGS) -c $< -o $@
%: $(OBJDIR)/%.o
$(LD) -o $@ $(LDFLAGS) $< $(LIBS)
$(OBJDIR)/%.o: $(BTAGDIR)/%.cpp $(BTAGDIR)/%.h
$(CXX) $(CXXFLAGS) -c $< -o $@
$(OBJDIR)/%.o: $(MT2DIR)/%.cc $(MT2DIR)/%.hh
$(CXX) $(CXXFLAGS) -c $< -o $@
$(OBJDIR)/%.o: $(MYANA)/%.cc $(MYANA)/%.h
$(CXX) $(CXXFLAGS) -DANA=$(SRCDIR)/Analyzer.h -c $< -o $@
clean :
rm $(OBJDIR)/*