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 |
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 |
$(F77) -M $(FFLAGS) $< 2>/dev/null\ |
106 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
107 |
|
108 |
$(OBJDIR)/.%.d: %.for |
109 |
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 |
|
115 |
$(OBJDIR)/.%.d: %.c |
116 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
117 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
118 |
echo "generating depend infos for $< into $@"; \ |
119 |
$(CC) -M $(CFLAGS) $< 2>/dev/null\ |
120 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
121 |
|
122 |
$(OBJDIR)/.%.d: %.cpp |
123 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
124 |
if [ ! -d $(OBJDIR)/$$(/usr/bin/dirname $<) ]; then mkdir -p $(OBJDIR)/$$(/usr/bin/dirname $<) $(OBJDIR)/.$$(/usr/bin/dirname $<) ;fi; \ |
125 |
echo "generating depend infos for $< into $@"; \ |
126 |
$(CXX) -M $(CFLAGS) $< 2>/dev/null\ |
127 |
| sed -e 's%$*.o%$(OBJDIR)/$*.o%g' > $(OBJDIR)/.$*.d |
128 |
|
129 |
$(OBJDIR)/%.o: %.for |
130 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
131 |
$(F77) -c $(FFLAGS) -o $@ $< |
132 |
|
133 |
$(OBJDIR)/%.o: %.f |
134 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
135 |
$(F77) -c $(FFLAGS) -o $@ $< |
136 |
|
137 |
$(OBJDIR)/%.o: %.c |
138 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
139 |
$(CC) -c $(CFLAGS) -o $@ $< |
140 |
|
141 |
$(OBJDIR)/%.o: %.cpp |
142 |
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi; \ |
143 |
$(CXX) -c $(CFLAGS) -o $@ $< |
144 |
|
145 |
|
146 |
#------------------------------------------------------------------------------ |
147 |
# General directory structure, includes, objects |
148 |
#------------------------------------------------------------------------------ |
149 |
|
150 |
PAMOFF_DIR = $(BASEDIR)/PamOffLineSW |
151 |
EVENT_DIR = $(BASEDIR)/event |
152 |
|
153 |
FORROU_DIR = $(PAMOFF_DIR)/forroutines |
154 |
TRAK_DIR = $(FORROU_DIR)/tracker |
155 |
RRAW_DIR = $(TRAK_DIR)/readraw |
156 |
ACTR_DIR = $(FORROU_DIR)/anticounter |
157 |
CALO_DIR = $(FORROU_DIR)/calorimeter |
158 |
TOF_DIR = $(FORROU_DIR)/tof |
159 |
TRGR_DIR = $(FORROU_DIR)/trigger |
160 |
|
161 |
FORROUEXTDIR = $(TRAK_DIR) $(RRAW_DIR) $(ACTR_DIR) $(CALO_DIR) $(TOF_DIR) $(TRGR_DIR) |
162 |
|
163 |
PHYS_DIR = $(PAMOFF_DIR)/physics |
164 |
TECH_DIR = $(PAMOFF_DIR)/techmodel |
165 |
|
166 |
EXTDIR = $(PHYS_DIR) $(TECH_DIR) $(FORROU_DIR) |
167 |
|
168 |
#------------------------------------------------------------------------------ |
169 |
|
170 |
ROOT_DIR_INC = $(ROOT_DIR)/include |
171 |
|
172 |
FORROU_DIR_INC = $(FORROU_DIR)/include |
173 |
RRAW_DIR_INC = $(RRAW_DIR)/include |
174 |
TRAK_DIR_INC = $(TRAK_DIR)/include |
175 |
ACTR_DIR_INC = $(ACTR_DIR)/include |
176 |
CALO_DIR_INC = $(CALO_DIR)/include |
177 |
TOF_DIR_INC = $(TOF_DIR)/include |
178 |
TRGR_DIR_INC = $(TRGR_DIR)/include |
179 |
|
180 |
PHYS_DIR_INC = $(PHYS_DIR)/include |
181 |
TECH_DIR_INC = $(TECH_DIR)/include |
182 |
|
183 |
#------------------------------------------------------------------------------ |
184 |
|
185 |
FORROU_OBJ = $(FORROU_DIR)/$(OBJDIR) |
186 |
RRAW_OBJ = $(RRAW_DIR)/$(OBJDIR) |
187 |
TRAK_OBJ = $(TRAK_DIR)/$(OBJDIR) |
188 |
ACTR_OBJ = $(ACTR_DIR)/$(OBJDIR) |
189 |
CALO_OBJ = $(CALO_DIR)/$(OBJDIR) |
190 |
TOF_OBJ = $(TOF_DIR)/$(OBJDIR) |
191 |
TRGR_OBJ = $(TRGR_DIR)/$(OBJDIR) |
192 |
|
193 |
PHYS_OBJ = $(PHYS_DIR)/$(OBJDIR) |
194 |
TECH_OBJ = $(TECH_DIR)/$(OBJDIR) |
195 |
PAMOFF_OBJ = $(PAMOFF_DIR)/$(OBJDIR) |
196 |
|
197 |
|
198 |
#------------------------------------------------------------------------------ |
199 |
# Built libraries |
200 |
#------------------------------------------------------------------------------ |
201 |
|
202 |
FORROU_A = $(FORROU_OBJ)/libforrou.a |
203 |
FORROUINT_A = $(FORROU_OBJ)/libforrouinternal.a |
204 |
RRAW_A = $(RRAW_OBJ)/libforreadraw.a |
205 |
TRAK_A = $(RRAW_OBJ)/libfortracker.a |
206 |
ACTR_A = $(ACTR_OBJ)/libanticounter.a |
207 |
CALO_A = $(CALO_OBJ)/libforcalor.a |
208 |
TOF_A = $(TOF_OBJ)/libfortof.a |
209 |
TRGR_A = $(TRGR_OBJ)/libfortrigger.a |
210 |
|
211 |
FORROUEXTLIB = $(RRAW_A) $(TRAK_A) $(ACTR_A) $(CALO_A) $(TOF_A) $(TRGR_A) |
212 |
|
213 |
PHYS_A = $(PHYS_OBJ)/libdevreaders.a |
214 |
TECH_A = $(TECH_OBJ)/libtechmodel.a |
215 |
PAMOFF_A = $(PAMOFF_OBJ)/libpamoff.a |
216 |
|
217 |
EXTLIB = $(TECH_A) $(PHYS_A) $(FORROU_A) |