]>
Commit | Line | Data |
---|---|---|
062a1403 | 1 | # -*- mode: makefile -*- |
2 | # | |
3 | # Makefile containing platform dependencies for ROOT based projects. | |
4 | # | |
5 | # Copyright (c) 2000 Rene Brun and Fons Rademakers | |
6 | # | |
7 | # Author: Fons Rademakers, 29/2/2000 | |
8 | ||
9 | ROOTCONFIG := root-config | |
10 | ||
11 | ARCH := $(shell $(ROOTCONFIG) --arch) | |
12 | PLATFORM := $(shell $(ROOTCONFIG) --platform) | |
13 | ||
14 | CXX = | |
15 | ObjSuf = o | |
16 | SrcSuf = cxx | |
17 | ExeSuf = | |
18 | DllSuf = so | |
19 | OutPutOpt = -o # keep whitespace after "-o" | |
20 | ||
21 | ifeq (debug,$(findstring debug,$(ROOTBUILD))) | |
22 | OPT = -g | |
23 | OPT2 = -g | |
24 | else | |
25 | ifneq ($(findstring debug, $(strip $(shell $(ROOTCONFIG) --config))),) | |
26 | OPT = -g | |
27 | OPT2 = -g | |
28 | else | |
29 | OPT = -O | |
30 | OPT2 = -O2 | |
31 | endif | |
32 | endif | |
33 | ||
34 | ROOTCFLAGS := $(shell $(ROOTCONFIG) --cflags) | |
35 | ROOTLDFLAGS := $(shell $(ROOTCONFIG) --ldflags) | |
36 | ROOTLIBS := $(shell $(ROOTCONFIG) --libs) | |
37 | ROOTGLIBS := $(shell $(ROOTCONFIG) --glibs) | |
38 | HASTHREAD := $(shell $(ROOTCONFIG) --has-thread) | |
39 | ||
40 | ifeq ($(ARCH),hpuxacc) | |
41 | # HP-UX 10.x with aCC | |
42 | CXX = aCC | |
43 | CXXFLAGS = $(OPT) +Z | |
44 | LD = aCC | |
45 | LDFLAGS = $(OPT) -z | |
46 | SOFLAGS = -b | |
47 | endif | |
48 | ||
49 | ifeq ($(ARCH),hpuxia64acc) | |
50 | # HP-UX 11i 1.5 (IA-64) with aCC | |
51 | CXX = aCC | |
52 | CXXFLAGS = +DD64 $(OPT) +Z | |
53 | LD = aCC | |
54 | LDFLAGS = +DD64 $(OPT) -z | |
55 | SOFLAGS = -b | |
56 | endif | |
57 | ||
58 | ifeq ($(ARCH),hpuxgcc) | |
59 | # HP-UX 10.x with g++ | |
60 | CXXFLAGS = $(OPT) -fPIC | |
61 | CXX = g++ | |
62 | LD = g++ | |
63 | LDFLAGS = $(OPT) | |
64 | SOFLAGS = -fPIC -shared | |
65 | endif | |
66 | ||
67 | ifeq ($(ARCH),hurddeb) | |
68 | # GNU/Hurd | |
69 | CXX = g++ | |
70 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
71 | LD = g++ | |
72 | LDFLAGS = $(OPT2) | |
73 | SOFLAGS = -shared | |
74 | endif | |
75 | ||
76 | ifeq ($(ARCH),aix) | |
77 | # IBM AIX xlC 4.x | |
78 | CXX = xlC | |
79 | CXXFLAGS = $(OPT) | |
80 | LD = xlC | |
81 | LDFLAGS = $(OPT) | |
82 | SOFLAGS = | |
83 | DllSuf = a | |
84 | endif | |
85 | ||
86 | ifeq ($(ARCH),aix5) | |
87 | # IBM AIX xlC 5.x | |
88 | CXX = xlC | |
89 | CXXFLAGS = $(OPT) | |
90 | LD = xlC | |
91 | LDFLAGS = $(OPT) | |
92 | SOFLAGS = | |
93 | DllSuf = a | |
94 | endif | |
95 | ||
96 | ifeq ($(ARCH),aixgcc) | |
97 | # IBM AIX with GCC | |
98 | CXX = g++ | |
99 | CXXFLAGS = $(OPT) | |
100 | LD = g++ | |
101 | LDFLAGS = $(OPT) | |
102 | SOFLAGS = -shared | |
103 | DllSuf = a | |
104 | EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS) | |
105 | endif | |
106 | ||
107 | ifeq ($(ARCH),solaris) | |
108 | # Solaris CC | |
109 | CXX = /opt/SUNWspro/bin/CC | |
110 | CXXFLAGS = $(OPT) -KPIC | |
111 | LD = /opt/SUNWspro/bin/CC | |
112 | LDFLAGS = $(OPT) | |
113 | SOFLAGS = -G | |
114 | endif | |
115 | ||
116 | ifeq ($(ARCH),solarisCC5) | |
117 | # Solaris CC 5.0 | |
118 | CXX = CC | |
119 | CXXFLAGS = $(OPT) -KPIC | |
120 | LD = CC | |
121 | LDFLAGS = $(OPT) | |
122 | SOFLAGS = -G | |
123 | endif | |
124 | ||
125 | ifeq ($(ARCH),solarisgcc) | |
126 | # Solaris gcc | |
127 | CXX = g++ | |
128 | CXXFLAGS = $(OPT) -fPIC | |
129 | LD = g++ | |
130 | LDFLAGS = $(OPT) | |
131 | SOFLAGS = -shared | |
132 | endif | |
133 | ||
134 | ifeq ($(ARCH),solariskcc) | |
135 | # Solaris kcc | |
136 | CXX = KCC --one_instantiation_per_object | |
137 | CXXFLAGS = -O4 -KPIC | |
138 | LD = KCC | |
139 | LDFLAGS = -O4 | |
140 | SOFLAGS = | |
141 | endif | |
142 | ||
143 | ifeq ($(ARCH),solarisx86) | |
144 | # Solaris CC on Intel | |
145 | CXX = CC | |
146 | CXXFLAGS = $(OPT) -KPIC | |
147 | LD = CC | |
148 | LDFLAGS = $(OPT) | |
149 | SOFLAGS = -G | |
150 | endif | |
151 | ||
152 | ifeq ($(ARCH),sgicc) | |
153 | # SGI | |
154 | CXX = CC -n32 -I/usr/include/CC.sgi | |
155 | CXXFLAGS = $(OPT) | |
156 | LD = CC -n32 -LANG:std -I/usr/include/CC.sgi | |
157 | LDFLAGS = $(OPT) | |
158 | SOFLAGS = -shared | |
159 | endif | |
160 | ||
161 | ifeq ($(ARCH),sgicc64) | |
162 | # SGI | |
163 | CXX = CC -64 -I/usr/include/CC.sgi | |
164 | CXXFLAGS = $(OPT) | |
165 | LD = CC -64 -LANG:std -I/usr/include/CC.sgi | |
166 | LDFLAGS = $(OPT) | |
167 | SOFLAGS = -shared | |
168 | endif | |
169 | ||
170 | ifeq ($(ARCH),sgigcc) | |
171 | # SGI 6.x with gcc | |
172 | CXX = g++ | |
173 | CXXFLAGS = $(OPT) -Wall -fPIC | |
174 | LD = g++ | |
175 | LDFLAGS = $(OPT) -Wl,-u,__builtin_new -Wl,-u,__builtin_delete -Wl,-u,__nw__FUiPv | |
176 | SOFLAGS = -shared | |
177 | endif | |
178 | ||
179 | ifeq ($(ARCH),sgin32gcc) | |
180 | # SGI 6.x with gcc for n32 ABI | |
181 | CXX = g++ | |
182 | CXXFLAGS = $(OPT) -Wall -fPIC | |
183 | LD = g++ | |
184 | LDFLAGS = $(OPT) -L/usr/lib32 -Wl,-woff,134 -lgen | |
185 | SOFLAGS = -shared | |
186 | endif | |
187 | ||
188 | ifeq ($(ARCH),sgikcc) | |
189 | # SGI with KCC | |
190 | CXX = KCC -n32 --one_instantiation_per_object | |
191 | CXXFLAGS = $(OPT) | |
192 | LD = KCC -n32 | |
193 | LDFLAGS = $(OPT) | |
194 | SOFLAGS = | |
195 | endif | |
196 | ||
197 | ifeq ($(ARCH),alphagcc) | |
198 | # Alpha/OSF with gcc | |
199 | CXX = g++ | |
200 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
201 | LD = g++ | |
202 | LDFLAGS = $(OPT2) | |
203 | SOFLAGS = -Wl,-expect_unresolved,* -shared | |
204 | endif | |
205 | ||
206 | ifeq ($(ARCH),alphakcc) | |
207 | # Alpha/OSF with kai compiler (not yet valid) | |
208 | CXX = KCC --one_instantiation_per_object | |
209 | CXXFLAGS = $(OPT) -fPIC | |
210 | LD = KCC | |
211 | LDFLAGS = $(OPT) | |
212 | SOFLAGS = -Wl,-expect_unresolved,* -shared | |
213 | endif | |
214 | ||
215 | ifeq ($(ARCH),alphacxx6) | |
216 | # Alpha/OSF with cxx6 | |
217 | CXX = cxx | |
218 | CXXFLAGS = $(OPT) | |
219 | LD = cxx | |
220 | LDFLAGS = $(OPT) | |
221 | SOFLAGS = -shared -nocxxstd -Wl,-expect_unresolved,*,-msym | |
222 | endif | |
223 | ||
224 | ifeq ($(ARCH),linuxdeb2ppc) | |
225 | # Debian/Linux on the PowerPC | |
226 | CXX = g++ | |
227 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
228 | LD = g++ | |
229 | LDFLAGS = $(OPT2) | |
230 | SOFLAGS = -shared | |
231 | endif | |
232 | ||
233 | ifeq ($(ARCH),linux) | |
234 | # Linux with egcs, gcc 2.9x, gcc 3.x | |
235 | CXX = g++ | |
236 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
237 | LD = g++ | |
238 | LDFLAGS = $(OPT2) | |
239 | SOFLAGS = -shared | |
240 | endif | |
241 | ||
242 | ifeq ($(ARCH),linuxkcc) | |
243 | # Linux with the KAI compiler | |
244 | CXX = KCC --one_instantiation_per_object | |
245 | CXXFLAGS = $(OPT) -fPIC +K0 | |
246 | LD = KCC | |
247 | LDFLAGS = $(OPT) $(shell $(ROOTCONFIG) --cflags) | |
248 | SOFLAGS = | |
249 | endif | |
250 | ||
251 | ifeq ($(ARCH),linuxicc) | |
252 | # Linux with Intel icc compiler | |
253 | ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ | |
254 | cut -d'.' -f1) | |
255 | ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ | |
256 | cut -d'.' -f2) | |
257 | CXX = icc | |
258 | CXXFLAGS = $(OPT) -fPIC -wd1476 | |
259 | LD = icpc | |
260 | LDFLAGS = $(OPT) | |
261 | SOFLAGS = -shared | |
262 | endif | |
263 | ||
264 | ifeq ($(ARCH),linuxppcgcc) | |
265 | # PPC Linux with gcc and glibc | |
266 | CXX = g++ | |
267 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
268 | LD = g++ | |
269 | LDFLAGS = $(OPT2) | |
270 | SOFLAGS = -shared | |
271 | endif | |
272 | ||
273 | ifeq ($(ARCH),linuxia64gcc) | |
274 | # Itanium Linux with gcc 2.9x | |
275 | CXX = g++ | |
276 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
277 | LD = g++ | |
278 | LDFLAGS = $(OPT2) | |
279 | SOFLAGS = -shared | |
280 | endif | |
281 | ||
282 | ifeq ($(ARCH),linuxia64sgi) | |
283 | # Itanium Linux with sgiCC | |
284 | CXX = sgiCC | |
285 | CXXFLAGS = $(OPT) -Wall -fPIC | |
286 | LD = gsgiCC | |
287 | LDFLAGS = $(OPT) | |
288 | SOFLAGS = -shared | |
289 | endif | |
290 | ||
291 | ifeq ($(ARCH),linuxia64ecc) | |
292 | # Itanium Linux with Intel icc (was ecc) | |
293 | ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ | |
294 | cut -d'.' -f1) | |
295 | ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ | |
296 | cut -d'.' -f2) | |
297 | CXX = icc | |
298 | CXXFLAGS = $(OPT) -fPIC -wd1476 | |
299 | LD = icpc | |
300 | LDFLAGS = $(OPT) | |
301 | SOFLAGS = -shared | |
302 | endif | |
303 | ||
304 | ifeq ($(ARCH),linuxx8664gcc) | |
305 | # AMD Opteron and Intel EM64T (64 bit mode) Linux with gcc 3.x | |
306 | CXX = g++ | |
307 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
308 | LD = g++ | |
309 | LDFLAGS = $(OPT2) | |
310 | SOFLAGS = -shared | |
311 | endif | |
312 | ||
313 | ifeq ($(ARCH),linuxppc64gcc) | |
314 | # PPC64 Linux with gcc 3.x | |
315 | CXX = g++ | |
316 | CXXFLAGS = $(OPT) -Wall -fPIC | |
317 | LD = g++ | |
318 | LDFLAGS = $(OPT) | |
319 | SOFLAGS = -shared | |
320 | endif | |
321 | ||
322 | ifeq ($(ARCH),linuxx8664icc) | |
323 | # AMD Opteron and Intel EM64T (64 bit mode) Linux with Intel icc compiler | |
324 | CXX = icc | |
325 | CXXFLAGS = $(OPT) -fPIC -wd1476 -wd1572 | |
326 | LD = icpc | |
327 | LDFLAGS = $(OPT) | |
328 | SOFLAGS = -shared | |
329 | endif | |
330 | ||
331 | ifeq ($(ARCH),linuxalphagcc) | |
332 | # Alpha Linux with gcc | |
333 | CXX = g++ | |
334 | CXXFLAGS = $(OPT2) -Wall -fPIC | |
335 | LD = g++ | |
336 | LDFLAGS = $(OPT2) | |
337 | SOFLAGS = -shared | |
338 | endif | |
339 | ||
340 | ifeq ($(ARCH),linuxarm) | |
341 | # ARM Linux with egcs | |
342 | CXX = g++ | |
343 | CXXFLAGS = $(OPT) -Wall -fPIC | |
344 | LD = g++ | |
345 | LDFLAGS = $(OPT) | |
346 | SOFLAGS = -shared | |
347 | endif | |
348 | ||
349 | ifeq ($(ARCH),freebsd4) | |
350 | # FreeBSD with glibc | |
351 | CXX = g++ | |
352 | CXXFLAGS = $(OPT) -W -Wall -fPIC | |
353 | LD = $(CXX) | |
354 | LDFLAGS = $(OPT) | |
355 | SOFLAGS = -shared -Wl,-x | |
356 | endif | |
357 | ||
358 | ifeq ($(ARCH),freebsd5) | |
359 | # FreeBSD with glibc | |
360 | CXX = g++ | |
361 | CXXFLAGS = $(OPT) -W -Wall -fPIC | |
362 | LD = $(CXX) | |
363 | LDFLAGS = $(OPT) | |
364 | SOFLAGS = -shared -Wl,-x | |
365 | endif | |
366 | ||
367 | ifeq ($(ARCH),openbsd) | |
368 | # OpenBSD with libc | |
369 | CXX = g++ | |
370 | CXXFLAGS = $(OPT) -pipe -W -Wall -fPIC | |
371 | LD = g++ | |
372 | LDFLAGS = $(OPT) | |
373 | SOFLAGS = -shared -Wl,-x | |
374 | endif | |
375 | ||
376 | ifeq ($(ARCH),macosx) | |
377 | # MacOS X with cc (GNU cc 2.95.2 and gcc 3.3) | |
378 | MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) | |
379 | MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) | |
380 | ifeq ($(MACOSX_MINOR),5) | |
381 | MACOSX_MINOR = 4 | |
382 | endif | |
383 | CXX = c++ | |
384 | CXXFLAGS = $(OPT2) -pipe -Wall -W -Woverloaded-virtual | |
385 | LD = $(MACOSXTARGET) c++ | |
386 | LDFLAGS = $(OPT2) -bind_at_load | |
387 | # The SOFLAGS will be used to create the .dylib, | |
388 | # the .so will be created separately | |
389 | DllSuf = dylib | |
390 | UNDEFOPT = dynamic_lookup | |
391 | ifneq ($(MACOSX_MINOR),4) | |
392 | ifneq ($(MACOSX_MINOR),3) | |
393 | UNDEFOPT = suppress | |
394 | LD = c++ | |
395 | endif | |
396 | endif | |
397 | SOFLAGS = -dynamiclib -single_module -undefined $(UNDEFOPT) | |
398 | endif | |
399 | ||
400 | ifeq ($(ARCH),macosxicc) | |
401 | # MacOS X with Intel icc compiler | |
402 | MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) | |
403 | MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) | |
404 | ifeq ($(MACOSX_MINOR),5) | |
405 | MACOSX_MINOR = 4 | |
406 | endif | |
407 | CXX = icc | |
408 | CXXFLAGS = $(OPT) -fPIC -wd1476 | |
409 | LD = $(MACOSXTARGET) icpc | |
410 | LDFLAGS = $(OPT) | |
411 | # The SOFLAGS will be used to create the .dylib, | |
412 | # the .so will be created separately | |
413 | DllSuf = dylib | |
414 | SOFLAGS = -dynamiclib -single_module -undefined dynamic_lookup | |
415 | endif | |
416 | ||
417 | ifeq ($(ARCH),macosx64) | |
418 | # MacOS X >= 10.4 with gcc 64 bit mode (GNU gcc 4.*) | |
419 | # Only specific option (-m64) comes from root-config | |
420 | MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) | |
421 | MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) | |
422 | ifeq ($(MACOSX_MINOR),5) | |
423 | MACOSX_MINOR = 4 | |
424 | endif | |
425 | CXX = c++ | |
426 | CXXFLAGS = $(OPT2) -pipe -Wall -W -Woverloaded-virtual | |
427 | LD = $(MACOSXTARGET) c++ -m64 | |
428 | LDFLAGS = $(OPT2) -bind_at_load | |
429 | # The SOFLAGS will be used to create the .dylib, | |
430 | # the .so will be created separately | |
431 | DllSuf = dylib | |
432 | SOFLAGS = -m64 -dynamiclib -single_module -undefined dynamic_lookup | |
433 | endif | |
434 | ||
435 | ifeq ($(ARCH),macosxxlc) | |
436 | # MacOS X with IBM xlC compiler | |
437 | MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) | |
438 | MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) | |
439 | ifeq ($(MACOSX_MINOR),5) | |
440 | MACOSX_MINOR = 4 | |
441 | endif | |
442 | CXX = xlC | |
443 | CXXFLAGS = $(OPT) | |
444 | LD = $(MACOSXTARGET) xlC | |
445 | LDFLAGS = $(OPT) -Wl,-bind_at_load | |
446 | # The SOFLAGS will be used to create the .dylib, | |
447 | # the .so will be created separately | |
448 | DllSuf = dylib | |
449 | UNDEFOPT = dynamic_lookup | |
450 | ifneq ($(MACOSX_MINOR),4) | |
451 | ifneq ($(MACOSX_MINOR),3) | |
452 | UNDEFOPT = suppress | |
453 | LD = xlC | |
454 | endif | |
455 | endif | |
456 | SOFLAGS = -qmkshrobj -single_module -undefined $(UNDEFOPT) | |
457 | endif | |
458 | ||
459 | ifeq ($(ARCH),win32) | |
460 | # Windows with the VC++ compiler | |
461 | VC_MAJOR := $(shell unset VS_UNICODE_OUTPUT; cl.exe 2>&1 | awk '{ if (NR==1) print $$8 }' | \ | |
462 | cut -d'.' -f1) | |
463 | ObjSuf = obj | |
464 | SrcSuf = cxx | |
465 | ExeSuf = .exe | |
466 | DllSuf = dll | |
467 | OutPutOpt = -out: | |
468 | CXX = cl | |
469 | ifeq (debug,$(findstring debug,$(ROOTBUILD))) | |
470 | CXXOPT = -Z7 | |
471 | LDOPT = -debug | |
472 | else | |
473 | ifneq ($(findstring debug, $(strip $(shell $(ROOTCONFIG) --config))),) | |
474 | CXXOPT = -Z7 | |
475 | LDOPT = -debug | |
476 | else | |
477 | CXXOPT = -O2 | |
478 | LDOPT = -opt:ref | |
479 | endif | |
480 | endif | |
481 | CXXFLAGS = $(CXXOPT) -nologo -I$(shell $(ROOTCONFIG) --incdir) -FIw32pragma.h | |
482 | LD = link | |
483 | LDFLAGS = $(LDOPT) -nologo | |
484 | SOFLAGS = -DLL | |
485 | ||
486 | EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS) | |
487 | ifeq ($(VC_MAJOR),14) | |
488 | MT_EXE = mt -nologo -manifest $@.manifest -outputresource:$@\;1; rm -f $@.manifest | |
489 | MT_DLL = mt -nologo -manifest $@.manifest -outputresource:$@\;2; rm -f $@.manifest | |
490 | else | |
491 | MT_EXE = | |
492 | MT_DLL = | |
493 | endif | |
494 | endif | |
495 | ||
496 | ifeq ($(ARCH),win32gcc) | |
497 | # Windows with gcc | |
498 | DllSuf = dll | |
499 | ExeSuf = .exe | |
500 | CXX = g++ | |
501 | CXXFLAGS = $(OPT) -pipe -Wall -Woverloaded-virtual -I/usr/X11R6/include | |
502 | LD = g++ | |
503 | LDFLAGS = $(OPT) -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc \ | |
504 | -L/usr/X11R6/lib | |
505 | SOFLAGS = -shared -D_DLL -Wl,--export-all-symbols | |
506 | EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS) | |
507 | endif | |
508 | ||
509 | ifeq ($(CXX),) | |
510 | $(error $(ARCH) invalid architecture) | |
511 | endif | |
512 | ||
513 | CXXFLAGS += $(ROOTCFLAGS) | |
514 | LDFLAGS += $(ROOTLDFLAGS) | |
515 | LIBS = $(ROOTLIBS) $(SYSLIBS) | |
516 | GLIBS = $(ROOTGLIBS) $(SYSLIBS) |