1 # -*- mode: makefile -*-
3 # Makefile containing platform dependencies for ROOT based projects.
5 # Copyright (c) 2000 Rene Brun and Fons Rademakers
7 # Author: Fons Rademakers, 29/2/2000
9 ROOTCONFIG := root-config
11 ARCH := $(shell $(ROOTCONFIG) --arch)
12 PLATFORM := $(shell $(ROOTCONFIG) --platform)
19 OutPutOpt = -o # keep whitespace after "-o"
21 ifeq (debug,$(findstring debug,$(ROOTBUILD)))
25 ifneq ($(findstring debug, $(strip $(shell $(ROOTCONFIG) --config))),)
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)
40 ifeq ($(ARCH),hpuxacc)
49 ifeq ($(ARCH),hpuxia64acc)
50 # HP-UX 11i 1.5 (IA-64) with aCC
52 CXXFLAGS = +DD64 $(OPT) +Z
54 LDFLAGS = +DD64 $(OPT) -z
58 ifeq ($(ARCH),hpuxgcc)
60 CXXFLAGS = $(OPT) -fPIC
64 SOFLAGS = -fPIC -shared
67 ifeq ($(ARCH),hurddeb)
70 CXXFLAGS = $(OPT2) -Wall -fPIC
104 EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS)
107 ifeq ($(ARCH),solaris)
109 CXX = /opt/SUNWspro/bin/CC
110 CXXFLAGS = $(OPT) -KPIC
111 LD = /opt/SUNWspro/bin/CC
116 ifeq ($(ARCH),solarisCC5)
119 CXXFLAGS = $(OPT) -KPIC
125 ifeq ($(ARCH),solarisgcc)
128 CXXFLAGS = $(OPT) -fPIC
134 ifeq ($(ARCH),solariskcc)
136 CXX = KCC --one_instantiation_per_object
143 ifeq ($(ARCH),solarisx86)
144 # Solaris CC on Intel
146 CXXFLAGS = $(OPT) -KPIC
154 CXX = CC -n32 -I/usr/include/CC.sgi
156 LD = CC -n32 -LANG:std -I/usr/include/CC.sgi
161 ifeq ($(ARCH),sgicc64)
163 CXX = CC -64 -I/usr/include/CC.sgi
165 LD = CC -64 -LANG:std -I/usr/include/CC.sgi
170 ifeq ($(ARCH),sgigcc)
173 CXXFLAGS = $(OPT) -Wall -fPIC
175 LDFLAGS = $(OPT) -Wl,-u,__builtin_new -Wl,-u,__builtin_delete -Wl,-u,__nw__FUiPv
179 ifeq ($(ARCH),sgin32gcc)
180 # SGI 6.x with gcc for n32 ABI
182 CXXFLAGS = $(OPT) -Wall -fPIC
184 LDFLAGS = $(OPT) -L/usr/lib32 -Wl,-woff,134 -lgen
188 ifeq ($(ARCH),sgikcc)
190 CXX = KCC -n32 --one_instantiation_per_object
197 ifeq ($(ARCH),alphagcc)
200 CXXFLAGS = $(OPT2) -Wall -fPIC
203 SOFLAGS = -Wl,-expect_unresolved,* -shared
206 ifeq ($(ARCH),alphakcc)
207 # Alpha/OSF with kai compiler (not yet valid)
208 CXX = KCC --one_instantiation_per_object
209 CXXFLAGS = $(OPT) -fPIC
212 SOFLAGS = -Wl,-expect_unresolved,* -shared
215 ifeq ($(ARCH),alphacxx6)
216 # Alpha/OSF with cxx6
221 SOFLAGS = -shared -nocxxstd -Wl,-expect_unresolved,*,-msym
224 ifeq ($(ARCH),linuxdeb2ppc)
225 # Debian/Linux on the PowerPC
227 CXXFLAGS = $(OPT2) -Wall -fPIC
234 # Linux with egcs, gcc 2.9x, gcc 3.x
236 CXXFLAGS = $(OPT2) -Wall -fPIC
242 ifeq ($(ARCH),linuxkcc)
243 # Linux with the KAI compiler
244 CXX = KCC --one_instantiation_per_object
245 CXXFLAGS = $(OPT) -fPIC +K0
247 LDFLAGS = $(OPT) $(shell $(ROOTCONFIG) --cflags)
251 ifeq ($(ARCH),linuxicc)
252 # Linux with Intel icc compiler
253 ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
255 ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
258 CXXFLAGS = $(OPT) -fPIC -wd1476
264 ifeq ($(ARCH),linuxppcgcc)
265 # PPC Linux with gcc and glibc
267 CXXFLAGS = $(OPT2) -Wall -fPIC
273 ifeq ($(ARCH),linuxia64gcc)
274 # Itanium Linux with gcc 2.9x
276 CXXFLAGS = $(OPT2) -Wall -fPIC
282 ifeq ($(ARCH),linuxia64sgi)
283 # Itanium Linux with sgiCC
285 CXXFLAGS = $(OPT) -Wall -fPIC
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 }' | \
295 ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
298 CXXFLAGS = $(OPT) -fPIC -wd1476
304 ifeq ($(ARCH),linuxx8664gcc)
305 # AMD Opteron and Intel EM64T (64 bit mode) Linux with gcc 3.x
307 CXXFLAGS = $(OPT2) -Wall -fPIC
313 ifeq ($(ARCH),linuxppc64gcc)
314 # PPC64 Linux with gcc 3.x
316 CXXFLAGS = $(OPT) -Wall -fPIC
322 ifeq ($(ARCH),linuxx8664icc)
323 # AMD Opteron and Intel EM64T (64 bit mode) Linux with Intel icc compiler
325 CXXFLAGS = $(OPT) -fPIC -wd1476 -wd1572
331 ifeq ($(ARCH),linuxalphagcc)
332 # Alpha Linux with gcc
334 CXXFLAGS = $(OPT2) -Wall -fPIC
340 ifeq ($(ARCH),linuxarm)
341 # ARM Linux with egcs
343 CXXFLAGS = $(OPT) -Wall -fPIC
349 ifeq ($(ARCH),freebsd4)
352 CXXFLAGS = $(OPT) -W -Wall -fPIC
355 SOFLAGS = -shared -Wl,-x
358 ifeq ($(ARCH),freebsd5)
361 CXXFLAGS = $(OPT) -W -Wall -fPIC
364 SOFLAGS = -shared -Wl,-x
367 ifeq ($(ARCH),openbsd)
370 CXXFLAGS = $(OPT) -pipe -W -Wall -fPIC
373 SOFLAGS = -shared -Wl,-x
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)
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
390 UNDEFOPT = dynamic_lookup
391 ifneq ($(MACOSX_MINOR),4)
392 ifneq ($(MACOSX_MINOR),3)
397 SOFLAGS = -dynamiclib -single_module -undefined $(UNDEFOPT)
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)
408 CXXFLAGS = $(OPT) -fPIC -wd1476
409 LD = $(MACOSXTARGET) icpc
411 # The SOFLAGS will be used to create the .dylib,
412 # the .so will be created separately
414 SOFLAGS = -dynamiclib -single_module -undefined dynamic_lookup
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)
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
432 SOFLAGS = -m64 -dynamiclib -single_module -undefined dynamic_lookup
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)
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
449 UNDEFOPT = dynamic_lookup
450 ifneq ($(MACOSX_MINOR),4)
451 ifneq ($(MACOSX_MINOR),3)
456 SOFLAGS = -qmkshrobj -single_module -undefined $(UNDEFOPT)
460 # Windows with the VC++ compiler
461 VC_MAJOR := $(shell unset VS_UNICODE_OUTPUT; cl.exe 2>&1 | awk '{ if (NR==1) print $$8 }' | \
469 ifeq (debug,$(findstring debug,$(ROOTBUILD)))
473 ifneq ($(findstring debug, $(strip $(shell $(ROOTCONFIG) --config))),)
481 CXXFLAGS = $(CXXOPT) -nologo -I$(shell $(ROOTCONFIG) --incdir) -FIw32pragma.h
483 LDFLAGS = $(LDOPT) -nologo
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
496 ifeq ($(ARCH),win32gcc)
501 CXXFLAGS = $(OPT) -pipe -Wall -Woverloaded-virtual -I/usr/X11R6/include
503 LDFLAGS = $(OPT) -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc \
505 SOFLAGS = -shared -D_DLL -Wl,--export-all-symbols
506 EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS)
510 $(error $(ARCH) invalid architecture)
513 CXXFLAGS += $(ROOTCFLAGS)
514 LDFLAGS += $(ROOTLDFLAGS)
515 LIBS = $(ROOTLIBS) $(SYSLIBS)
516 GLIBS = $(ROOTGLIBS) $(SYSLIBS)