efaab2ef |
1 | # Top level Makefile for AliRoot System |
2 | # |
3 | # Author: Jan-Erik Revsbech (revsbech@fys.ku.dk) |
4 | # Developed on idea of Boris Polichtchouk (Boris.Polichtchouk@cern.ch), 15/4/2001 |
5 | |
6 | |
7 | ##### include general path/location macros ##### |
8 | override ALICE_ROOT=$(shell pwd) |
9 | |
15142e2f |
10 | ifdef ALIVERBOSE |
11 | MUTE:= |
12 | else |
13 | MUTE:=@ |
14 | endif |
15 | |
efaab2ef |
16 | include build/Makefile.config |
f347de98 |
17 | ################################################################## |
18 | # |
19 | # Where to install libraries and binaries |
20 | # and common header files |
efaab2ef |
21 | |
efaab2ef |
22 | LIBPATH=lib/tgt_$(ALICE_TARGET) |
23 | BINPATH=bin/tgt_$(ALICE_TARGET) |
f347de98 |
24 | EXPORTDIR = $(ALICE_ROOT)/include |
25 | ################################################################## |
efaab2ef |
26 | |
f347de98 |
27 | ################################################################## |
28 | # include machine dependent macros |
efaab2ef |
29 | |
1092afea |
30 | -include build/Makefile.$(ALICE_TARGET) |
f347de98 |
31 | ################################################################## |
32 | |
33 | ################################################################## |
34 | # |
35 | # Check if called with debug |
efaab2ef |
36 | |
efaab2ef |
37 | ifeq ($(ALIDEBUG),YES) |
38 | override ALICE_TARGET:=$(ALICE_TARGET)DEBUG |
39 | FFLAGS := -g $(filter-out -O%,$(FFLAGS)) |
40 | CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS)) |
41 | CFLAGS := -g $(filter-out -O%,$(CLAGS)) |
42 | endif |
f347de98 |
43 | ################################################################## |
efaab2ef |
44 | |
f347de98 |
45 | ################################################################## |
efaab2ef |
46 | # |
f347de98 |
47 | # Modules to build |
efaab2ef |
48 | |
896cb507 |
49 | # COMMENTED OUT FOR TEST PURPOSES |
1092afea |
50 | |
51 | ALIROOTMODULES:= STEER \ |
f347de98 |
52 | TGeant3 PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \ |
53 | CASTOR RICH START STRUCT EVGEN RALICE ALIFAST \ |
01910535 |
54 | THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN |
896cb507 |
55 | |
1092afea |
56 | CERNMODULES:= PDF PYTHIA PYTHIA6 GEANT321 MINICERN HIJING |
57 | |
1092afea |
58 | MODULES:=$(ALIROOTMODULES) $(CERNMODULES) |
896cb507 |
59 | |
f347de98 |
60 | ################################################################## |
efaab2ef |
61 | |
62 | MODULES += ALIROOT |
63 | |
64 | MODDIRS := MODULES |
f347de98 |
65 | |
66 | ############################################################# |
67 | # |
68 | # Default include dirs for |
69 | # C++, Fortran, Cint, and dependencies |
70 | # The module directory will be added by each module |
71 | # |
72 | |
f347de98 |
73 | CXXFLAGS += -I$(ALICE_ROOT)/include |
efaab2ef |
74 | CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include) |
75 | |
f347de98 |
76 | CINTFLAGS += -I$(ALICE_ROOT)/include |
efaab2ef |
77 | CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include) |
78 | |
f347de98 |
79 | DEPINC += -I$(ALICE_ROOT)/include |
efaab2ef |
80 | DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include) |
f347de98 |
81 | ############################################################# |
efaab2ef |
82 | |
83 | |
f347de98 |
84 | ############################################################# |
85 | # |
86 | # Libraries to link binaries against |
87 | # Libraries will be linked againstSHLIB |
efaab2ef |
88 | LIBS := $(ROOTLIBS) $(SYSLIBS) $(GLIBS) |
f347de98 |
89 | ############################################################# |
efaab2ef |
90 | |
91 | |
92 | # default target |
93 | default: alilibs aliroot |
94 | |
f347de98 |
95 | |
96 | ############################################################# |
97 | # |
98 | # Each module will add to this |
99 | |
15142e2f |
100 | ALLLIBS := |
101 | ALLEXECS := |
efaab2ef |
102 | INCLUDEFILES := |
15142e2f |
103 | BINLIBS := |
104 | EXPORTFILES := |
f347de98 |
105 | ############################################################# |
efaab2ef |
106 | |
15142e2f |
107 | BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH) |
1092afea |
108 | |
efaab2ef |
109 | |
110 | #Dependencies of module.mk files |
111 | |
112 | include build/module.dep |
113 | |
f347de98 |
114 | ############################################################# |
115 | # |
116 | # Check if module.mk is present for the library |
efaab2ef |
117 | %.mk: |
15142e2f |
118 | ifndef ALIQUIET |
efaab2ef |
119 | @echo "***** Creating $@ file *****"; |
15142e2f |
120 | endif |
896cb507 |
121 | @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@; |
f347de98 |
122 | ############################################################# |
123 | |
124 | # ************************************************************************** |
125 | # |
126 | # If cleaning, do not include |
127 | # dependencies or module.mk files. |
efaab2ef |
128 | |
1092afea |
129 | ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),) |
efaab2ef |
130 | |
15142e2f |
131 | # If making modules, not not include |
896cb507 |
132 | # anything |
133 | |
134 | ifneq ($(findstring modules,$(MAKECMDGOALS)),modules) |
135 | |
f347de98 |
136 | ############################################################# |
137 | # |
138 | # Include the modules |
1092afea |
139 | -include $(patsubst %,%/module.mk,$(MODULES)) |
f347de98 |
140 | ############################################################# |
efaab2ef |
141 | |
f347de98 |
142 | ############################################################# |
143 | # |
144 | # include dependencies if not making them! |
1092afea |
145 | ifneq ($(MAKECMDGOALS),depend ) |
146 | # Don't include if cleaning of any sort |
147 | ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) |
efaab2ef |
148 | include $(INCLUDEFILES) |
149 | endif |
1092afea |
150 | endif |
f347de98 |
151 | ############################################################# |
efaab2ef |
152 | |
896cb507 |
153 | endif |
efaab2ef |
154 | endif |
f347de98 |
155 | # ************************************************************************** |
156 | |
1092afea |
157 | ############################################################# |
158 | # |
159 | # include dummy dependency file |
160 | # *MUST* be last includefile |
161 | include build/dummy.d |
162 | ############################################################# |
163 | |
efaab2ef |
164 | |
165 | # targets |
166 | |
1092afea |
167 | .PHONY: alilibs aliroot makedistr clean |
168 | |
896cb507 |
169 | modules: $(patsubst %,%/module.mk,$(MODULES)) |
170 | |
1092afea |
171 | aliroot: $(BINPATH) $(ALLEXECS) alilibs bin |
efaab2ef |
172 | |
1092afea |
173 | alilibs: $(LIBPATH) $(ALLLIBS) lib modules |
efaab2ef |
174 | |
175 | # Single Makefile "distribution": Makefile + modules + mkdepend scripts |
176 | makedistr: $(MODULES) |
177 | tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \ |
178 | Makefile create build/* |
179 | |
180 | all: aliroot |
181 | |
f347de98 |
182 | depend: $(INCLUDEFILES) |
efaab2ef |
183 | |
184 | debug: |
15142e2f |
185 | ifndef ALIQUIET |
efaab2ef |
186 | @echo "***** Entering DEBUG mode. *****" |
15142e2f |
187 | endif |
efaab2ef |
188 | @(export ALIDEBUG=YES && $(MAKE) -f Makefile.flat ) |
189 | lib: |
190 | @mkdir lib |
191 | @mkdir lib/tgt_$(ALICE_TARGET) |
192 | |
193 | bin: |
194 | @mkdir bin |
195 | @mkdir bin/tgt_$(ALICE_TARGET) |
196 | |
197 | $(MODULES): |
15142e2f |
198 | ifndef ALIQUIET |
efaab2ef |
199 | @echo "***** Making $@ *****" |
15142e2f |
200 | endif |
201 | @mkdir -p $@ |
efaab2ef |
202 | |
203 | $(BINPATH): |
15142e2f |
204 | ifndef ALIQUIET |
efaab2ef |
205 | @echo "***** Making $@ *****" |
15142e2f |
206 | endif |
207 | @mkdir -p $@ |
efaab2ef |
208 | |
209 | $(LIBPATH): |
15142e2f |
210 | ifndef ALIQUIET |
efaab2ef |
211 | @echo "***** Making $@ *****" |
15142e2f |
212 | endif |
213 | @mkdir -p $@ |
efaab2ef |
214 | |
1092afea |
215 | build/dummy.d: $(EXPORTFILES) |
216 | @(if [ ! -f $@ ] ; then \ |
217 | touch $@; \ |
218 | fi) |
219 | |
220 | clean: |
15142e2f |
221 | @echo "***** No targen clean, use one of these *****" |
1092afea |
222 | @echo " clean-aliroot : Clean up all aliroot libraries" |
223 | @echo " clean-MODULENAME : Clean everything from module MODULENAME" |
224 | @echo " clean-all : Cleans up everything, including cern libraires" |
225 | @echo " clean-modules : Clean all module.mk file in all modules" |
226 | @echo " clean-libs : Clean all libraries (not object files)" |
227 | @echo "********************************************" |
228 | |
15142e2f |
229 | clean-all: clean-modules clean-libs clean-bins |
230 | ifndef ALIQUIET |
efaab2ef |
231 | @echo "***** Cleaning up everything ****" |
15142e2f |
232 | endif |
233 | $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES)) |
234 | $(MUTE)rm -rf $(EXPORTDIR) |
efaab2ef |
235 | |
1092afea |
236 | #This cleans only libraries that are not CERN-libraries |
237 | |
238 | clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES)) |
efaab2ef |
239 | |
896cb507 |
240 | clean-dicts: |
15142e2f |
241 | ifndef ALIQUIET |
f347de98 |
242 | @echo "***** Cleaning up G__ files *****" |
15142e2f |
243 | endif |
244 | $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__* |
245 | |
efaab2ef |
246 | clean-modules: |
15142e2f |
247 | ifndef ALIQUIET |
efaab2ef |
248 | @echo "***** Cleaning up module.mk files *****" |
15142e2f |
249 | endif |
250 | $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES)) |
efaab2ef |
251 | |
252 | clean-depend: |
15142e2f |
253 | ifndef ALIQUIET |
efaab2ef |
254 | @echo "***** Cleaning up dependencies *****" |
15142e2f |
255 | endif |
256 | $(MUTE)echo rm `find . -name "*.d"` |
efaab2ef |
257 | |
258 | clean-objects: |
15142e2f |
259 | ifndef ALIQUIET |
efaab2ef |
260 | @echo "***** Cleaning up .o files *****" |
15142e2f |
261 | endif |
262 | $(MUTE)echo rm `find . -name "*.o"` |
efaab2ef |
263 | |
264 | clean-libs: |
15142e2f |
265 | ifndef ALIQUIET |
efaab2ef |
266 | @echo "***** Cleaning up library files *****" |
15142e2f |
267 | endif |
268 | $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/* |
efaab2ef |
269 | |
270 | clean-bins: |
15142e2f |
271 | ifndef ALIQUIET |
efaab2ef |
272 | @echo "***** Cleaning up binary files *****" |
15142e2f |
273 | endif |
274 | $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET) |