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 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
96 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
97 |
echo "generating depend infos for $< into $@"; \ |
98 |
$(CC) -M $(CFLAGS) $< 2>/dev/null\ |
99 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
100 |
|
101 |
$(OBJDIR)/.%.d: %.cpp |
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 |
$(CXX) -M $(CFLAGS) $< 2>/dev/null\ |
106 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
107 |
|
108 |
$(OBJDIR)/%.o: %.c |
109 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
110 |
$(CC) -c $(CFLAGS) -o $@ $< |
111 |
|
112 |
$(OBJDIR)/%.o: %.cpp |
113 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
114 |
$(CXX) -c $(CFLAGS) -o $@ $< |
115 |
|
116 |
|
117 |
#------------------------------------------------------------------------------ |
118 |
# General directory structure, includes, objects |
119 |
#------------------------------------------------------------------------------ |
120 |
|
121 |
EVENT_DIR = $(BASEDIR)/event |
122 |
|
123 |
LOG_DIR = $(EVENT_DIR)/log |
124 |
MCMD_DIR = $(EVENT_DIR)/mcmd |
125 |
TMTC_DIR = $(EVENT_DIR)/tmtc |
126 |
PHYS_DIR = $(EVENT_DIR)/physics |
127 |
ACTR_DIR = $(PHYS_DIR)/anticounter |
128 |
CALO_DIR = $(PHYS_DIR)/calorimeter |
129 |
TRAK_DIR = $(PHYS_DIR)/tracker |
130 |
NDTC_DIR = $(PHYS_DIR)/neutronDetector |
131 |
S4_DIR = $(PHYS_DIR)/S4 |
132 |
TOF_DIR = $(PHYS_DIR)/tof |
133 |
TRGR_DIR = $(PHYS_DIR)/trigger |
134 |
ARRD_DIR = $(EVENT_DIR)/arrDump |
135 |
TABD_DIR = $(EVENT_DIR)/tabDump |
136 |
VARD_DIR = $(EVENT_DIR)/varDump |
137 |
TSBT_DIR = $(EVENT_DIR)/tsbt |
138 |
TSBB_DIR = $(EVENT_DIR)/tsbb |
139 |
ENDR_DIR = $(EVENT_DIR)/endrun |
140 |
EVNT_DIR = $(EVENT_DIR) |
141 |
PHYSEXTDIR = $(ACTR_DIR) $(CALO_DIR) $(TRAK_DIR) $(NDTC_DIR) $(S4_DIR) $(TOF_DIR) $(TRGR_DIR) |
142 |
EXTDIR = $(LOG_DIR) $(MCMD_DIR) $(TMTC_DIR) $(PHYSEXTDIR) $(ARRD_DIR) $(TABD_DIR) $(VARD_DIR) $(TSBT_DIR) $(TSBB_DIR) $(ENDR_DIR) |
143 |
|
144 |
#------------------------------------------------------------------------------ |
145 |
|
146 |
ROOT_DIR_INC = $(ROOT_DIR)/include |
147 |
|
148 |
LOG_DIR_INC = $(LOG_DIR)/include |
149 |
MCMD_DIR_INC = $(MCMD_DIR)/include |
150 |
TMTC_DIR_INC = $(TMTC_DIR)/include |
151 |
|
152 |
ACTR_DIR_INC = $(ACTR_DIR)/include |
153 |
CALO_DIR_INC = $(CALO_DIR)/include |
154 |
TRAK_DIR_INC = $(TRAK_DIR)/include |
155 |
NDTC_DIR_INC = $(NDTC_DIR)/include |
156 |
S4_DIR_INC = $(S4_DIR)/include |
157 |
TOF_DIR_INC = $(TOF_DIR)/include |
158 |
TRGR_DIR_INC = $(TRGR_DIR)/include |
159 |
ARRD_DIR_INC = $(ARRD_DIR)/include |
160 |
TABD_DIR_INC = $(TABD_DIR)/include |
161 |
VARD_DIR_INC = $(VARD_DIR)/include |
162 |
TSBT_DIR_INC = $(TSBT_DIR)/include |
163 |
TSBB_DIR_INC = $(TSBB_DIR)/include |
164 |
ENDR_DIR_INC = $(ENDR_DIR)/include |
165 |
EVNT_DIR_INC = $(EVNT_DIR)/include |
166 |
|
167 |
#------------------------------------------------------------------------------ |
168 |
|
169 |
LOG_OBJ = $(LOG_DIR)/$(OBJDIR) |
170 |
MCMD_OBJ = $(MCMD_DIR)/$(OBJDIR) |
171 |
TMTC_OBJ = $(TMTC_DIR)/$(OBJDIR) |
172 |
ACTR_OBJ = $(ACTR_DIR)/$(OBJDIR) |
173 |
CALO_OBJ = $(CALO_DIR)/$(OBJDIR) |
174 |
TRAK_OBJ = $(TRAK_DIR)/$(OBJDIR) |
175 |
NDTC_OBJ = $(NDTC_DIR)/$(OBJDIR) |
176 |
S4_OBJ = $(S4_DIR)/$(OBJDIR) |
177 |
TOF_OBJ = $(TOF_DIR)/$(OBJDIR) |
178 |
TRGR_OBJ = $(TRGR_DIR)/$(OBJDIR) |
179 |
ARRD_OBJ = $(ARRD_DIR)/$(OBJDIR) |
180 |
TABD_OBJ = $(TABD_DIR)/$(OBJDIR) |
181 |
VARD_OBJ = $(VARD_DIR)/$(OBJDIR) |
182 |
TSBT_OBJ = $(TSBT_DIR)/$(OBJDIR) |
183 |
TSBB_OBJ = $(TSBB_DIR)/$(OBJDIR) |
184 |
ENDR_OBJ = $(ENDR_DIR)/$(OBJDIR) |
185 |
EVNT_OBJ = $(EVNT_DIR)/$(OBJDIR) |
186 |
|
187 |
#------------------------------------------------------------------------------ |
188 |
# Built libraries |
189 |
#------------------------------------------------------------------------------ |
190 |
|
191 |
LOG_A = $(LOG_OBJ)/liblogevent.a |
192 |
MCMD_A = $(MCMD_OBJ)/libmcmdevent.a |
193 |
TMTC_A = $(TMTC_OBJ)/libtmtcevent.a |
194 |
ACTR_A = $(ACTR_OBJ)/libanticounterevent.a |
195 |
CALO_A = $(CALO_OBJ)/libcalorimeter.a |
196 |
TRAK_A = $(TRAK_OBJ)/libtrackerevent.a |
197 |
NDTC_A = $(NDTC_OBJ)/libneutronevent.a |
198 |
S4_A = $(S4_OBJ)/libs4event.a |
199 |
TOF_A = $(TOF_OBJ)/libtofevent.a |
200 |
TRGR_A = $(TRGR_OBJ)/libtriggerevent.a |
201 |
ARRD_A = $(ARRD_OBJ)/libarrdumpevent.a |
202 |
TABD_A = $(TABD_OBJ)/libtabdumpevent.a |
203 |
VARD_A = $(VARD_OBJ)/libvardumpevent.a |
204 |
TSBT_A = $(TSBT_OBJ)/libtsbtevent.a |
205 |
TSBB_A = $(TSBB_OBJ)/libtsbbevent.a |
206 |
ENDR_A = $(ENDR_OBJ)/libendrunevent.a |
207 |
EVNT_A = $(EVNT_OBJ)/libevntevent.a |
208 |
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) |