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