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)))
83 LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
85 # Set per-feature check compilation flags
86 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
87 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
88 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
89 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
91 ifeq ($(NO_PERF_REGS),0)
92 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
95 # for linking with debug library, run like:
96 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
98 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
99 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
101 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
102 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
104 # for linking with debug library, run like:
105 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
106 ifdef LIBBABELTRACE_DIR
107 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
108 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
110 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
111 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
113 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
114 # include ARCH specific config
115 -include $(src-perf)/arch/$(ARCH)/Makefile
117 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
118 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
121 include $(srctree)/tools/scripts/utilities.mak
123 ifeq ($(call get-executable,$(FLEX)),)
124 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
127 ifeq ($(call get-executable,$(BISON)),)
128 dummy := $(error Error: $(BISON) is missing on this system, please install it)
131 # Treat warnings as errors unless directed not to
145 PARSER_DEBUG_BISON := -t
146 PARSER_DEBUG_FLEX := -d
147 CFLAGS += -DPARSER_DEBUG
148 $(call detected_var,PARSER_DEBUG_BISON)
149 $(call detected_var,PARSER_DEBUG_FLEX)
152 # Try different combinations to accommodate systems that only have
153 # python[2][-config] in weird combinations but always preferring
154 # python2 and python2-config as per pep-0394. If we catch a
155 # python[-config] in version 3, the version check will kill it.
156 PYTHON2 := $(if $(call get-executable,python2),python2,python)
157 override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
159 $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
160 override PYTHON_CONFIG := \
161 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
163 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
165 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
166 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
168 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
169 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
170 FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
171 FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
173 CFLAGS += -fno-omit-frame-pointer
175 CFLAGS += -funwind-tables
180 # Enforce a non-executable stack, as we may regress (again) in the future by
181 # adding assembler files missing the .GNU-stack linker note.
182 LDFLAGS += -Wl,-z,noexecstack
184 EXTLIBS = -lpthread -lrt -lm -ldl
186 ifeq ($(FEATURES_DUMP),)
187 include $(srctree)/tools/build/Makefile.feature
189 include $(FEATURES_DUMP)
192 ifeq ($(feature-stackprotector-all), 1)
193 CFLAGS += -fstack-protector-all
197 ifeq ($(feature-fortify-source), 1)
198 CFLAGS += -D_FORTIFY_SOURCE=2
202 CFLAGS += -I$(src-perf)/util/include
203 CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
204 CFLAGS += -I$(srctree)/tools/include/
205 CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
206 CFLAGS += -I$(srctree)/arch/$(ARCH)/include
207 CFLAGS += -I$(srctree)/include/uapi
208 CFLAGS += -I$(srctree)/include
210 # $(obj-perf) for generated common-cmds.h
211 # $(obj-perf)/util for generated bison/flex headers
213 CFLAGS += -I$(obj-perf)/util
214 CFLAGS += -I$(obj-perf)
217 CFLAGS += -I$(src-perf)/util
218 CFLAGS += -I$(src-perf)
219 CFLAGS += -I$(srctree)/tools/lib/
221 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
223 ifeq ($(feature-sync-compare-and-swap), 1)
224 CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
227 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
228 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
232 $(call feature_check,bionic)
233 ifeq ($(feature-bionic), 1)
235 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
236 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
244 NO_LIBDW_DWARF_UNWIND := 1
247 ifeq ($(feature-libelf), 0)
248 ifeq ($(feature-glibc), 1)
254 ifeq ($(LIBC_SUPPORT),1)
255 msg := $(warning No libelf found, disables 'probe' tool and BPF support in 'perf record', please install elfutils-libelf-devel/libelf-dev);
261 NO_LIBDW_DWARF_UNWIND := 1
264 ifneq ($(filter s% -static%,$(LDFLAGS),),)
265 msg := $(error No static glibc found, please install glibc-static);
267 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
271 ifndef NO_LIBDW_DWARF_UNWIND
272 ifneq ($(feature-libdw-dwarf-unwind),1)
273 NO_LIBDW_DWARF_UNWIND := 1
274 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
277 ifneq ($(feature-dwarf), 1)
278 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);
281 ifneq ($(feature-dwarf_getlocations), 1)
282 msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
284 CFLAGS += -DHAVE_DWARF_GETLOCATIONS
285 endif # dwarf_getlocations
286 endif # Dwarf support
287 endif # libelf support
291 NO_LIBDW_DWARF_UNWIND := 1
295 CFLAGS += -DHAVE_LIBELF_SUPPORT
297 $(call detected,CONFIG_LIBELF)
299 ifeq ($(feature-libelf-mmap), 1)
300 CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
303 ifeq ($(feature-libelf-getphdrnum), 1)
304 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
308 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
309 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
312 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
313 LDFLAGS += $(LIBDW_LDFLAGS)
315 ifeq ($(findstring -static,${LDFLAGS}),-static)
316 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
318 EXTLIBS += ${DWARFLIBS}
319 $(call detected,CONFIG_DWARF)
320 endif # PERF_HAVE_DWARF_REGS
324 ifeq ($(feature-bpf), 1)
325 CFLAGS += -DHAVE_LIBBPF_SUPPORT
326 $(call detected,CONFIG_LIBBPF)
330 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
331 CFLAGS += -DHAVE_BPF_PROLOGUE
332 $(call detected,CONFIG_BPF_PROLOGUE)
334 msg := $(warning BPF prologue is not supported by architecture $(ARCH), missing regs_query_register_offset());
337 msg := $(warning DWARF support is off, BPF prologue is disabled);
343 ifdef PERF_HAVE_JITDUMP
345 $(call detected,CONFIG_JITDUMP)
346 CFLAGS += -DHAVE_JITDUMP
350 ifeq ($(ARCH),powerpc)
352 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
357 ifneq ($(feature-libunwind), 1)
358 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
364 ifneq ($(feature-bpf), 1)
365 msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
370 dwarf-post-unwind := 1
371 dwarf-post-unwind-text := BUG
373 # setup DWARF post unwinder
375 ifdef NO_LIBDW_DWARF_UNWIND
376 msg := $(warning Disabling post unwind, no support found.);
377 dwarf-post-unwind := 0
379 dwarf-post-unwind-text := libdw
380 $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
383 dwarf-post-unwind-text := libunwind
384 $(call detected,CONFIG_LIBUNWIND)
385 # Enable libunwind support by default.
386 ifndef NO_LIBDW_DWARF_UNWIND
387 NO_LIBDW_DWARF_UNWIND := 1
391 ifeq ($(dwarf-post-unwind),1)
392 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
393 $(call detected,CONFIG_DWARF_UNWIND)
399 ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
400 $(call feature_check,libunwind-debug-frame)
401 ifneq ($(feature-libunwind-debug-frame), 1)
402 msg := $(warning No debug_frame support found in libunwind);
403 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
406 # non-ARM has no dwarf_find_debug_frame() function:
407 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
409 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
410 EXTLIBS += $(LIBUNWIND_LIBS)
411 CFLAGS += $(LIBUNWIND_CFLAGS)
412 LDFLAGS += $(LIBUNWIND_LDFLAGS)
416 ifneq ($(feature-libaudit), 1)
417 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
420 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
422 $(call detected,CONFIG_AUDIT)
427 ifneq ($(feature-libcrypto), 1)
428 msg := $(warning No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev);
431 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
433 $(call detected,CONFIG_CRYPTO)
442 ifneq ($(feature-libslang), 1)
443 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
446 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
447 CFLAGS += -I/usr/include/slang
448 CFLAGS += -DHAVE_SLANG_SUPPORT
450 $(call detected,CONFIG_SLANG)
455 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
456 ifneq ($(feature-gtk2), 1)
457 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
460 ifeq ($(feature-gtk2-infobar), 1)
461 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
463 CFLAGS += -DHAVE_GTK2_SUPPORT
464 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
465 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
470 grep-libs = $(filter -l%,$(1))
471 strip-libs = $(filter-out -l%,$(1))
474 CFLAGS += -DNO_LIBPERL
476 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
477 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
478 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
479 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
480 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
482 ifneq ($(feature-libperl), 1)
483 CFLAGS += -DNO_LIBPERL
485 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
487 LDFLAGS += $(PERL_EMBED_LDFLAGS)
488 EXTLIBS += $(PERL_EMBED_LIBADD)
489 $(call detected,CONFIG_LIBPERL)
493 ifeq ($(feature-timerfd), 1)
494 CFLAGS += -DHAVE_TIMERFD_SUPPORT
496 msg := $(warning No timerfd support. Disables 'perf kvm stat live');
499 disable-python = $(eval $(disable-python_code))
500 define disable-python_code
501 CFLAGS += -DNO_LIBPYTHON
507 $(call disable-python,Python support disabled by user)
511 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
513 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
516 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
519 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
521 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
522 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
523 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
524 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
525 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
527 ifneq ($(feature-libpython), 1)
528 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
531 ifneq ($(feature-libpython-version), 1)
532 $(warning Python 3 is not yet supported; please set)
533 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
534 $(warning If you also have Python 2 installed, then)
535 $(warning try something like:)
537 $(warning $(and ,) make PYTHON=python2)
539 $(warning Otherwise, disable Python support entirely:)
541 $(warning $(and ,) make NO_LIBPYTHON=1)
545 LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
546 EXTLIBS += $(PYTHON_EMBED_LIBADD)
547 LANG_BINDINGS += $(obj-perf)python/perf.so
548 $(call detected,CONFIG_LIBPYTHON)
555 ifeq ($(feature-libbfd), 1)
558 # call all detections now so we get correct
559 # status in VF output
560 $(call feature_check,liberty)
561 $(call feature_check,liberty-z)
562 $(call feature_check,cplus-demangle)
564 ifeq ($(feature-liberty), 1)
567 ifeq ($(feature-liberty-z), 1)
568 EXTLIBS += -liberty -lz
574 CFLAGS += -DNO_DEMANGLE
576 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
578 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
580 ifneq ($(feature-libbfd), 1)
581 ifneq ($(feature-liberty), 1)
582 ifneq ($(feature-liberty-z), 1)
583 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
584 # or any of 'bfd iberty z' trinity
585 ifeq ($(feature-cplus-demangle), 1)
587 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
589 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
590 CFLAGS += -DNO_DEMANGLE
598 ifneq ($(filter -lbfd,$(EXTLIBS)),)
599 CFLAGS += -DHAVE_LIBBFD_SUPPORT
603 ifeq ($(feature-zlib), 1)
604 CFLAGS += -DHAVE_ZLIB_SUPPORT
606 $(call detected,CONFIG_ZLIB)
613 ifeq ($(feature-lzma), 1)
614 CFLAGS += -DHAVE_LZMA_SUPPORT
616 $(call detected,CONFIG_LZMA)
618 msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
624 ifeq ($(feature-backtrace), 1)
625 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
630 ifeq ($(feature-libnuma), 0)
631 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
634 ifeq ($(feature-numa_num_possible_cpus), 0)
635 msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
638 CFLAGS += -DHAVE_LIBNUMA_SUPPORT
640 $(call detected,CONFIG_NUMA)
645 ifdef HAVE_KVM_STAT_SUPPORT
646 CFLAGS += -DHAVE_KVM_STAT_SUPPORT
649 ifeq (${IS_64_BIT}, 1)
650 ifndef NO_PERF_READ_VDSO32
651 $(call feature_check,compile-32)
652 ifeq ($(feature-compile-32), 1)
653 CFLAGS += -DHAVE_PERF_READ_VDSO32
655 NO_PERF_READ_VDSO32 := 1
659 NO_PERF_READ_VDSOX32 := 1
661 ifndef NO_PERF_READ_VDSOX32
662 $(call feature_check,compile-x32)
663 ifeq ($(feature-compile-x32), 1)
664 CFLAGS += -DHAVE_PERF_READ_VDSOX32
666 NO_PERF_READ_VDSOX32 := 1
670 NO_PERF_READ_VDSO32 := 1
671 NO_PERF_READ_VDSOX32 := 1
675 $(call feature_check,libbabeltrace)
676 ifeq ($(feature-libbabeltrace), 1)
677 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
678 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
679 EXTLIBS += -lbabeltrace-ctf
680 $(call detected,CONFIG_LIBBABELTRACE)
682 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
687 ifeq ($(feature-get_cpuid), 0)
688 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
691 $(call detected,CONFIG_AUXTRACE)
692 CFLAGS += -DHAVE_AUXTRACE_SUPPORT
696 # Among the variables below, these:
702 # ETC_PERFCONFIG (but not sysconfdir)
703 # can be specified as a relative path some/where/else;
704 # this is interpreted as relative to $(prefix) and "perf" at
705 # runtime figures out where they are based on the path to the executable.
706 # This can help installing the suite in a relocatable way.
708 # Make the path relative to DESTDIR, not to prefix
712 bindir_relative = bin
713 bindir = $(abspath $(prefix)/$(bindir_relative))
716 perfexecdir = libexec/perf-core
717 sharedir = $(prefix)/share
718 template_dir = share/perf-core/templates
719 STRACE_GROUPS_DIR = share/perf-core/strace/groups
720 htmldir = share/doc/perf-doc
721 tipdir = share/doc/perf-tip
722 srcdir = $(srctree)/tools/perf
723 ifeq ($(prefix),/usr)
725 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
727 sysconfdir = $(prefix)/etc
728 ETC_PERFCONFIG = etc/perfconfig
731 ifeq ($(ARCH)$(IS_64_BIT), x861)
737 libdir = $(prefix)/$(lib)
739 # Shell quote (do not use $(call) to accommodate ancient setups);
740 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
741 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
742 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
743 bindir_SQ = $(subst ','\'',$(bindir))
744 mandir_SQ = $(subst ','\'',$(mandir))
745 infodir_SQ = $(subst ','\'',$(infodir))
746 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
747 template_dir_SQ = $(subst ','\'',$(template_dir))
748 htmldir_SQ = $(subst ','\'',$(htmldir))
749 tipdir_SQ = $(subst ','\'',$(tipdir))
750 prefix_SQ = $(subst ','\'',$(prefix))
751 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
752 libdir_SQ = $(subst ','\'',$(libdir))
753 srcdir_SQ = $(subst ','\'',$(srcdir))
755 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
756 perfexec_instdir = $(perfexecdir)
757 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
758 tip_instdir = $(tipdir)
760 perfexec_instdir = $(prefix)/$(perfexecdir)
761 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
762 tip_instdir = $(prefix)/$(tipdir)
764 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
765 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
766 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
768 # If we install to $(HOME) we keep the traceevent default:
769 # $(HOME)/.traceevent/plugins
770 # Otherwise we install plugins into the global $(libdir).
772 plugindir=$(libdir)/traceevent/plugins
773 plugindir_SQ= $(subst ','\'',$(plugindir))
776 print_var = $(eval $(print_var_code)) $(info $(MSG))
777 define print_var_code
778 MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
782 $(call print_var,prefix)
783 $(call print_var,bindir)
784 $(call print_var,libdir)
785 $(call print_var,sysconfdir)
786 $(call print_var,LIBUNWIND_DIR)
787 $(call print_var,LIBDW_DIR)
789 ifeq ($(dwarf-post-unwind),1)
790 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
795 $(call detected_var,bindir_SQ)
796 $(call detected_var,PYTHON_WORD)
798 $(call detected_var,OUTPUT)
800 $(call detected_var,htmldir_SQ)
801 $(call detected_var,infodir_SQ)
802 $(call detected_var,mandir_SQ)
803 $(call detected_var,ETC_PERFCONFIG_SQ)
804 $(call detected_var,STRACE_GROUPS_DIR_SQ)
805 $(call detected_var,prefix_SQ)
806 $(call detected_var,perfexecdir_SQ)
807 $(call detected_var,tipdir_SQ)
808 $(call detected_var,srcdir_SQ)
809 $(call detected_var,LIBDIR)
810 $(call detected_var,GTK_CFLAGS)
811 $(call detected_var,PERL_EMBED_CCOPTS)
812 $(call detected_var,PYTHON_EMBED_CCOPTS)