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 |
AR = ar |
38 |
AS = as |
39 |
CXXLD = g++ |
40 |
OC = cp |
41 |
ROOT_DIR = $(ROOTSYS) |
42 |
ROOT_LIB = $(ROOTSYS)/lib |
43 |
ROOTCINT = $(ROOTSYS)/bin/rootcint |
44 |
|
45 |
SHELL = /bin/bash |
46 |
MAKE = /usr/bin/make BASEDIR=$(BASEDIR) |
47 |
|
48 |
.PHONY : clean help var |
49 |
|
50 |
#------------------------------------------------------------------------------ |
51 |
# default compiler, assembler & linker FLAGS |
52 |
#------------------------------------------------------------------------------ |
53 |
|
54 |
|
55 |
CFLAGS += -Wall -shared |
56 |
LDFLAGS += |
57 |
|
58 |
#------------------------------------------------------------------------------ |
59 |
# optimization FLAG |
60 |
#------------------------------------------------------------------------------ |
61 |
|
62 |
OPT_FLAG = -O4 |
63 |
|
64 |
#------------------------------------------------------------------------------ |
65 |
# object's directories, FLAGS & libs extensions for release & debug version |
66 |
#------------------------------------------------------------------------------ |
67 |
|
68 |
OBJDIR_D = obj/debug |
69 |
OBJDIR_R = obj/release |
70 |
|
71 |
ifeq ("1", "$(debug)") |
72 |
CFLAGS += -g $(OPT_FLAG) -DDEBUG |
73 |
OBJDIR = obj/debug |
74 |
endif |
75 |
|
76 |
ifeq ("1", "$(release)") |
77 |
CFLAGS += $(OPT_FLAG) |
78 |
OBJDIR = obj/release |
79 |
endif |
80 |
|
81 |
#------------------------------------------------------------------------------ |
82 |
# Objects & Dependencies |
83 |
#------------------------------------------------------------------------------ |
84 |
|
85 |
OBJS = \ |
86 |
${CSRCS:%.c=$(OBJDIR)/%.o} \ |
87 |
${CXXSRCS:%.cpp=$(OBJDIR)/%.o} \ |
88 |
|
89 |
DEPEND = \ |
90 |
${CSRCS:%.c=$(OBJDIR)/.%.d} \ |
91 |
${CXXSRCS:%.cpp=$(OBJDIR)/.%.d} \ |
92 |
|
93 |
|
94 |
$(OBJDIR)/.%.d: %.c |
95 |
ifeq ($(verbose),) |
96 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
97 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
98 |
# echo "generating depend infos for $< into $@"; \ |
99 |
@$(CC) -M $(CFLAGS) $< 2>/dev/null\ |
100 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
101 |
else |
102 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
103 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
104 |
echo "generating depend infos for $< into $@"; \ |
105 |
$(CC) -M $(CFLAGS) $< 2>/dev/null\ |
106 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
107 |
endif |
108 |
|
109 |
$(OBJDIR)/.%.d: %.cpp |
110 |
ifeq ($(verbose),) |
111 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
112 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
113 |
# echo "generating depend infos for $< into $@"; \ |
114 |
@$(CXX) -M $(CFLAGS) $< 2>/dev/null\ |
115 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
116 |
else |
117 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
118 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
119 |
echo "generating depend infos for $< into $@"; \ |
120 |
$(CXX) -M $(CFLAGS) $< 2>/dev/null\ |
121 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
122 |
endif |
123 |
|
124 |
$(OBJDIR)/%.o: %.c |
125 |
ifeq ($(verbose),) |
126 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
127 |
$(CC) -c $(CFLAGS) -o $@ $< |
128 |
else |
129 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
130 |
$(CC) -c $(CFLAGS) -o $@ $< |
131 |
endif |
132 |
|
133 |
$(OBJDIR)/%.o: %.cpp |
134 |
ifeq ($(verbose),) |
135 |
@if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
136 |
$(CXX) -c $(CFLAGS) -o $@ $< |
137 |
else |
138 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
139 |
$(CXX) -c $(CFLAGS) -o $@ $< |
140 |
endif |
141 |
|
142 |
#------------------------------------------------------------------------------ |
143 |
# General directory structure, includes, objects |
144 |
#------------------------------------------------------------------------------ |
145 |
|
146 |
EVENT_DIR = $(BASEDIR)/event |
147 |
|
148 |
LOG_DIR = $(EVENT_DIR)/log |
149 |
MCMD_DIR = $(EVENT_DIR)/mcmd |
150 |
TMTC_DIR = $(EVENT_DIR)/tmtc |
151 |
PHYS_DIR = $(EVENT_DIR)/physics |
152 |
ACTR_DIR = $(PHYS_DIR)/anticounter |
153 |
CALO_DIR = $(PHYS_DIR)/calorimeter |
154 |
TRAK_DIR = $(PHYS_DIR)/tracker |
155 |
NDTC_DIR = $(PHYS_DIR)/neutronDetector |
156 |
S4_DIR = $(PHYS_DIR)/S4 |
157 |
TOF_DIR = $(PHYS_DIR)/tof |
158 |
TRGR_DIR = $(PHYS_DIR)/trigger |
159 |
ARRD_DIR = $(EVENT_DIR)/arrDump |
160 |
TABD_DIR = $(EVENT_DIR)/tabDump |
161 |
VARD_DIR = $(EVENT_DIR)/varDump |
162 |
TSBT_DIR = $(EVENT_DIR)/tsbt |
163 |
TSBB_DIR = $(EVENT_DIR)/tsbb |
164 |
ENDR_DIR = $(EVENT_DIR)/endrun |
165 |
EVNT_DIR = $(EVENT_DIR) |
166 |
PHYSEXTDIR = $(ACTR_DIR) $(CALO_DIR) $(TRAK_DIR) $(NDTC_DIR) $(S4_DIR) $(TOF_DIR) $(TRGR_DIR) |
167 |
EXTDIR = $(LOG_DIR) $(MCMD_DIR) $(TMTC_DIR) $(PHYSEXTDIR) $(ARRD_DIR) $(TABD_DIR) $(VARD_DIR) $(TSBT_DIR) $(TSBB_DIR) $(ENDR_DIR) |
168 |
|
169 |
#------------------------------------------------------------------------------ |
170 |
|
171 |
ROOT_DIR_INC = $(ROOT_DIR)/include |
172 |
|
173 |
LOG_DIR_INC = $(LOG_DIR)/include |
174 |
MCMD_DIR_INC = $(MCMD_DIR)/include |
175 |
TMTC_DIR_INC = $(TMTC_DIR)/include |
176 |
|
177 |
ACTR_DIR_INC = $(ACTR_DIR)/include |
178 |
CALO_DIR_INC = $(CALO_DIR)/include |
179 |
TRAK_DIR_INC = $(TRAK_DIR)/include |
180 |
NDTC_DIR_INC = $(NDTC_DIR)/include |
181 |
S4_DIR_INC = $(S4_DIR)/include |
182 |
TOF_DIR_INC = $(TOF_DIR)/include |
183 |
TRGR_DIR_INC = $(TRGR_DIR)/include |
184 |
ARRD_DIR_INC = $(ARRD_DIR)/include |
185 |
TABD_DIR_INC = $(TABD_DIR)/include |
186 |
VARD_DIR_INC = $(VARD_DIR)/include |
187 |
TSBT_DIR_INC = $(TSBT_DIR)/include |
188 |
TSBB_DIR_INC = $(TSBB_DIR)/include |
189 |
ENDR_DIR_INC = $(ENDR_DIR)/include |
190 |
EVNT_DIR_INC = $(EVNT_DIR)/include |
191 |
|
192 |
#------------------------------------------------------------------------------ |
193 |
|
194 |
LOG_OBJ = $(LOG_DIR)/$(OBJDIR) |
195 |
MCMD_OBJ = $(MCMD_DIR)/$(OBJDIR) |
196 |
TMTC_OBJ = $(TMTC_DIR)/$(OBJDIR) |
197 |
ACTR_OBJ = $(ACTR_DIR)/$(OBJDIR) |
198 |
CALO_OBJ = $(CALO_DIR)/$(OBJDIR) |
199 |
TRAK_OBJ = $(TRAK_DIR)/$(OBJDIR) |
200 |
NDTC_OBJ = $(NDTC_DIR)/$(OBJDIR) |
201 |
S4_OBJ = $(S4_DIR)/$(OBJDIR) |
202 |
TOF_OBJ = $(TOF_DIR)/$(OBJDIR) |
203 |
TRGR_OBJ = $(TRGR_DIR)/$(OBJDIR) |
204 |
ARRD_OBJ = $(ARRD_DIR)/$(OBJDIR) |
205 |
TABD_OBJ = $(TABD_DIR)/$(OBJDIR) |
206 |
VARD_OBJ = $(VARD_DIR)/$(OBJDIR) |
207 |
TSBT_OBJ = $(TSBT_DIR)/$(OBJDIR) |
208 |
TSBB_OBJ = $(TSBB_DIR)/$(OBJDIR) |
209 |
ENDR_OBJ = $(ENDR_DIR)/$(OBJDIR) |
210 |
EVNT_OBJ = $(EVNT_DIR)/$(OBJDIR) |
211 |
|
212 |
#------------------------------------------------------------------------------ |
213 |
# Built libraries |
214 |
#------------------------------------------------------------------------------ |
215 |
|
216 |
LOG_A = $(LOG_OBJ)/liblogevent.a |
217 |
MCMD_A = $(MCMD_OBJ)/libmcmdevent.a |
218 |
TMTC_A = $(TMTC_OBJ)/libtmtcevent.a |
219 |
ACTR_A = $(ACTR_OBJ)/libanticounterevent.a |
220 |
CALO_A = $(CALO_OBJ)/libcalorimeter.a |
221 |
TRAK_A = $(TRAK_OBJ)/libtrackerevent.a |
222 |
NDTC_A = $(NDTC_OBJ)/libneutronevent.a |
223 |
S4_A = $(S4_OBJ)/libs4event.a |
224 |
TOF_A = $(TOF_OBJ)/libtofevent.a |
225 |
TRGR_A = $(TRGR_OBJ)/libtriggerevent.a |
226 |
ARRD_A = $(ARRD_OBJ)/libarrdumpevent.a |
227 |
TABD_A = $(TABD_OBJ)/libtabdumpevent.a |
228 |
VARD_A = $(VARD_OBJ)/libvardumpevent.a |
229 |
TSBT_A = $(TSBT_OBJ)/libtsbtevent.a |
230 |
TSBB_A = $(TSBB_OBJ)/libtsbbevent.a |
231 |
ENDR_A = $(ENDR_OBJ)/libendrunevent.a |
232 |
EVNT_A = $(EVNT_OBJ)/libevntevent.a |
233 |
EXTLIB = $(LOG_A) $(MCMD_A) $(TMTC_A) $(ACTR_A) $(CALO_A) $(TRAK_A) $(NDTC_A) $(S4_A) $(TOF_A) $(TRGR_A) $(ARRD_A) $(TABD_A) $(VARD_A) $(TSBT_A) $(TSBB_A) $(ENDR_A) |