3 src-perf := $(srctree)/tools/perf
11 obj-perf := $(abspath $(obj-perf))/
14 $(shell printf "" > $(OUTPUT).config-detected)
15 detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
16 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
18 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
20 include $(srctree)/tools/scripts/Makefile.arch
22 $(call detected_var,ARCH)
26 # Additional ARCH settings for x86
28 $(call detected,CONFIG_X86)
29 ifeq (${IS_64_BIT}, 1)
30 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated
31 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
32 LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
33 $(call detected,CONFIG_X86_64)
35 LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
42 LIBUNWIND_LIBS = -lunwind -lunwind-arm
47 LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
50 ifeq ($(NO_PERF_REGS),0)
51 $(call detected,CONFIG_PERF_REGS)
54 # So far there's only x86 and arm libdw unwind support merged in perf.
55 # Disable it on all other architectures in case libdw unwind
56 # support is detected in system. Add supported architectures
58 ifneq ($(ARCH),$(filter $(ARCH),x86 arm))
59 NO_LIBDW_DWARF_UNWIND := 1
62 ifeq ($(LIBUNWIND_LIBS),)
66 # For linking with debug library, run like:
68 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
71 libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
72 define libunwind_arch_set_flags_code
73 FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
74 FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
78 LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
79 LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
80 LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
81 $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
84 # Set per-feature check compilation flags
85 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
86 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
87 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
88 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
90 ifeq ($(NO_PERF_REGS),0)
91 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
94 # for linking with debug library, run like:
95 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
97 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
98 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
100 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
101 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
103 # for linking with debug library, run like:
104 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
105 ifdef LIBBABELTRACE_DIR
106 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
107 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
109 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
110 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
112 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
113 # include ARCH specific config
114 -include $(src-perf)/arch/$(ARCH)/Makefile
116 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
117 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
120 include $(srctree)/tools/scripts/utilities.mak
122 ifeq ($(call get-executable,$(FLEX)),)
123 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
126 ifeq ($(call get-executable,$(BISON)),)
127 dummy := $(error Error: $(BISON) is missing on this system, please install it)
130 # Treat warnings as errors unless directed not to
144 PARSER_DEBUG_BISON := -t
145 PARSER_DEBUG_FLEX := -d
146 CFLAGS += -DPARSER_DEBUG
147 $(call detected_var,PARSER_DEBUG_BISON)
148 $(call detected_var,PARSER_DEBUG_FLEX)
151 # Try different combinations to accommodate systems that only have
152 # python[2][-config] in weird combinations but always preferring
153 # python2 and python2-config as per pep-0394. If we catch a
154 # python[-config] in version 3, the version check will kill it.
155 PYTHON2 := $(if $(call get-executable,python2),python2,python)
156 override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
158 $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
159 override PYTHON_CONFIG := \
160 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
162 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
164 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
165 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
167 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
168 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
169 FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
170 FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
172 CFLAGS += -fno-omit-frame-pointer
174 CFLAGS += -funwind-tables
179 # Enforce a non-executable stack, as we may regress (again) in the future by
180 # adding assembler files missing the .GNU-stack linker note.
181 LDFLAGS += -Wl,-z,noexecstack
183 EXTLIBS = -lpthread -lrt -lm -ldl
185 ifeq ($(FEATURES_DUMP),)
186 include $(srctree)/tools/build/Makefile.feature
188 include $(FEATURES_DUMP)
191 ifeq ($(feature-stackprotector-all), 1)
192 CFLAGS += -fstack-protector-all
196 ifeq ($(feature-fortify-source), 1)
197 CFLAGS += -D_FORTIFY_SOURCE=2
201 CFLAGS += -I$(src-perf)/util/include
202 CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
203 CFLAGS += -I$(srctree)/tools/include/
204 CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
205 CFLAGS += -I$(srctree)/arch/$(ARCH)/include
206 CFLAGS += -I$(srctree)/include/uapi
207 CFLAGS += -I$(srctree)/include
209 # $(obj-perf) for generated common-cmds.h
210 # $(obj-perf)/util for generated bison/flex headers
212 CFLAGS += -I$(obj-perf)/util
213 CFLAGS += -I$(obj-perf)
216 CFLAGS += -I$(src-perf)/util
217 CFLAGS += -I$(src-perf)
218 CFLAGS += -I$(srctree)/tools/lib/
220 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
222 ifeq ($(feature-sync-compare-and-swap), 1)
223 CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
226 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
227 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
231 $(call feature_check,bionic)
232 ifeq ($(feature-bionic), 1)
234 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
235 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
243 NO_LIBDW_DWARF_UNWIND := 1
246 ifeq ($(feature-libelf), 0)
247 ifeq ($(feature-glibc), 1)
253 ifeq ($(LIBC_SUPPORT),1)
254 msg := $(warning No libelf found, disables 'probe' tool and BPF support in 'perf record', please install elfutils-libelf-devel/libelf-dev);
260 NO_LIBDW_DWARF_UNWIND := 1
263 ifneq ($(filter s% -static%,$(LDFLAGS),),)
264 msg := $(error No static glibc found, please install glibc-static);
266 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
270 ifndef NO_LIBDW_DWARF_UNWIND
271 ifneq ($(feature-libdw-dwarf-unwind),1)
272 NO_LIBDW_DWARF_UNWIND := 1
273 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
276 ifneq ($(feature-dwarf), 1)
277 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);
280 ifneq ($(feature-dwarf_getlocations), 1)
281 msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
283 CFLAGS += -DHAVE_DWARF_GETLOCATIONS
284 endif # dwarf_getlocations
285 endif # Dwarf support
286 endif # libelf support
290 NO_LIBDW_DWARF_UNWIND := 1
294 CFLAGS += -DHAVE_LIBELF_SUPPORT
296 $(call detected,CONFIG_LIBELF)
298 ifeq ($(feature-libelf-mmap), 1)
299 CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
302 ifeq ($(feature-libelf-getphdrnum), 1)
303 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
307 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
308 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
311 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
312 LDFLAGS += $(LIBDW_LDFLAGS)
314 ifeq ($(findstring -static,${LDFLAGS}),-static)
315 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
317 EXTLIBS += ${DWARFLIBS}
318 $(call detected,CONFIG_DWARF)
319 endif # PERF_HAVE_DWARF_REGS
323 ifeq ($(feature-bpf), 1)
324 CFLAGS += -DHAVE_LIBBPF_SUPPORT
325 $(call detected,CONFIG_LIBBPF)
329 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
330 CFLAGS += -DHAVE_BPF_PROLOGUE
331 $(call detected,CONFIG_BPF_PROLOGUE)
333 msg := $(warning BPF prologue is not supported by architecture $(ARCH), missing regs_query_register_offset());
336 msg := $(warning DWARF support is off, BPF prologue is disabled);
342 ifdef PERF_HAVE_JITDUMP
344 $(call detected,CONFIG_JITDUMP)
345 CFLAGS += -DHAVE_JITDUMP
349 ifeq ($(ARCH),powerpc)
351 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
358 ifeq ($(feature-libunwind-x86), 1)
359 $(call detected,CONFIG_LIBUNWIND_X86)
360 CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
361 LDFLAGS += -lunwind-x86
365 ifeq ($(feature-libunwind-aarch64), 1)
366 $(call detected,CONFIG_LIBUNWIND_AARCH64)
367 CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
368 LDFLAGS += -lunwind-aarch64
370 $(call feature_check,libunwind-debug-frame-aarch64)
371 ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
372 msg := $(warning No debug_frame support found in libunwind-aarch64);
373 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
377 ifneq ($(feature-libunwind), 1)
378 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
379 NO_LOCAL_LIBUNWIND := 1
382 $(call detected,CONFIG_LOCAL_LIBUNWIND)
385 ifneq ($(have_libunwind), 1)
389 NO_LOCAL_LIBUNWIND := 1
393 ifneq ($(feature-bpf), 1)
394 msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
399 dwarf-post-unwind := 1
400 dwarf-post-unwind-text := BUG
402 # setup DWARF post unwinder
404 ifdef NO_LIBDW_DWARF_UNWIND
405 msg := $(warning Disabling post unwind, no support found.);
406 dwarf-post-unwind := 0
408 dwarf-post-unwind-text := libdw
409 $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
412 dwarf-post-unwind-text := libunwind
413 $(call detected,CONFIG_LIBUNWIND)
414 # Enable libunwind support by default.
415 ifndef NO_LIBDW_DWARF_UNWIND
416 NO_LIBDW_DWARF_UNWIND := 1
420 ifeq ($(dwarf-post-unwind),1)
421 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
422 $(call detected,CONFIG_DWARF_UNWIND)
427 ifndef NO_LOCAL_LIBUNWIND
428 ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
429 $(call feature_check,libunwind-debug-frame)
430 ifneq ($(feature-libunwind-debug-frame), 1)
431 msg := $(warning No debug_frame support found in libunwind);
432 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
435 # non-ARM has no dwarf_find_debug_frame() function:
436 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
438 EXTLIBS += $(LIBUNWIND_LIBS)
439 LDFLAGS += $(LIBUNWIND_LIBS)
443 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
444 CFLAGS += $(LIBUNWIND_CFLAGS)
445 LDFLAGS += $(LIBUNWIND_LDFLAGS)
449 ifneq ($(feature-libaudit), 1)
450 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
453 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
455 $(call detected,CONFIG_AUDIT)
460 ifneq ($(feature-libcrypto), 1)
461 msg := $(warning No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev);
464 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
466 $(call detected,CONFIG_CRYPTO)
475 ifneq ($(feature-libslang), 1)
476 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
479 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
480 CFLAGS += -I/usr/include/slang
481 CFLAGS += -DHAVE_SLANG_SUPPORT
483 $(call detected,CONFIG_SLANG)
488 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
489 ifneq ($(feature-gtk2), 1)
490 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
493 ifeq ($(feature-gtk2-infobar), 1)
494 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
496 CFLAGS += -DHAVE_GTK2_SUPPORT
497 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
498 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
503 grep-libs = $(filter -l%,$(1))
504 strip-libs = $(filter-out -l%,$(1))
507 CFLAGS += -DNO_LIBPERL
509 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
510 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
511 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
512 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
513 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
515 ifneq ($(feature-libperl), 1)
516 CFLAGS += -DNO_LIBPERL
518 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
520 LDFLAGS += $(PERL_EMBED_LDFLAGS)
521 EXTLIBS += $(PERL_EMBED_LIBADD)
522 $(call detected,CONFIG_LIBPERL)
526 ifeq ($(feature-timerfd), 1)
527 CFLAGS += -DHAVE_TIMERFD_SUPPORT
529 msg := $(warning No timerfd support. Disables 'perf kvm stat live');
532 disable-python = $(eval $(disable-python_code))
533 define disable-python_code
534 CFLAGS += -DNO_LIBPYTHON
540 $(call disable-python,Python support disabled by user)
544 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
546 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
549 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
552 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
554 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
555 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
556 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
557 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
558 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
560 ifneq ($(feature-libpython), 1)
561 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
564 ifneq ($(feature-libpython-version), 1)
565 $(warning Python 3 is not yet supported; please set)
566 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
567 $(warning If you also have Python 2 installed, then)
568 $(warning try something like:)
570 $(warning $(and ,) make PYTHON=python2)
572 $(warning Otherwise, disable Python support entirely:)
574 $(warning $(and ,) make NO_LIBPYTHON=1)
578 LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
579 EXTLIBS += $(PYTHON_EMBED_LIBADD)
580 LANG_BINDINGS += $(obj-perf)python/perf.so
581 $(call detected,CONFIG_LIBPYTHON)
588 ifeq ($(feature-libbfd), 1)
591 # call all detections now so we get correct
592 # status in VF output
593 $(call feature_check,liberty)
594 $(call feature_check,liberty-z)
595 $(call feature_check,cplus-demangle)
597 ifeq ($(feature-liberty), 1)
600 ifeq ($(feature-liberty-z), 1)
601 EXTLIBS += -liberty -lz
607 CFLAGS += -DNO_DEMANGLE
609 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
611 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
613 ifneq ($(feature-libbfd), 1)
614 ifneq ($(feature-liberty), 1)
615 ifneq ($(feature-liberty-z), 1)
616 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
617 # or any of 'bfd iberty z' trinity
618 ifeq ($(feature-cplus-demangle), 1)
620 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
622 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
623 CFLAGS += -DNO_DEMANGLE
631 ifneq ($(filter -lbfd,$(EXTLIBS)),)
632 CFLAGS += -DHAVE_LIBBFD_SUPPORT
636 ifeq ($(feature-zlib), 1)
637 CFLAGS += -DHAVE_ZLIB_SUPPORT
639 $(call detected,CONFIG_ZLIB)
646 ifeq ($(feature-lzma), 1)
647 CFLAGS += -DHAVE_LZMA_SUPPORT
649 $(call detected,CONFIG_LZMA)
651 msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
657 ifeq ($(feature-backtrace), 1)
658 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
663 ifeq ($(feature-libnuma), 0)
664 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
667 ifeq ($(feature-numa_num_possible_cpus), 0)
668 msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
671 CFLAGS += -DHAVE_LIBNUMA_SUPPORT
673 $(call detected,CONFIG_NUMA)
678 ifdef HAVE_KVM_STAT_SUPPORT
679 CFLAGS += -DHAVE_KVM_STAT_SUPPORT
682 ifeq (${IS_64_BIT}, 1)
683 ifndef NO_PERF_READ_VDSO32
684 $(call feature_check,compile-32)
685 ifeq ($(feature-compile-32), 1)
686 CFLAGS += -DHAVE_PERF_READ_VDSO32
688 NO_PERF_READ_VDSO32 := 1
692 NO_PERF_READ_VDSOX32 := 1
694 ifndef NO_PERF_READ_VDSOX32
695 $(call feature_check,compile-x32)
696 ifeq ($(feature-compile-x32), 1)
697 CFLAGS += -DHAVE_PERF_READ_VDSOX32
699 NO_PERF_READ_VDSOX32 := 1
703 NO_PERF_READ_VDSO32 := 1
704 NO_PERF_READ_VDSOX32 := 1
708 $(call feature_check,libbabeltrace)
709 ifeq ($(feature-libbabeltrace), 1)
710 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
711 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
712 EXTLIBS += -lbabeltrace-ctf
713 $(call detected,CONFIG_LIBBABELTRACE)
715 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
720 ifeq ($(feature-get_cpuid), 0)
721 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
724 $(call detected,CONFIG_AUXTRACE)
725 CFLAGS += -DHAVE_AUXTRACE_SUPPORT
729 # Among the variables below, these:
735 # ETC_PERFCONFIG (but not sysconfdir)
736 # can be specified as a relative path some/where/else;
737 # this is interpreted as relative to $(prefix) and "perf" at
738 # runtime figures out where they are based on the path to the executable.
739 # This can help installing the suite in a relocatable way.
741 # Make the path relative to DESTDIR, not to prefix
745 bindir_relative = bin
746 bindir = $(abspath $(prefix)/$(bindir_relative))
749 perfexecdir = libexec/perf-core
750 sharedir = $(prefix)/share
751 template_dir = share/perf-core/templates
752 STRACE_GROUPS_DIR = share/perf-core/strace/groups
753 htmldir = share/doc/perf-doc
754 tipdir = share/doc/perf-tip
755 srcdir = $(srctree)/tools/perf
756 ifeq ($(prefix),/usr)
758 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
760 sysconfdir = $(prefix)/etc
761 ETC_PERFCONFIG = etc/perfconfig
764 ifeq ($(ARCH)$(IS_64_BIT), x861)
770 libdir = $(prefix)/$(lib)
772 # Shell quote (do not use $(call) to accommodate ancient setups);
773 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
774 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
775 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
776 bindir_SQ = $(subst ','\'',$(bindir))
777 mandir_SQ = $(subst ','\'',$(mandir))
778 infodir_SQ = $(subst ','\'',$(infodir))
779 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
780 template_dir_SQ = $(subst ','\'',$(template_dir))
781 htmldir_SQ = $(subst ','\'',$(htmldir))
782 tipdir_SQ = $(subst ','\'',$(tipdir))
783 prefix_SQ = $(subst ','\'',$(prefix))
784 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
785 libdir_SQ = $(subst ','\'',$(libdir))
786 srcdir_SQ = $(subst ','\'',$(srcdir))
788 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
789 perfexec_instdir = $(perfexecdir)
790 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
791 tip_instdir = $(tipdir)
793 perfexec_instdir = $(prefix)/$(perfexecdir)
794 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
795 tip_instdir = $(prefix)/$(tipdir)
797 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
798 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
799 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
801 # If we install to $(HOME) we keep the traceevent default:
802 # $(HOME)/.traceevent/plugins
803 # Otherwise we install plugins into the global $(libdir).
805 plugindir=$(libdir)/traceevent/plugins
806 plugindir_SQ= $(subst ','\'',$(plugindir))
809 print_var = $(eval $(print_var_code)) $(info $(MSG))
810 define print_var_code
811 MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
815 $(call print_var,prefix)
816 $(call print_var,bindir)
817 $(call print_var,libdir)
818 $(call print_var,sysconfdir)
819 $(call print_var,LIBUNWIND_DIR)
820 $(call print_var,LIBDW_DIR)
822 ifeq ($(dwarf-post-unwind),1)
823 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
828 $(call detected_var,bindir_SQ)
829 $(call detected_var,PYTHON_WORD)
831 $(call detected_var,OUTPUT)
833 $(call detected_var,htmldir_SQ)
834 $(call detected_var,infodir_SQ)
835 $(call detected_var,mandir_SQ)
836 $(call detected_var,ETC_PERFCONFIG_SQ)
837 $(call detected_var,STRACE_GROUPS_DIR_SQ)
838 $(call detected_var,prefix_SQ)
839 $(call detected_var,perfexecdir_SQ)
840 $(call detected_var,tipdir_SQ)
841 $(call detected_var,srcdir_SQ)
842 $(call detected_var,LIBDIR)
843 $(call detected_var,GTK_CFLAGS)
844 $(call detected_var,PERL_EMBED_CCOPTS)
845 $(call detected_var,PYTHON_EMBED_CCOPTS)