Fork me on GitHub

source: svn/trunk/Makefile.arch@ 988

Last change on this file since 988 was 982, checked in by Pavel Demin, 12 years ago

attempt to fix compilation on MacOSX

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