Newer
Older
# Makefile for the ROOT test programs.
# This Makefile shows nicely how to compile and link applications
# using the ROOT libraries on all supported platforms.
#
# Copyright (c) 2000 Rene Brun and Fons Rademakers
#
# Author: Fons Rademakers, 29/2/2000
ROOTCONFIG := root-config
ARCH := $(shell $(ROOTCONFIG) --arch)
PLATFORM := $(shell $(ROOTCONFIG) --platform)
ALTCC := $(shell $(ROOTCONFIG) --cc)
ALTCXX := $(shell $(ROOTCONFIG) --cxx)
ALTF77 := $(shell $(ROOTCONFIG) --f77)
ALTLD := $(shell $(ROOTCONFIG) --ld)
#CXX =
ObjSuf = o
SrcSuf = cxx
ExeSuf =
DllSuf = so
OutPutOpt = -o # keep whitespace after "-o"
ifeq (debug,$(findstring debug,$(ROOTBUILD)))
OPT = -g
OPT2 = -g
else
ifneq ($(findstring debug, $(strip $(shell $(ROOTCONFIG) --config))),)
OPT = -g
OPT2 = -g
else
OPT = -O
endif
endif
ROOTCFLAGS := $(shell $(ROOTCONFIG) --cflags)
ROOTLDFLAGS := $(shell $(ROOTCONFIG) --ldflags)
ROOTLIBS := $(shell $(ROOTCONFIG) --libs) -lMathMore
ROOTGLIBS := $(shell $(ROOTCONFIG) --glibs)
HASTHREAD := $(shell $(ROOTCONFIG) --has-thread)
ROOTDICTTYPE := $(shell $(ROOTCONFIG) --dicttype)
ROOTCINT := rootcint
ifeq ($(ARCH),linux)
# Linux with egcs, gcc 2.9x, gcc 3.x
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT2)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxkcc)
# Linux with the KAI compiler
CXX = KCC --one_instantiation_per_object
CXXFLAGS = $(OPT) -fPIC +K0
LD = KCC
LDFLAGS = $(OPT) $(shell $(ROOTCONFIG) --cflags)
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
SOFLAGS =
endif
ifeq ($(ARCH),linuxicc)
# Linux with Intel icc compiler
ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
cut -d'.' -f1)
ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
cut -d'.' -f2)
CXX = icc
CXXFLAGS = $(OPT) -fPIC -wd1476
LD = icpc
LDFLAGS = $(OPT)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxppcgcc)
# PPC Linux with gcc and glibc
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT2)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxia64gcc)
# Itanium Linux with gcc 2.9x
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT2)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxia64sgi)
# Itanium Linux with sgiCC
CXX = sgiCC
CXXFLAGS = $(OPT) -Wall -fPIC
LD = gsgiCC
LDFLAGS = $(OPT)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxia64ecc)
# Itanium Linux with Intel icc (was ecc)
ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
cut -d'.' -f1)
ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \
cut -d'.' -f2)
CXX = icc
CXXFLAGS = $(OPT) -fPIC -wd1476 -ftz
LD = icpc
LDFLAGS = $(OPT)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxx8664gcc)
# AMD Opteron and Intel EM64T (64 bit mode) Linux with gcc 3.x
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC -Xlinker --no-as-needed
LDFLAGS = $(OPT2) -Xlinker --no-as-needed
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxppc64gcc)
# PPC64 Linux with gcc 3.x
CXX = g++
CXXFLAGS = $(OPT) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxx8664icc)
# AMD Opteron and Intel EM64T (64 bit mode) Linux with Intel icc compiler
CXX = icc
CXXFLAGS = $(OPT) -fPIC -wd1476 -wd1572
LD = icpc
LDFLAGS = $(OPT)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxalphagcc)
# Alpha Linux with gcc
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT2)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxmips)
# GNU/Linux on mips (BE/LE, O32/N32/N64) with gcc
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT2)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxhppa)
# GNU/Linux on hppa with gcc
CXX = g++
CXXFLAGS = $(OPT2) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT2)
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxarm)
# ARM Linux with egcs
CXX = g++
CXXFLAGS = $(OPT) -Wall -fPIC
LD = g++
LDFLAGS = $(OPT)
SOFLAGS = -shared
endif
ifeq ($(ARCH),macosx)
# MacOS X with cc (GNU cc 2.95.2 and gcc 3.3)
MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR)
CXX = g++
CXXFLAGS = $(OPT2) -pipe -Wall -W -Woverloaded-virtual
LD = $(MACOSXTARGET) g++
LDFLAGS = $(OPT2) -bind_at_load
# The SOFLAGS will be used to create the .dylib,
# the .so will be created separately
ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
DllSuf = so
else
DllSuf = dylib
endif
UNDEFOPT = dynamic_lookup
ifneq ($(subst $(MACOSX_MINOR),,12),12)
UNDEFOPT = suppress
LD = g++
endif
SOFLAGS = -dynamiclib -single_module -undefined $(UNDEFOPT)
endif
ifeq ($(ARCH),macosxicc)
# MacOS X with Intel icc compiler
MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR)
ifeq ($(MACOSX_MINOR),5)
MACOSX_MINOR := 4
endif
CXX = icc
CXXFLAGS = $(OPT) -fPIC -wd1476
LD = $(MACOSXTARGET) icpc
LDFLAGS = $(OPT)
# The SOFLAGS will be used to create the .dylib,
# the .so will be created separately
ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
DllSuf = so
else
DllSuf = dylib
endif
SOFLAGS = -dynamiclib -single_module -undefined dynamic_lookup
endif
ifeq ($(ARCH),macosx64)
# MacOS X >= 10.4 with gcc 64 bit mode (GNU gcc 4.*)
# Only specific option (-m64) comes from root-config
MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR)
CXXFLAGS = $(OPT2) -pipe -Wall -W -Woverloaded-virtual -march=native
LD = $(MACOSXTARGET) g++ -m64
LDFLAGS = $(OPT2) -bind_at_load -e start
# The SOFLAGS will be used to create the .dylib,
# the .so will be created separately
ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
DllSuf = so
else
DllSuf = dylib
endif
SOFLAGS = -m64 -dynamiclib -single_module -undefined dynamic_lookup
ifeq ($(ARCH),macosxxlc)
# MacOS X with IBM xlC compiler
MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR)
CXX = xlC
CXXFLAGS = $(OPT)
LD = $(MACOSXTARGET) xlC
LDFLAGS = $(OPT) -Wl,-bind_at_load
# The SOFLAGS will be used to create the .dylib,
# the .so will be created separately
DllSuf = dylib
UNDEFOPT = dynamic_lookup
ifneq ($(subst $(MACOSX_MINOR),,12),12)
UNDEFOPT = suppress
LD = xlC
SOFLAGS = -qmkshrobj -single_module -undefined $(UNDEFOPT)
endif
CXXFLAGS += $(ROOTCFLAGS)
LDFLAGS += $(ROOTLDFLAGS)
LIBS = $(ROOTLIBS) $(SYSLIBS)
GLIBS = $(ROOTGLIBS) $(SYSLIBS)
INCLUDE = -I$(CLHEP_BASE_DIR)/include -I$(NPTOOL)/NPLib/include