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