1 |
############################################################################### |
2 |
# |
3 |
# FILE NAME: Make.def |
4 |
# VERSION: 1.2 |
5 |
# AUTHOR: Nergal S.r.l. |
6 |
# DATE: 2007-03-14 |
7 |
# |
8 |
# DESCRIPTION: base Makefile |
9 |
# |
10 |
# REVISION HISTORY: |
11 |
# |
12 |
# Version Date Author Change Description |
13 |
# |
14 |
############################################################################### |
15 |
|
16 |
#------------------------------------------------------------------------------ |
17 |
# default settings |
18 |
#------------------------------------------------------------------------------ |
19 |
|
20 |
ifndef BASEDIR |
21 |
BASEDIR =$(shell pwd) |
22 |
endif |
23 |
|
24 |
ifdef release |
25 |
debug = 0 |
26 |
release = 1 |
27 |
endif |
28 |
|
29 |
ifndef release |
30 |
debug = 1 |
31 |
release = 0 |
32 |
endif |
33 |
|
34 |
|
35 |
CC = gcc |
36 |
CXX = g++ |
37 |
ifeq ($(GCC4),1) |
38 |
F77 = gfortran |
39 |
else |
40 |
F77 = g77 |
41 |
endif |
42 |
AR = ar |
43 |
AS = as |
44 |
CXXLD = g++ |
45 |
OC = cp |
46 |
ROOT_DIR = $(ROOTSYS) |
47 |
ROOT_LIB = $(ROOTSYS)/lib |
48 |
ROOTCINT = $(ROOTSYS)/bin/rootcint |
49 |
|
50 |
SHELL = /bin/bash |
51 |
MAKE = /usr/bin/make BASEDIR=$(BASEDIR) |
52 |
|
53 |
.PHONY : clean help var |
54 |
|
55 |
#------------------------------------------------------------------------------ |
56 |
# default compiler, assembler & linker FLAGS |
57 |
#------------------------------------------------------------------------------ |
58 |
|
59 |
|
60 |
#CFLAGS += -Wall |
61 |
CFLAGS += -Wall -shared |
62 |
FFLAGS += -O0 |
63 |
LDFLAGS += |
64 |
|
65 |
#------------------------------------------------------------------------------ |
66 |
# optimization FLAG |
67 |
#------------------------------------------------------------------------------ |
68 |
|
69 |
OPT_FLAG = -O3 |
70 |
|
71 |
#------------------------------------------------------------------------------ |
72 |
# object's directories, FLAGS & libs extensions for release & debug version |
73 |
#------------------------------------------------------------------------------ |
74 |
|
75 |
OBJDIR_D = obj/debug |
76 |
OBJDIR_R = obj/release |
77 |
|
78 |
ifeq ("1", "$(debug)") |
79 |
CFLAGS += -g $(OPT_FLAG) -DDEBUG |
80 |
OBJDIR = obj/debug |
81 |
endif |
82 |
|
83 |
ifeq ("1", "$(release)") |
84 |
CFLAGS += $(OPT_FLAG) |
85 |
OBJDIR = obj/release |
86 |
endif |
87 |
|
88 |
#------------------------------------------------------------------------------ |
89 |
# Objects & Dependencies |
90 |
#------------------------------------------------------------------------------ |
91 |
|
92 |
OBJS = \ |
93 |
${FORSRCS:%.for=$(OBJDIR)/%.o} \ |
94 |
${FSRCS:%.f=$(OBJDIR)/%.o} \ |
95 |
${CSRCS:%.c=$(OBJDIR)/%.o} \ |
96 |
${CXXSRCS:%.cpp=$(OBJDIR)/%.o} |
97 |
|
98 |
DEPEND = \ |
99 |
${FORSRCS:%.for=$(OBJDIR)/.%.d} \ |
100 |
${FSRCS:%.f=$(OBJDIR)/.%.d} \ |
101 |
${CSRCS:%.c=$(OBJDIR)/.%.d} \ |
102 |
${CXXSRCS:%.cpp=$(OBJDIR)/.%.d} |
103 |
|
104 |
|
105 |
$(OBJDIR)/.%.d: %.f |
106 |
ifeq ($(verbose),) |
107 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
108 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
109 |
# echo "generating depend infos for $< into $@"; \ |
110 |
$(F77) -M $(FFLAGS) $< 2>/dev/null\ |
111 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
112 |
else |
113 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
114 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
115 |
echo "generating depend infos for $< into $@"; \ |
116 |
$(F77) -M $(FFLAGS) $< 2>/dev/null\ |
117 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
118 |
endif |
119 |
|
120 |
$(OBJDIR)/.%.d: %.for |
121 |
ifeq ($(verbose),) |
122 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
123 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
124 |
# echo "generating depend infos for $< into $@"; \ |
125 |
$(F77) -M $(FFLAGS) $< 2>/dev/null\ |
126 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
127 |
else |
128 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
129 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
130 |
echo "generating depend infos for $< into $@"; \ |
131 |
$(F77) -M $(FFLAGS) $< 2>/dev/null\ |
132 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
133 |
endif |
134 |
|
135 |
$(OBJDIR)/.%.d: %.c |
136 |
ifeq ($(verbose),) |
137 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
138 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
139 |
# echo "generating depend infos for $< into $@"; \ |
140 |
$(CC) -M $(CFLAGS) $< 2>/dev/null\ |
141 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
142 |
else |
143 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
144 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
145 |
echo "generating depend infos for $< into $@"; \ |
146 |
$(CC) -M $(CFLAGS) $< 2>/dev/null\ |
147 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
148 |
endif |
149 |
|
150 |
$(OBJDIR)/.%.d: %.cpp |
151 |
ifeq ($(verbose),) |
152 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
153 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
154 |
# echo "generating depend infos for $< into $@"; \ |
155 |
$(CXX) -M $(CFLAGS) $< 2>/dev/null\ |
156 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
157 |
else |
158 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
159 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
160 |
echo "generating depend infos for $< into $@"; \ |
161 |
$(CXX) -M $(CFLAGS) $< 2>/dev/null\ |
162 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
163 |
endif |
164 |
|
165 |
$(OBJDIR)/%.o: %.for |
166 |
ifeq ($(verbose),) |
167 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
168 |
$(F77) -c $(FFLAGS) -o $@ $< |
169 |
else |
170 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
171 |
$(F77) -c $(FFLAGS) -o $@ $< |
172 |
endif |
173 |
|
174 |
$(OBJDIR)/%.o: %.f |
175 |
ifeq ($(verbose),) |
176 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
177 |
$(F77) -c $(FFLAGS) -o $@ $< |
178 |
else |
179 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
180 |
$(F77) -c $(FFLAGS) -o $@ $< |
181 |
endif |
182 |
|
183 |
$(OBJDIR)/%.o: %.c |
184 |
ifeq ($(verbose),) |
185 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
186 |
$(CC) -c $(CFLAGS) -o $@ $< |
187 |
else |
188 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
189 |
$(CC) -c $(CFLAGS) -o $@ $< |
190 |
endif |
191 |
|
192 |
$(OBJDIR)/%.o: %.cpp |
193 |
ifeq ($(verbose),) |
194 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
195 |
$(CXX) -c $(CFLAGS) -o $@ $< |
196 |
else |
197 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
198 |
$(CXX) -c $(CFLAGS) -o $@ $< |
199 |
endif |
200 |
|
201 |
#------------------------------------------------------------------------------ |
202 |
# General directory structure, includes, objects |
203 |
#------------------------------------------------------------------------------ |
204 |
|
205 |
PAMOFF_DIR = $(BASEDIR)/PamOffLineSW |
206 |
EVENT_DIR = $(BASEDIR)/event |
207 |
|
208 |
FORROU_DIR = $(PAMOFF_DIR)/forroutines |
209 |
TRAK_DIR = $(FORROU_DIR)/tracker |
210 |
RRAW_DIR = $(TRAK_DIR)/readraw |
211 |
ACTR_DIR = $(FORROU_DIR)/anticounter |
212 |
CALO_DIR = $(FORROU_DIR)/calorimeter |
213 |
TOF_DIR = $(FORROU_DIR)/tof |
214 |
TRGR_DIR = $(FORROU_DIR)/trigger |
215 |
|
216 |
FORROUEXTDIR = $(TRAK_DIR) $(RRAW_DIR) $(ACTR_DIR) $(CALO_DIR) $(TOF_DIR) $(TRGR_DIR) |
217 |
|
218 |
PHYS_DIR = $(PAMOFF_DIR)/physics |
219 |
TECH_DIR = $(PAMOFF_DIR)/techmodel |
220 |
|
221 |
EXTDIR = $(PHYS_DIR) $(TECH_DIR) $(FORROU_DIR) |
222 |
|
223 |
#------------------------------------------------------------------------------ |
224 |
|
225 |
ROOT_DIR_INC = $(ROOT_DIR)/include |
226 |
|
227 |
FORROU_DIR_INC = $(FORROU_DIR)/include |
228 |
RRAW_DIR_INC = $(RRAW_DIR)/include |
229 |
TRAK_DIR_INC = $(TRAK_DIR)/include |
230 |
ACTR_DIR_INC = $(ACTR_DIR)/include |
231 |
CALO_DIR_INC = $(CALO_DIR)/include |
232 |
TOF_DIR_INC = $(TOF_DIR)/include |
233 |
TRGR_DIR_INC = $(TRGR_DIR)/include |
234 |
|
235 |
PHYS_DIR_INC = $(PHYS_DIR)/include |
236 |
TECH_DIR_INC = $(TECH_DIR)/include |
237 |
|
238 |
#------------------------------------------------------------------------------ |
239 |
|
240 |
FORROU_OBJ = $(FORROU_DIR)/$(OBJDIR) |
241 |
RRAW_OBJ = $(RRAW_DIR)/$(OBJDIR) |
242 |
TRAK_OBJ = $(TRAK_DIR)/$(OBJDIR) |
243 |
ACTR_OBJ = $(ACTR_DIR)/$(OBJDIR) |
244 |
CALO_OBJ = $(CALO_DIR)/$(OBJDIR) |
245 |
TOF_OBJ = $(TOF_DIR)/$(OBJDIR) |
246 |
TRGR_OBJ = $(TRGR_DIR)/$(OBJDIR) |
247 |
|
248 |
PHYS_OBJ = $(PHYS_DIR)/$(OBJDIR) |
249 |
TECH_OBJ = $(TECH_DIR)/$(OBJDIR) |
250 |
PAMOFF_OBJ = $(PAMOFF_DIR)/$(OBJDIR) |
251 |
|
252 |
|
253 |
#------------------------------------------------------------------------------ |
254 |
# Built libraries |
255 |
#------------------------------------------------------------------------------ |
256 |
|
257 |
FORROU_A = $(FORROU_OBJ)/libforrou.a |
258 |
FORROUINT_A = $(FORROU_OBJ)/libforrouinternal.a |
259 |
RRAW_A = $(RRAW_OBJ)/libforreadraw.a |
260 |
TRAK_A = $(RRAW_OBJ)/libfortracker.a |
261 |
ACTR_A = $(ACTR_OBJ)/libanticounter.a |
262 |
CALO_A = $(CALO_OBJ)/libforcalor.a |
263 |
TOF_A = $(TOF_OBJ)/libfortof.a |
264 |
TRGR_A = $(TRGR_OBJ)/libfortrigger.a |
265 |
|
266 |
FORROUEXTLIB = $(RRAW_A) $(TRAK_A) $(ACTR_A) $(CALO_A) $(TOF_A) $(TRGR_A) |
267 |
|
268 |
PHYS_A = $(PHYS_OBJ)/libdevreaders.a |
269 |
TECH_A = $(TECH_OBJ)/libtechmodel.a |
270 |
PAMOFF_A = $(PAMOFF_OBJ)/libpamoff.a |
271 |
|
272 |
EXTLIB = $(TECH_A) $(PHYS_A) $(FORROU_A) |