Commit | Line | Data |
---|---|---|
8bd407b9 JO |
1 | uname_M := $(shell uname -m 2>/dev/null || echo not) |
2 | ||
3 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |
8e1b3f68 JO |
4 | -e s/arm.*/arm/ -e s/sa110/arm/ \ |
5 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ | |
6 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | |
7 | -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) | |
8bd407b9 | 8 | NO_PERF_REGS := 1 |
9c12cf95 | 9 | CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) |
8bd407b9 JO |
10 | |
11 | # Additional ARCH settings for x86 | |
12 | ifeq ($(ARCH),i386) | |
8e1b3f68 JO |
13 | override ARCH := x86 |
14 | NO_PERF_REGS := 0 | |
15 | LIBUNWIND_LIBS = -lunwind -lunwind-x86 | |
8bd407b9 JO |
16 | endif |
17 | ||
18 | ifeq ($(ARCH),x86_64) | |
8e1b3f68 JO |
19 | override ARCH := x86 |
20 | IS_X86_64 := 0 | |
21 | ifeq (, $(findstring m32,$(CFLAGS))) | |
22 | IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) | |
23 | endif | |
24 | ifeq (${IS_X86_64}, 1) | |
25 | RAW_ARCH := x86_64 | |
89fe808a | 26 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT |
8e1b3f68 JO |
27 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S |
28 | endif | |
29 | NO_PERF_REGS := 0 | |
30 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 | |
8bd407b9 JO |
31 | endif |
32 | ||
33 | ifeq ($(NO_PERF_REGS),0) | |
89fe808a | 34 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT |
8bd407b9 | 35 | endif |
a32f4936 | 36 | |
7c53746e JO |
37 | ifeq ($(src-perf),) |
38 | src-perf := $(srctree)/tools/perf | |
39 | endif | |
40 | ||
41 | ifeq ($(obj-perf),) | |
107de372 | 42 | obj-perf := $(OUTPUT) |
7c53746e JO |
43 | endif |
44 | ||
45 | ifneq ($(obj-perf),) | |
46 | obj-perf := $(abspath $(obj-perf))/ | |
47 | endif | |
48 | ||
4e319027 RR |
49 | LIB_INCLUDE := $(srctree)/tools/lib/ |
50 | ||
7c53746e JO |
51 | # include ARCH specific config |
52 | -include $(src-perf)/arch/$(ARCH)/Makefile | |
53 | ||
54 | include $(src-perf)/config/feature-tests.mak | |
55 | include $(src-perf)/config/utilities.mak | |
a32f4936 JO |
56 | |
57 | ifeq ($(call get-executable,$(FLEX)),) | |
8e1b3f68 | 58 | dummy := $(error Error: $(FLEX) is missing on this system, please install it) |
a32f4936 JO |
59 | endif |
60 | ||
61 | ifeq ($(call get-executable,$(BISON)),) | |
8e1b3f68 | 62 | dummy := $(error Error: $(BISON) is missing on this system, please install it) |
a32f4936 | 63 | endif |
362493f0 JO |
64 | |
65 | # Treat warnings as errors unless directed not to | |
66 | ifneq ($(WERROR),0) | |
8e1b3f68 | 67 | CFLAGS += -Werror |
362493f0 JO |
68 | endif |
69 | ||
70 | ifeq ("$(origin DEBUG)", "command line") | |
8e1b3f68 | 71 | PERF_DEBUG = $(DEBUG) |
362493f0 JO |
72 | endif |
73 | ifndef PERF_DEBUG | |
8e1b3f68 | 74 | CFLAGS += -O6 |
362493f0 JO |
75 | endif |
76 | ||
77 | ifdef PARSER_DEBUG | |
8e1b3f68 JO |
78 | PARSER_DEBUG_BISON := -t |
79 | PARSER_DEBUG_FLEX := -d | |
80 | CFLAGS += -DPARSER_DEBUG | |
362493f0 JO |
81 | endif |
82 | ||
2fe73746 JO |
83 | CFLAGS += -fno-omit-frame-pointer |
84 | CFLAGS += -ggdb3 | |
85 | CFLAGS += -funwind-tables | |
86 | CFLAGS += -Wall | |
87 | CFLAGS += -Wextra | |
88 | CFLAGS += -std=gnu99 | |
9c12cf95 | 89 | |
6d19912c | 90 | EXTLIBS = -lelf -lpthread -lrt -lm -ldl |
362493f0 | 91 | |
b6aa9979 IM |
92 | feature_check = $(eval $(feature_check_code)); $(info CHK: config/feature-checks/test-$(1)) |
93 | define feature_check_code | |
94 | feature-$(2) := $(shell make -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) | |
95 | endef | |
96 | ||
97 | # | |
98 | # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: | |
99 | # | |
100 | $(info Testing features:) | |
101 | $(shell make -i -j -C config/feature-checks >/dev/null 2>&1) | |
102 | $(info done) | |
103 | ||
3ae069cf IM |
104 | FEATURE_TESTS = \ |
105 | hello \ | |
90ac5422 | 106 | stackprotector-all \ |
430be5ab | 107 | stackprotector \ |
c2510445 | 108 | volatile-register-var \ |
1ea6f99e | 109 | fortify-source \ |
78e9d655 | 110 | bionic \ |
8f7f8005 | 111 | libelf \ |
e12762cf | 112 | glibc \ |
8295d4e2 | 113 | dwarf \ |
8869b17e | 114 | libelf-mmap \ |
b7bcef6f | 115 | libelf-getphdrnum \ |
058f952d | 116 | libunwind \ |
d795a658 | 117 | libaudit \ |
b9498b50 | 118 | libslang \ |
7ef9e055 | 119 | gtk2 \ |
c7a79e96 | 120 | gtk2-infobar \ |
7181a671 | 121 | libperl \ |
9734163b | 122 | libpython \ |
95d061c8 | 123 | libpython-version \ |
d0707c91 | 124 | strlcpy \ |
3b7646e4 | 125 | libbfd \ |
3ae069cf | 126 | libnuma |
b6aa9979 IM |
127 | |
128 | $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) | |
129 | ||
90ac5422 | 130 | ifeq ($(feature-stackprotector-all), 1) |
8e1b3f68 | 131 | CFLAGS += -fstack-protector-all |
362493f0 JO |
132 | endif |
133 | ||
430be5ab | 134 | ifeq ($(feature-stackprotector), 1) |
8e1b3f68 | 135 | CFLAGS += -Wstack-protector |
362493f0 JO |
136 | endif |
137 | ||
c2510445 | 138 | ifeq ($(feature-volatile-register-var), 1) |
8e1b3f68 | 139 | CFLAGS += -Wvolatile-register-var |
362493f0 JO |
140 | endif |
141 | ||
142 | ifndef PERF_DEBUG | |
1ea6f99e | 143 | ifeq ($(feature-fortify-source), 1) |
8e1b3f68 JO |
144 | CFLAGS += -D_FORTIFY_SOURCE=2 |
145 | endif | |
362493f0 JO |
146 | endif |
147 | ||
2fe73746 JO |
148 | CFLAGS += -I$(src-perf)/util/include |
149 | CFLAGS += -I$(src-perf)/arch/$(ARCH)/include | |
150 | CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi | |
151 | CFLAGS += -I$(srctree)/arch/$(ARCH)/include | |
152 | CFLAGS += -I$(srctree)/include/uapi | |
153 | CFLAGS += -I$(srctree)/include | |
7c53746e JO |
154 | |
155 | # $(obj-perf) for generated common-cmds.h | |
156 | # $(obj-perf)/util for generated bison/flex headers | |
157 | ifneq ($(OUTPUT),) | |
2fe73746 JO |
158 | CFLAGS += -I$(obj-perf)/util |
159 | CFLAGS += -I$(obj-perf) | |
7c53746e JO |
160 | endif |
161 | ||
2fe73746 JO |
162 | CFLAGS += -I$(src-perf)/util |
163 | CFLAGS += -I$(src-perf) | |
4e319027 | 164 | CFLAGS += -I$(LIB_INCLUDE) |
7c53746e | 165 | |
2fe73746 | 166 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
362493f0 | 167 | |
4e22db46 | 168 | ifndef NO_BIONIC |
78e9d655 IM |
169 | $(feature_check,bionic) |
170 | ifeq ($(feature-bionic), 1) | |
171 | BIONIC := 1 | |
172 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) | |
173 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) | |
174 | endif | |
362493f0 | 175 | endif |
cf4cca10 JO |
176 | |
177 | ifdef NO_LIBELF | |
8e1b3f68 JO |
178 | NO_DWARF := 1 |
179 | NO_DEMANGLE := 1 | |
180 | NO_LIBUNWIND := 1 | |
cf4cca10 | 181 | else |
8f7f8005 | 182 | ifeq ($(feature-libelf), 0) |
e12762cf | 183 | ifeq ($(feature-glibc), 1) |
50eed7a7 IM |
184 | LIBC_SUPPORT := 1 |
185 | endif | |
186 | ifeq ($(BIONIC),1) | |
187 | LIBC_SUPPORT := 1 | |
188 | endif | |
189 | ifeq ($(LIBC_SUPPORT),1) | |
190 | msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); | |
191 | ||
192 | NO_LIBELF := 1 | |
193 | NO_DWARF := 1 | |
194 | NO_DEMANGLE := 1 | |
195 | else | |
196 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | |
197 | endif | |
8e1b3f68 | 198 | else |
50eed7a7 IM |
199 | # for linking with debug library, run like: |
200 | # make DEBUG=1 LIBDW_DIR=/opt/libdw/ | |
201 | ifdef LIBDW_DIR | |
202 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include | |
203 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib | |
204 | endif | |
205 | ||
8295d4e2 | 206 | ifneq ($(feature-dwarf), 1) |
50eed7a7 IM |
207 | msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); |
208 | NO_DWARF := 1 | |
209 | endif # Dwarf support | |
210 | endif # SOURCE_LIBELF | |
cf4cca10 JO |
211 | endif # NO_LIBELF |
212 | ||
213 | ifndef NO_LIBELF | |
fb3d333b IM |
214 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
215 | FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) | |
779724fd | 216 | |
8869b17e | 217 | ifeq ($(feature-libelf-mmap), 1) |
fb3d333b IM |
218 | CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
219 | endif | |
779724fd | 220 | |
b7bcef6f | 221 | ifeq ($(feature-libelf-getphdrnum), 1) |
fb3d333b IM |
222 | CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT |
223 | endif | |
224 | ||
225 | # include ARCH specific config | |
226 | -include $(src-perf)/arch/$(ARCH)/Makefile | |
779724fd | 227 | |
fb3d333b IM |
228 | ifndef NO_DWARF |
229 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | |
230 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | |
231 | NO_DWARF := 1 | |
232 | else | |
233 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) | |
234 | LDFLAGS += $(LIBDW_LDFLAGS) | |
235 | EXTLIBS += -lelf -ldw | |
236 | endif # PERF_HAVE_DWARF_REGS | |
237 | endif # NO_DWARF | |
cf4cca10 | 238 | endif # NO_LIBELF |
0e433feb | 239 | |
1e9f7aad | 240 | ifndef NO_LIBELF |
fb3d333b | 241 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
8869b17e | 242 | ifeq ($(feature-libelf-mmap), 1) |
fb3d333b | 243 | CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
b7bcef6f | 244 | endif |
1e9f7aad JO |
245 | endif # NO_LIBELF |
246 | ||
0e433feb JO |
247 | # There's only x86 (both 32 and 64) support for CFI unwind so far |
248 | ifneq ($(ARCH),x86) | |
8e1b3f68 | 249 | NO_LIBUNWIND := 1 |
0e433feb JO |
250 | endif |
251 | ||
252 | ifndef NO_LIBUNWIND | |
058f952d IM |
253 | # |
254 | # For linking with debug library, run like: | |
255 | # | |
256 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | |
257 | # | |
308e1e70 IM |
258 | ifdef LIBUNWIND_DIR |
259 | LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include | |
260 | LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib | |
261 | endif | |
0e433feb | 262 | |
058f952d | 263 | ifneq ($(feature-libunwind), 1) |
308e1e70 IM |
264 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); |
265 | NO_LIBUNWIND := 1 | |
266 | endif | |
267 | endif | |
0e433feb JO |
268 | |
269 | ifndef NO_LIBUNWIND | |
89fe808a | 270 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT |
8e1b3f68 JO |
271 | EXTLIBS += $(LIBUNWIND_LIBS) |
272 | CFLAGS += $(LIBUNWIND_CFLAGS) | |
273 | LDFLAGS += $(LIBUNWIND_LDFLAGS) | |
058f952d | 274 | endif |
a8279525 JO |
275 | |
276 | ifndef NO_LIBAUDIT | |
d795a658 | 277 | ifneq ($(feature-libaudit), 1) |
8e1b3f68 JO |
278 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); |
279 | NO_LIBAUDIT := 1 | |
280 | else | |
89fe808a | 281 | CFLAGS += -DHAVE_LIBAUDIT_SUPPORT |
8e1b3f68 JO |
282 | EXTLIBS += -laudit |
283 | endif | |
a8279525 | 284 | endif |
4a8f888a JO |
285 | |
286 | ifdef NO_NEWT | |
8e1b3f68 | 287 | NO_SLANG=1 |
4a8f888a JO |
288 | endif |
289 | ||
290 | ifndef NO_SLANG | |
b9498b50 | 291 | ifneq ($(feature-libslang), 1) |
8e1b3f68 JO |
292 | msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); |
293 | NO_SLANG := 1 | |
294 | else | |
295 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h | |
296 | CFLAGS += -I/usr/include/slang | |
89fe808a | 297 | CFLAGS += -DHAVE_SLANG_SUPPORT |
8e1b3f68 JO |
298 | EXTLIBS += -lslang |
299 | endif | |
4a8f888a | 300 | endif |
58cabf6a JO |
301 | |
302 | ifndef NO_GTK2 | |
8e1b3f68 | 303 | FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) |
7ef9e055 | 304 | ifneq ($(feature-gtk2), 1) |
8e1b3f68 JO |
305 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
306 | NO_GTK2 := 1 | |
307 | else | |
c7a79e96 | 308 | ifeq ($(feature-gtk2-infobar), 1) |
89fe808a | 309 | CFLAGS += -DHAVE_GTK_INFO_BAR_SUPPORT |
8e1b3f68 | 310 | endif |
89fe808a | 311 | CFLAGS += -DHAVE_GTK2_SUPPORT |
8e1b3f68 JO |
312 | CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) |
313 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) | |
314 | endif | |
58cabf6a | 315 | endif |
3082cb33 JO |
316 | |
317 | grep-libs = $(filter -l%,$(1)) | |
318 | strip-libs = $(filter-out -l%,$(1)) | |
319 | ||
320 | ifdef NO_LIBPERL | |
8e1b3f68 | 321 | CFLAGS += -DNO_LIBPERL |
3082cb33 | 322 | else |
8e1b3f68 JO |
323 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
324 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) | |
325 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | |
326 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | |
327 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) | |
328 | ||
7181a671 | 329 | ifneq ($(feature-libperl), 1) |
8e1b3f68 JO |
330 | CFLAGS += -DNO_LIBPERL |
331 | NO_LIBPERL := 1 | |
332 | else | |
333 | LDFLAGS += $(PERL_EMBED_LDFLAGS) | |
334 | EXTLIBS += $(PERL_EMBED_LIBADD) | |
335 | endif | |
3082cb33 | 336 | endif |
6e533cf1 JO |
337 | |
338 | disable-python = $(eval $(disable-python_code)) | |
339 | define disable-python_code | |
9c12cf95 | 340 | CFLAGS += -DNO_LIBPYTHON |
6e533cf1 JO |
341 | $(if $(1),$(warning No $(1) was found)) |
342 | $(warning Python support will not be built) | |
343 | NO_LIBPYTHON := 1 | |
344 | endef | |
345 | ||
346 | override PYTHON := \ | |
347 | $(call get-executable-or-default,PYTHON,python) | |
348 | ||
349 | ifndef PYTHON | |
350 | $(call disable-python,python interpreter) | |
351 | else | |
352 | ||
353 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) | |
354 | ||
355 | ifdef NO_LIBPYTHON | |
356 | $(call disable-python) | |
357 | else | |
358 | ||
359 | override PYTHON_CONFIG := \ | |
360 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) | |
361 | ||
362 | ifndef PYTHON_CONFIG | |
363 | $(call disable-python,python-config tool) | |
364 | else | |
365 | ||
366 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) | |
367 | ||
368 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
369 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | |
370 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) | |
371 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | |
372 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | |
373 | ||
9734163b | 374 | ifneq ($(feature-libpython), 1) |
6e533cf1 JO |
375 | $(call disable-python,Python.h (for Python 2.x)) |
376 | else | |
377 | ||
95d061c8 | 378 | ifneq ($(feature-libpython-version), 1) |
6e533cf1 JO |
379 | $(warning Python 3 is not yet supported; please set) |
380 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) | |
381 | $(warning If you also have Python 2 installed, then) | |
382 | $(warning try something like:) | |
383 | $(warning $(and ,)) | |
384 | $(warning $(and ,) make PYTHON=python2) | |
385 | $(warning $(and ,)) | |
386 | $(warning Otherwise, disable Python support entirely:) | |
387 | $(warning $(and ,)) | |
388 | $(warning $(and ,) make NO_LIBPYTHON=1) | |
389 | $(warning $(and ,)) | |
390 | $(error $(and ,)) | |
391 | else | |
1e9f7aad | 392 | LDFLAGS += $(PYTHON_EMBED_LDFLAGS) |
6e533cf1 | 393 | EXTLIBS += $(PYTHON_EMBED_LIBADD) |
7c53746e | 394 | LANG_BINDINGS += $(obj-perf)python/perf.so |
6e533cf1 JO |
395 | endif |
396 | endif | |
397 | endif | |
398 | endif | |
399 | endif | |
c3cf8368 JO |
400 | |
401 | ifdef NO_DEMANGLE | |
8e1b3f68 | 402 | CFLAGS += -DNO_DEMANGLE |
c3cf8368 | 403 | else |
89fe808a | 404 | ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
8e1b3f68 | 405 | EXTLIBS += -liberty |
89fe808a | 406 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
8e1b3f68 JO |
407 | else |
408 | FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd | |
3b7646e4 | 409 | ifeq ($(feature-libbfd), 1) |
8e1b3f68 JO |
410 | EXTLIBS += -lbfd |
411 | else | |
412 | FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty | |
413 | has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) | |
414 | ifeq ($(has_bfd_iberty),y) | |
415 | EXTLIBS += -lbfd -liberty | |
416 | else | |
417 | FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz | |
418 | has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) | |
419 | ifeq ($(has_bfd_iberty_z),y) | |
420 | EXTLIBS += -lbfd -liberty -lz | |
421 | else | |
422 | FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -liberty | |
423 | has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) | |
424 | ifeq ($(has_cplus_demangle),y) | |
425 | EXTLIBS += -liberty | |
89fe808a | 426 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
8e1b3f68 JO |
427 | else |
428 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) | |
429 | CFLAGS += -DNO_DEMANGLE | |
430 | endif | |
431 | endif | |
432 | endif | |
433 | endif | |
434 | endif | |
c3cf8368 | 435 | endif |
a1c7c9e7 JO |
436 | |
437 | ifndef NO_STRLCPY | |
d0707c91 | 438 | ifeq ($(feature-strlcpy), 1) |
89fe808a | 439 | CFLAGS += -DHAVE_STRLCPY_SUPPORT |
8e1b3f68 | 440 | endif |
a1c7c9e7 JO |
441 | endif |
442 | ||
443 | ifndef NO_ON_EXIT | |
89fe808a IM |
444 | ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT_SUPPORT),y) |
445 | CFLAGS += -DHAVE_ON_EXIT_SUPPORT | |
8e1b3f68 | 446 | endif |
a1c7c9e7 JO |
447 | endif |
448 | ||
449 | ifndef NO_BACKTRACE | |
89fe808a IM |
450 | ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DHAVE_BACKTRACE_SUPPORT),y) |
451 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT | |
8e1b3f68 | 452 | endif |
a1c7c9e7 | 453 | endif |
58a0abd7 JO |
454 | |
455 | ifndef NO_LIBNUMA | |
3ae069cf | 456 | ifeq ($(feature-libnuma), 0) |
8e1b3f68 JO |
457 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); |
458 | NO_LIBNUMA := 1 | |
459 | else | |
89fe808a | 460 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT |
8e1b3f68 JO |
461 | EXTLIBS += -lnuma |
462 | endif | |
58a0abd7 | 463 | endif |
cd1c39f2 JO |
464 | |
465 | # Among the variables below, these: | |
466 | # perfexecdir | |
467 | # template_dir | |
468 | # mandir | |
469 | # infodir | |
470 | # htmldir | |
471 | # ETC_PERFCONFIG (but not sysconfdir) | |
472 | # can be specified as a relative path some/where/else; | |
473 | # this is interpreted as relative to $(prefix) and "perf" at | |
474 | # runtime figures out where they are based on the path to the executable. | |
475 | # This can help installing the suite in a relocatable way. | |
476 | ||
477 | # Make the path relative to DESTDIR, not to prefix | |
478 | ifndef DESTDIR | |
479 | prefix = $(HOME) | |
480 | endif | |
481 | bindir_relative = bin | |
482 | bindir = $(prefix)/$(bindir_relative) | |
483 | mandir = share/man | |
484 | infodir = share/info | |
485 | perfexecdir = libexec/perf-core | |
486 | sharedir = $(prefix)/share | |
487 | template_dir = share/perf-core/templates | |
488 | htmldir = share/doc/perf-doc | |
489 | ifeq ($(prefix),/usr) | |
490 | sysconfdir = /etc | |
491 | ETC_PERFCONFIG = $(sysconfdir)/perfconfig | |
492 | else | |
493 | sysconfdir = $(prefix)/etc | |
494 | ETC_PERFCONFIG = etc/perfconfig | |
495 | endif | |
496 | lib = lib | |
497 | ||
498 | # Shell quote (do not use $(call) to accommodate ancient setups); | |
499 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) | |
500 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) | |
501 | bindir_SQ = $(subst ','\'',$(bindir)) | |
502 | mandir_SQ = $(subst ','\'',$(mandir)) | |
503 | infodir_SQ = $(subst ','\'',$(infodir)) | |
504 | perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) | |
505 | template_dir_SQ = $(subst ','\'',$(template_dir)) | |
506 | htmldir_SQ = $(subst ','\'',$(htmldir)) | |
507 | prefix_SQ = $(subst ','\'',$(prefix)) | |
508 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) | |
509 | ||
510 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) | |
511 | perfexec_instdir = $(perfexecdir) | |
512 | else | |
513 | perfexec_instdir = $(prefix)/$(perfexecdir) | |
514 | endif | |
515 | perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) |