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