-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·229 lines (187 loc) · 5.55 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#------------------------------------------------------------------------------
# Core library
SRC = SoLIDSpectrometer.cxx SoLIDTrackerSystem.cxx SoLIDGEMTracker.cxx SoLIDGEMChamber.cxx \
SoLIDGEMReadOut.cxx SoLIDGEMHit.cxx SoLIDTrack.cxx SoLIDECal.cxx \
SoLIDFieldMap.cxx SIDISKalTrackFinder.cxx SoLKalMatrix.cxx SoLKalTrackSystem.cxx \
SoLKalTrackSite.cxx SoLKalTrackState.cxx SoLKalFieldStepper.cxx SoLKalTrackFinder.cxx \
PVDISKalTrackFinder.cxx JPsiKalTrackFinder.cxx
EXTRAHDR = SoLIDUtility.h EProjType.h
CORE = SoLIDTracking
CORELIB = lib$(CORE).so
COREDICT = $(CORE)Dict
LINKDEF = $(CORE)_LinkDef.h
#------------------------------------------------------------------------------
# Compile debug version (for gdb)
#export DEBUG = 1
# Compile extra code for printing verbose messages (enabled with fDebug)
export VERBOSE = 1
# Compile extra diagnostic code (extra computations and global variables)
export TESTCODE = 1
# Compile support code for MC input data
export MCDATA = 1
export SIDIS = 1
#export PVDIS = 1
#export I387MATH = 1
export EXTRAWARN = 1
# Architecture to compile for
ARCH = linux
#ARCH = solarisCC5
#------------------------------------------------------------------------------
# Directory locations. All we need to know is INCDIRS.
# INCDIRS lists the location(s) of the C++ Analyzer header (.h) files
ifndef ANALYZER
$(error $$ANALYZER environment variable not defined)
endif
INCDIRS = $(wildcard $(addprefix $(ANALYZER)/, include src hana_decode hana_scaler))
ifdef EVIO_INCDIR
INCDIRS += ${EVIO_INCDIR}
else ifdef EVIO
INCDIRS += ${EVIO}/include
endif
#------------------------------------------------------------------------------
# Do not change anything below here unless you know what you are doing
ifeq ($(strip $(INCDIRS)),)
$(error No Analyzer header files found. Check $$ANALYZER)
endif
ROOTCFLAGS := $(shell root-config --cflags)
ROOTLIBS := $(shell root-config --libs)
ROOTGLIBS := $(shell root-config --glibs)
ROOTBIN := $(shell root-config --bindir)
CXX := $(shell root-config --cxx)
LD := $(shell root-config --ld)
PKGINCLUDES = $(addprefix -I, $(INCDIRS) ) -I$(shell pwd)
INCLUDES = -I$(shell root-config --incdir) $(PKGINCLUDES)
LIBS =
GLIBS =
ifeq ($(ARCH),linux)
# Linux with gcc (RedHat)
ifdef DEBUG
CXXFLAGS = -g -O0
LDFLAGS = -g -O0
DEFINES =
else
CXXFLAGS = -O2 -g #-march=pentium4
LDFLAGS = -O -g
# DEFINES = -DNDEBUG
endif
DEFINES += -DLINUXVERS -DHAS_SSTREAM
CXXFLAGS += -Wall -Woverloaded-virtual -fPIC
DICTCXXFLG :=
ifdef EXTRAWARN
#FIXME: should be configure'd:
CXXVER := $(shell g++ --version | head -1 | sed 's/.* \([0-9]\)\..*/\1/')
ifeq ($(CXXVER),4)
CXXFLAGS += -Wextra -Wno-missing-field-initializers
DICTCXXFLG := -Wno-strict-aliasing
endif
endif
SOFLAGS = -shared
ifdef I387MATH
CXXFLAGS += -mfpmath=387
else
CXXFLAGS += -march=core2 -mfpmath=sse
endif
endif
ifeq ($(ARCH),solarisCC5)
# Solaris CC 5.0
ifdef DEBUG
CXXFLAGS = -g
LDFLAGS = -g
DEFINES =
else
CXXFLAGS = -O
LDFLAGS = -O
DEFINES = -DNDEBUG
endif
DEFINES += -DSUNVERS -DHAS_SSTREAM
CXXFLAGS += -KPIC
SOFLAGS = -G
DICTCXXFLG :=
endif
ifdef VERBOSE
DEFINES += -DVERBOSE
endif
ifdef TESTCODE
DEFINES += -DTESTCODE
endif
ifdef MCDATA
DEFINES += -DMCDATA
endif
ifdef SIDIS
DEFINES += -DSIDIS
endif
ifdef PVDIS
DEFINES += -DPVDIS
endif
CXXFLAGS += $(DEFINES) $(ROOTCFLAGS) $(ROOTCFLAGS) $(PKGINCLUDES)
LIBS += $(ROOTLIBS) $(SYSLIBS)
GLIBS += $(ROOTGLIBS) $(SYSLIBS)
MAKEDEPEND = gcc
ifndef PKG
PKG = lib$(CORE)
LOGMSG = "$(PKG) source files"
else
LOGMSG = "$(PKG) Software Development Kit"
endif
DISTFILE = $(PKG).tar
#------------------------------------------------------------------------------
OBJ = $(SRC:.cxx=.o) $(COREDICT).o
HDR = $(SRC:.cxx=.h) $(EXTRAHDR)
DEP = $(SRC:.cxx=.d)
all: $(CORELIB)
$(CORELIB): $(OBJ)
$(LD) $(LDFLAGS) $(SOFLAGS) -o $@ $^
@echo "$@ done"
#dbconvert: dbconvert.o
# $(LD) $(LDFLAGS) $(LIBS) -o $@ $^
ifeq ($(ARCH),linux)
$(COREDICT).o: $(COREDICT).cxx
$(CXX) $(CXXFLAGS) $(DICTCXXFLG) -o $@ -c $^
endif
$(COREDICT).cxx: $(HDR) $(LINKDEF)
@echo "Generating dictionary $(COREDICT)..."
$(ROOTBIN)/rootcint -f $@ -c $(INCLUDES) $(DEFINES) $^
install: all
$(error Please define install yourself)
# for example:
# cp $(USERLIB) $(LIBDIR)
clean:
rm -f *.o *~ $(CORELIB) $(COREDICT).*
realclean: clean
rm -f *.d
srcdist:
#rm -f $(DISTFILE).gz
#rm -rf $(PKG)
#mkdir $(PKG)
#cp -p $(SRC) $(HDR) $(LINKDEF) db*.dat Makefile $(PKG)
#cp -p $(MWDCLINKDEF) $(GEMLINKDEF) $(SOLIDLINKDEF) $(PKG)
#cp -p $(MWDCSRC) $(MHDR) $(GEMSRC) $(GHDR) $(PKG)
#cp -p $(SOLIDSRC) $(SHDR) dbconvert.cxx $(PKG)
#gtar czvf $(DISTFILE).gz --ignore-failed-read \
# -V $(LOGMSG)" `date -I`" $(PKG)
#rm -rf $(PKG)
develdist: srcdist
mkdir $(PKG)
ln -s ../.git $(PKG)
cp -p .gitignore $(PKG)
gunzip -f $(DISTFILE).gz
gtar rhvf $(DISTFILE) --exclude=*~ $(PKG)
xz -f $(DISTFILE)
rm -rf $(PKG)
.PHONY: all clean realclean srcdist
.SUFFIXES:
.SUFFIXES: .c .cc .cpp .cxx .C .o .d
%.o: %.cxx
$(CXX) $(CXXFLAGS) -o $@ -c $<
# FIXME: this only works with gcc
%.d: %.cxx
@echo Creating dependencies for $<
@$(SHELL) -ec '$(MAKEDEPEND) -MM $(INCLUDES) -c $< \
| sed '\''s%^.*\.o%$*\.o%g'\'' \
| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
[ -s $@ ] || rm -f $@'
###
-include $(DEP)
-include $(MDEP)
-include $(GDEP)
-include $(SDEP)