forked from JeffersonLab/EVe_HallC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
158 lines (141 loc) · 4.56 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
#------------------------------------------------------------------------------
# Names of source files and target libraries
# You do want to modify this section
# List all your source files here. They will be put into a shared library
# that can be loaded from a script.
# List only the implementation files (*.cxx). For every implementation file
# there must be a corresponding header file (*.h).
SRC = ScintillatorPaddle.cxx ScintPlane.cxx GetVariables.cxx \
ScintillatorPaddle3D.cxx ScintPlane3D.cxx\
MWDChamber.cxx MWDChamber3D.cxx \
Detector3D.cxx WirePlane.cxx \
CStransform.cxx Road.cxx MultiRoads.cxx Track.cxx TWire3D.cxx Trajectory3D.cxx \
FullTrajectory3D.cxx EVe.cxx WireChamber.cxx WirePlane2D.cxx
# Name of your package.
# The shared library that will be built will get the name lib$(PACKAGE).so
PACKAGE = EVe
# Name of the LinkDef file
LINKDEF = $(PACKAGE)_LinkDef.h
#------------------------------------------------------------------------------
# This part defines overall options and directory locations.
# Change as necessary,
# Compile debug version
export DEBUG = 1
# Architecture to compile for
ARCH = linuxegcs
#ARCH = solarisCC5
#------------------------------------------------------------------------------
# Directory locations. All we need to know is INCDIRS.
# INCDIRS lists the location(s) of the C++ Analyzer header (.h) files
# The following should work with both local installations and the
# Hall A counting house installation. For local installations, verify
# the setting of ANALYZER, or specify INCDIRS explicitly.
# To use this makefile without modif, you need to have the ANALYZER environment
# variable defined, pointing to the directory where the Hall A analyzer (Podd)
# that you use is located
ifndef ANALYZER
$(error $$ANALYZER environment variable not defined)
endif
INCDIRS = $(wildcard $(addprefix $(ANALYZER)/, include src hana_decode hana_scaler))
#------------------------------------------------------------------------------
# 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)
INCLUDES = $(ROOTCFLAGS) $(addprefix -I, $(INCDIRS) ) -I$(shell pwd)
USERLIB = lib$(PACKAGE).so
USERDICT = $(PACKAGE)Dict
LIBS =
GLIBS =
ifeq ($(ARCH),solarisCC5)
# Solaris CC 5.0
CXX = CC
ifdef DEBUG
CXXFLAGS = -g
LDFLAGS = -g
else
CXXFLAGS = -O
LDFLAGS = -O
endif
CXXFLAGS += -KPIC
LD = CC
SOFLAGS = -G
endif
ifeq ($(ARCH),linuxegcs)
# Linux with egcs (>= RedHat 5.2)
CXX = g++
ifdef DEBUG
CXXFLAGS = -g -O0
LDFLAGS = -g -O0
else
CXXFLAGS = -O
LDFLAGS = -O
endif
CXXFLAGS += -Wall -Woverloaded-virtual -fPIC
LD = g++
SOFLAGS = -shared
endif
ifeq ($(CXX),)
$(error $(ARCH) invalid architecture)
endif
CXXFLAGS += $(INCLUDES)
LIBS += $(ROOTLIBS) $(SYSLIBS)
GLIBS += $(ROOTGLIBS) $(SYSLIBS)
MAKEDEPEND = gcc
ifdef WITH_DEBUG
CXXFLAGS += -DWITH_DEBUG
endif
ifdef PROFILE
CXXFLAGS += -pg
LDFLAGS += -pg
endif
ifndef PKG
PKG = lib$(PACKAGE)
LOGMSG = "$(PKG) source files"
else
LOGMSG = "$(PKG) Software Development Kit"
endif
DISTFILE = $(PKG).tar.gz
#------------------------------------------------------------------------------
OBJ = $(SRC:.cxx=.o)
HDR = $(SRC:.cxx=.h)
DEP = $(SRC:.cxx=.d)
OBJS = $(OBJ) $(USERDICT).o
all: $(USERLIB)
$(USERLIB): $(HDR) $(OBJS)
$(LD) $(LDFLAGS) $(SOFLAGS) -o $@ $(OBJS)
@echo "$@ done"
$(USERDICT).cxx: $(HDR) $(LINKDEF)
@echo "Generating dictionary $(USERDICT)..."
rootcint -f $@ -c $(INCLUDES) $^
install: all
cp -p $(USERLIB) $(HOME)/cue/SRC/ana
clean:
rm -f *.o *~ $(USERLIB) $(USERDICT).*
realclean: clean
rm -f *.d
srcdist:
rm -f $(DISTFILE)
rm -rf $(PKG)
mkdir $(PKG)
cp -p $(SRC) $(HDR) $(LINKDEF) db*.dat README Makefile $(PKG)
gtar czvf $(DISTFILE) --ignore-failed-read \
-V $(LOGMSG)" `date -I`" $(PKG)
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)