3 src-perf := $(srctree)/tools/perf
11 obj-perf := $(abspath $(obj-perf))/
14 $(shell echo -n > .config-detected)
15 detected = $(shell echo "$(1)=y" >> .config-detected)
16 detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected)
18 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
20 include $(src-perf)/config/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
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 -lunwind-x86
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_CFLAGS = -I$(LIBUNWIND_DIR)/include
72 LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
74 LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
76 # Set per-feature check compilation flags
77 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
78 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
79 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
80 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
83 ifeq ($(NO_PERF_REGS),0)
84 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
88 # for linking with debug library, run like:
89 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
91 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
92 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
94 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
95 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
98 ifndef NO_LIBBABELTRACE
99 # for linking with debug library, run like:
100 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
101 ifdef LIBBABELTRACE_DIR
102 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
103 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
105 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
106 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
109 # include ARCH specific config
110 -include $(src-perf)/arch/$(ARCH)/Makefile
112 include $(src-perf)/config/utilities.mak
114 ifeq ($(call get-executable,$(FLEX)),)
115 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
118 ifeq ($(call get-executable,$(BISON)),)
119 dummy := $(error Error: $(BISON) is missing on this system, please install it)
122 # Treat warnings as errors unless directed not to
136 PARSER_DEBUG_BISON := -t
137 PARSER_DEBUG_FLEX := -d
138 CFLAGS += -DPARSER_DEBUG
139 $(call detected_var,PARSER_DEBUG_BISON)
140 $(call detected_var,PARSER_DEBUG_FLEX)
144 # Try different combinations to accommodate systems that only have
145 # python[2][-config] in weird combinations but always preferring
146 # python2 and python2-config as per pep-0394. If we catch a
147 # python[-config] in version 3, the version check will kill it.
148 PYTHON2 := $(if $(call get-executable,python2),python2,python)
149 override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
151 $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
152 override PYTHON_CONFIG := \
153 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
155 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
157 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
158 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
160 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
161 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
162 FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
163 FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
166 CFLAGS += -fno-omit-frame-pointer
168 CFLAGS += -funwind-tables
173 # Enforce a non-executable stack, as we may regress (again) in the future by
174 # adding assembler files missing the .GNU-stack linker note.
175 LDFLAGS += -Wl,-z,noexecstack
177 EXTLIBS = -lpthread -lrt -lm -ldl
180 OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/
181 $(shell mkdir -p $(OUTPUT_FEATURES))
184 feature_check = $(eval $(feature_check_code))
185 define feature_check_code
186 feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
189 feature_set = $(eval $(feature_set_code))
190 define feature_set_code
195 # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
199 # Note that this is not a complete list of all feature tests, just
200 # those that are typically built on a fully configured system.
202 # [ Feature tests not mentioned here have to be built explicitly in
203 # the rule that uses them - an example for that is the 'bionic'
210 sync-compare-and-swap \
225 pthread-attr-setaffinity-np \
246 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
247 # If in the future we need per-feature checks/flags for features not
248 # mentioned in this list we need to refactor this ;-).
249 set_test_all_flags = $(eval $(set_test_all_flags_code))
250 define set_test_all_flags_code
251 FEATURE_CHECK_CFLAGS-all += $(FEATURE_CHECK_CFLAGS-$(1))
252 FEATURE_CHECK_LDFLAGS-all += $(FEATURE_CHECK_LDFLAGS-$(1))
255 $(foreach feat,$(FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
258 # Special fast-path for the 'all features are available' case:
260 $(call feature_check,all,$(MSG))
263 # Just in case the build freshly failed, make sure we print the
266 ifeq ($(feature-all), 1)
268 # test-all.c passed - just set all the core feature flags to 1:
270 $(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat)))
272 $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(FEATURE_TESTS)) >/dev/null 2>&1)
273 $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat)))
276 ifeq ($(feature-stackprotector-all), 1)
277 CFLAGS += -fstack-protector-all
281 ifeq ($(feature-fortify-source), 1)
282 CFLAGS += -D_FORTIFY_SOURCE=2
286 CFLAGS += -I$(src-perf)/util/include
287 CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
288 CFLAGS += -I$(srctree)/tools/include/
289 CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
290 CFLAGS += -I$(srctree)/arch/$(ARCH)/include
291 CFLAGS += -I$(srctree)/include/uapi
292 CFLAGS += -I$(srctree)/include
294 # $(obj-perf) for generated common-cmds.h
295 # $(obj-perf)/util for generated bison/flex headers
297 CFLAGS += -I$(obj-perf)/util
298 CFLAGS += -I$(obj-perf)
301 CFLAGS += -I$(src-perf)/util
302 CFLAGS += -I$(src-perf)
303 CFLAGS += -I$(srctree)/tools/lib/
305 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
307 ifeq ($(feature-sync-compare-and-swap), 1)
308 CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
311 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
312 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
316 $(call feature_check,bionic)
317 ifeq ($(feature-bionic), 1)
319 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
320 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
328 NO_LIBDW_DWARF_UNWIND := 1
330 ifeq ($(feature-libelf), 0)
331 ifeq ($(feature-glibc), 1)
337 ifeq ($(LIBC_SUPPORT),1)
338 msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
344 NO_LIBDW_DWARF_UNWIND := 1
346 ifneq ($(filter s% -static%,$(LDFLAGS),),)
347 msg := $(error No static glibc found, please install glibc-static);
349 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
353 ifndef NO_LIBDW_DWARF_UNWIND
354 ifneq ($(feature-libdw-dwarf-unwind),1)
355 NO_LIBDW_DWARF_UNWIND := 1
356 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
359 ifneq ($(feature-dwarf), 1)
360 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);
362 endif # Dwarf support
363 endif # libelf support
367 CFLAGS += -DHAVE_LIBELF_SUPPORT
369 $(call detected,CONFIG_LIBELF)
371 ifeq ($(feature-libelf-mmap), 1)
372 CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
375 ifeq ($(feature-libelf-getphdrnum), 1)
376 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
379 # include ARCH specific config
380 -include $(src-perf)/arch/$(ARCH)/Makefile
383 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
384 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
387 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
388 LDFLAGS += $(LIBDW_LDFLAGS)
390 $(call detected,CONFIG_DWARF)
391 endif # PERF_HAVE_DWARF_REGS
395 ifeq ($(ARCH),powerpc)
397 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
402 ifneq ($(feature-libunwind), 1)
403 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
408 dwarf-post-unwind := 1
409 dwarf-post-unwind-text := BUG
411 # setup DWARF post unwinder
413 ifdef NO_LIBDW_DWARF_UNWIND
414 msg := $(warning Disabling post unwind, no support found.);
415 dwarf-post-unwind := 0
417 dwarf-post-unwind-text := libdw
418 $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
421 dwarf-post-unwind-text := libunwind
422 $(call detected,CONFIG_LIBUNWIND)
423 # Enable libunwind support by default.
424 ifndef NO_LIBDW_DWARF_UNWIND
425 NO_LIBDW_DWARF_UNWIND := 1
429 ifeq ($(dwarf-post-unwind),1)
430 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
431 $(call detected,CONFIG_DWARF_UNWIND)
437 ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
438 $(call feature_check,libunwind-debug-frame)
439 ifneq ($(feature-libunwind-debug-frame), 1)
440 msg := $(warning No debug_frame support found in libunwind);
441 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
444 # non-ARM has no dwarf_find_debug_frame() function:
445 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
447 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
448 EXTLIBS += $(LIBUNWIND_LIBS)
449 CFLAGS += $(LIBUNWIND_CFLAGS)
450 LDFLAGS += $(LIBUNWIND_LDFLAGS)
454 ifneq ($(feature-libaudit), 1)
455 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
458 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
460 $(call detected,CONFIG_AUDIT)
469 ifneq ($(feature-libslang), 1)
470 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
473 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
474 CFLAGS += -I/usr/include/slang
475 CFLAGS += -DHAVE_SLANG_SUPPORT
477 $(call detected,CONFIG_SLANG)
482 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
483 ifneq ($(feature-gtk2), 1)
484 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
487 ifeq ($(feature-gtk2-infobar), 1)
488 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
490 CFLAGS += -DHAVE_GTK2_SUPPORT
491 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
492 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
497 grep-libs = $(filter -l%,$(1))
498 strip-libs = $(filter-out -l%,$(1))
501 CFLAGS += -DNO_LIBPERL
503 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
504 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
505 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
506 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
507 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
509 ifneq ($(feature-libperl), 1)
510 CFLAGS += -DNO_LIBPERL
512 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
514 LDFLAGS += $(PERL_EMBED_LDFLAGS)
515 EXTLIBS += $(PERL_EMBED_LIBADD)
516 $(call detected,CONFIG_LIBPERL)
520 ifeq ($(feature-timerfd), 1)
521 CFLAGS += -DHAVE_TIMERFD_SUPPORT
523 msg := $(warning No timerfd support. Disables 'perf kvm stat live');
526 disable-python = $(eval $(disable-python_code))
527 define disable-python_code
528 CFLAGS += -DNO_LIBPYTHON
534 $(call disable-python,Python support disabled by user)
538 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
540 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
543 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
546 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
548 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
549 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
550 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
551 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
552 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
554 ifneq ($(feature-libpython), 1)
555 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
558 ifneq ($(feature-libpython-version), 1)
559 $(warning Python 3 is not yet supported; please set)
560 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
561 $(warning If you also have Python 2 installed, then)
562 $(warning try something like:)
564 $(warning $(and ,) make PYTHON=python2)
566 $(warning Otherwise, disable Python support entirely:)
568 $(warning $(and ,) make NO_LIBPYTHON=1)
572 LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
573 EXTLIBS += $(PYTHON_EMBED_LIBADD)
574 LANG_BINDINGS += $(obj-perf)python/perf.so
575 $(call detected,CONFIG_LIBPYTHON)
582 ifeq ($(feature-libbfd), 1)
585 # call all detections now so we get correct
586 # status in VF output
587 $(call feature_check,liberty)
588 $(call feature_check,liberty-z)
589 $(call feature_check,cplus-demangle)
591 ifeq ($(feature-liberty), 1)
594 ifeq ($(feature-liberty-z), 1)
595 EXTLIBS += -liberty -lz
601 CFLAGS += -DNO_DEMANGLE
603 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
605 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
607 ifneq ($(feature-libbfd), 1)
608 ifneq ($(feature-liberty), 1)
609 ifneq ($(feature-liberty-z), 1)
610 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
611 # or any of 'bfd iberty z' trinity
612 ifeq ($(feature-cplus-demangle), 1)
614 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
616 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
617 CFLAGS += -DNO_DEMANGLE
625 ifneq ($(filter -lbfd,$(EXTLIBS)),)
626 CFLAGS += -DHAVE_LIBBFD_SUPPORT
630 ifeq ($(feature-zlib), 1)
631 CFLAGS += -DHAVE_ZLIB_SUPPORT
633 $(call detected,CONFIG_ZLIB)
640 ifeq ($(feature-backtrace), 1)
641 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
646 ifeq ($(feature-libnuma), 0)
647 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
650 CFLAGS += -DHAVE_LIBNUMA_SUPPORT
652 $(call detected,CONFIG_NUMA)
656 ifdef HAVE_KVM_STAT_SUPPORT
657 CFLAGS += -DHAVE_KVM_STAT_SUPPORT
660 ifeq (${IS_64_BIT}, 1)
661 ifndef NO_PERF_READ_VDSO32
662 $(call feature_check,compile-32)
663 ifeq ($(feature-compile-32), 1)
664 CFLAGS += -DHAVE_PERF_READ_VDSO32
666 NO_PERF_READ_VDSO32 := 1
669 ifneq (${IS_X86_64}, 1)
670 NO_PERF_READ_VDSOX32 := 1
672 ifndef NO_PERF_READ_VDSOX32
673 $(call feature_check,compile-x32)
674 ifeq ($(feature-compile-x32), 1)
675 CFLAGS += -DHAVE_PERF_READ_VDSOX32
677 NO_PERF_READ_VDSOX32 := 1
681 NO_PERF_READ_VDSO32 := 1
682 NO_PERF_READ_VDSOX32 := 1
685 ifndef NO_LIBBABELTRACE
686 $(call feature_check,libbabeltrace)
687 ifeq ($(feature-libbabeltrace), 1)
688 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
689 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
690 EXTLIBS += -lbabeltrace-ctf
691 $(call detected,CONFIG_LIBBABELTRACE)
693 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
694 NO_LIBBABELTRACE := 1
698 # Among the variables below, these:
704 # ETC_PERFCONFIG (but not sysconfdir)
705 # can be specified as a relative path some/where/else;
706 # this is interpreted as relative to $(prefix) and "perf" at
707 # runtime figures out where they are based on the path to the executable.
708 # This can help installing the suite in a relocatable way.
710 # Make the path relative to DESTDIR, not to prefix
714 bindir_relative = bin
715 bindir = $(prefix)/$(bindir_relative)
718 perfexecdir = libexec/perf-core
719 sharedir = $(prefix)/share
720 template_dir = share/perf-core/templates
721 htmldir = share/doc/perf-doc
722 ifeq ($(prefix),/usr)
724 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
726 sysconfdir = $(prefix)/etc
727 ETC_PERFCONFIG = etc/perfconfig
730 ifeq ($(IS_X86_64),1)
736 libdir = $(prefix)/$(lib)
738 # Shell quote (do not use $(call) to accommodate ancient setups);
739 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
740 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
741 bindir_SQ = $(subst ','\'',$(bindir))
742 mandir_SQ = $(subst ','\'',$(mandir))
743 infodir_SQ = $(subst ','\'',$(infodir))
744 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
745 template_dir_SQ = $(subst ','\'',$(template_dir))
746 htmldir_SQ = $(subst ','\'',$(htmldir))
747 prefix_SQ = $(subst ','\'',$(prefix))
748 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
749 libdir_SQ = $(subst ','\'',$(libdir))
751 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
752 perfexec_instdir = $(perfexecdir)
754 perfexec_instdir = $(prefix)/$(perfexecdir)
756 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
758 # If we install to $(HOME) we keep the traceevent default:
759 # $(HOME)/.traceevent/plugins
760 # Otherwise we install plugins into the global $(libdir).
762 plugindir=$(libdir)/traceevent/plugins
763 plugindir_SQ= $(subst ','\'',$(plugindir))
767 # Print the result of the feature test:
769 feature_print_status = $(eval $(feature_print_status_code)) $(info $(MSG))
771 define feature_print_status_code
772 ifeq ($(feature-$(1)), 1)
773 MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
775 MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
779 print_var = $(eval $(print_var_code)) $(info $(MSG))
780 define print_var_code
781 MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
784 feature_print_text = $(eval $(feature_print_text_code)) $(info $(MSG))
785 define feature_print_text_code
786 MSG = $(shell printf '...%30s: %s' $(1) $(2))
789 FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
790 FEATURE_DUMP_FILE := $(shell touch $(OUTPUT)FEATURE-DUMP; cat $(OUTPUT)FEATURE-DUMP)
792 ifeq ($(dwarf-post-unwind),1)
793 FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
796 # The $(feature_display) controls the default detection message
797 # output. It's set if:
798 # - detected features differes from stored features from
799 # last build (in FEATURE-DUMP file)
800 # - one of the $(FEATURE_DISPLAY) is not detected
803 ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
804 $(shell echo "$(FEATURE_DUMP)" > $(OUTPUT)FEATURE-DUMP)
808 feature_check = $(eval $(feature_check_code))
809 define feature_check_code
810 ifneq ($(feature-$(1)), 1)
815 $(foreach feat,$(FEATURE_DISPLAY),$(call feature_check,$(feat)))
822 ifeq ($(feature_display),1)
824 $(info Auto-detecting system features:)
825 $(foreach feat,$(FEATURE_DISPLAY),$(call feature_print_status,$(feat),))
827 ifeq ($(dwarf-post-unwind),1)
828 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
831 ifneq ($(feature_verbose),1)
836 ifeq ($(feature_verbose),1)
837 TMP := $(filter-out $(FEATURE_DISPLAY),$(FEATURE_TESTS))
838 $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
840 $(call print_var,prefix)
841 $(call print_var,bindir)
842 $(call print_var,libdir)
843 $(call print_var,sysconfdir)
844 $(call print_var,LIBUNWIND_DIR)
845 $(call print_var,LIBDW_DIR)
849 $(call detected_var,bindir_SQ)
850 $(call detected_var,PYTHON_WORD)
852 $(call detected_var,OUTPUT)
854 $(call detected_var,htmldir_SQ)
855 $(call detected_var,infodir_SQ)
856 $(call detected_var,mandir_SQ)
857 $(call detected_var,ETC_PERFCONFIG_SQ)
858 $(call detected_var,prefix_SQ)
859 $(call detected_var,perfexecdir_SQ)
860 $(call detected_var,LIBDIR)
861 $(call detected_var,GTK_CFLAGS)
862 $(call detected_var,PERL_EMBED_CCOPTS)
863 $(call detected_var,PYTHON_EMBED_CCOPTS)