1 # SPDX-License-Identifier: GPL-2.0-only
4 src-perf := $(srctree)/tools/perf
12 obj-perf := $(abspath $(obj-perf))/
15 $(shell printf "" > $(OUTPUT).config-detected)
16 detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
17 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
19 CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
20 HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
22 # Enabled Wthread-safety analysis for clang builds.
23 ifeq ($(CC_NO_CLANG), 0)
24 CFLAGS += -Wthread-safety
27 include $(srctree)/tools/scripts/Makefile.arch
29 $(call detected_var,SRCARCH)
33 ifneq ($(NO_SYSCALL_TABLE),1)
37 ifeq (${IS_64_BIT}, 1)
41 ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc arm64 s390 mips loongarch))
46 ifneq ($(NO_SYSCALL_TABLE),1)
47 CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
51 # Additional ARCH settings for ppc
52 ifeq ($(SRCARCH),powerpc)
54 CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated
55 LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
58 # Additional ARCH settings for x86
60 $(call detected,CONFIG_X86)
61 ifeq (${IS_64_BIT}, 1)
62 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
63 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
64 LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
65 $(call detected,CONFIG_X86_64)
67 LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
74 LIBUNWIND_LIBS = -lunwind -lunwind-arm
77 ifeq ($(SRCARCH),arm64)
79 CFLAGS += -I$(OUTPUT)arch/arm64/include/generated
80 LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
83 ifeq ($(SRCARCH),loongarch)
85 CFLAGS += -I$(OUTPUT)arch/loongarch/include/generated
86 LIBUNWIND_LIBS = -lunwind -lunwind-loongarch64
89 ifeq ($(SRCARCH),riscv)
93 ifeq ($(SRCARCH),csky)
99 CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated
104 CFLAGS += -I$(OUTPUT)arch/mips/include/generated
105 LIBUNWIND_LIBS = -lunwind -lunwind-mips
108 ifeq ($(NO_PERF_REGS),0)
109 $(call detected,CONFIG_PERF_REGS)
112 # So far there's only x86 and arm libdw unwind support merged in perf.
113 # Disable it on all other architectures in case libdw unwind
114 # support is detected in system. Add supported architectures
116 ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv loongarch))
117 NO_LIBDW_DWARF_UNWIND := 1
120 ifeq ($(LIBUNWIND_LIBS),)
124 # For linking with debug library, run like:
126 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
129 libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
130 define libunwind_arch_set_flags_code
131 FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
132 FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
136 LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
137 LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
138 LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64 loongarch
139 $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
142 # Set per-feature check compilation flags
143 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
144 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
145 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
146 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
148 FEATURE_CHECK_LDFLAGS-libunwind-arm += -lunwind -lunwind-arm
149 FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64
150 FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86
151 FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64
153 FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
156 LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
158 OPENCSDLIBS := -lopencsd_c_api -lopencsd
159 ifeq ($(findstring -static,${LDFLAGS}),-static)
160 OPENCSDLIBS += -lstdc++
163 LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
165 FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
166 FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
168 ifeq ($(NO_PERF_REGS),0)
169 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
172 # for linking with debug library, run like:
173 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
175 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
176 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
179 ifeq ($(findstring -static,${LDFLAGS}),-static)
180 DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2
182 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
183 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
185 # for linking with debug library, run like:
186 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
187 ifdef LIBBABELTRACE_DIR
188 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
189 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
191 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
192 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
195 LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib
196 LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib
198 FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
199 FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
201 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
202 # include ARCH specific config
203 -include $(src-perf)/arch/$(SRCARCH)/Makefile
205 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
206 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
209 include $(srctree)/tools/scripts/utilities.mak
211 ifeq ($(call get-executable,$(FLEX)),)
212 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
215 ifeq ($(call get-executable,$(BISON)),)
216 dummy := $(error Error: $(BISON) is missing on this system, please install it)
219 ifeq ($(BUILD_BPF_SKEL),1)
220 ifeq ($(call get-executable,$(CLANG)),)
221 dummy := $(error $(CLANG) is missing on this system, please install it to be able to build with BUILD_BPF_SKEL=1)
226 ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
227 BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
231 # Treat warnings as errors unless directed not to
233 CORE_CFLAGS += -Werror
235 HOSTCFLAGS += -Werror
243 CORE_CFLAGS += -DNDEBUG=1
244 ifeq ($(CC_NO_CLANG), 0)
252 PARSER_DEBUG_BISON := -t
253 PARSER_DEBUG_FLEX := -d
254 CFLAGS += -DPARSER_DEBUG
255 $(call detected_var,PARSER_DEBUG_BISON)
256 $(call detected_var,PARSER_DEBUG_FLEX)
259 # Try different combinations to accommodate systems that only have
260 # python[2][3]-config in weird combinations in the following order of
261 # priority from lowest to highest:
262 # * python2-config as per pep-0394.
265 # * $(PYTHON)-config (If PYTHON is user supplied but PYTHON_CONFIG isn't)
267 PYTHON_AUTO := python-config
268 PYTHON_AUTO := $(if $(call get-executable,python2-config),python2-config,$(PYTHON_AUTO))
269 PYTHON_AUTO := $(if $(call get-executable,python-config),python-config,$(PYTHON_AUTO))
270 PYTHON_AUTO := $(if $(call get-executable,python3-config),python3-config,$(PYTHON_AUTO))
272 # If PYTHON is defined but PYTHON_CONFIG isn't, then take $(PYTHON)-config as if it was the user
273 # supplied value for PYTHON_CONFIG. Because it's "user supplied", error out if it doesn't exist.
276 PYTHON_CONFIG_AUTO := $(call get-executable,$(PYTHON)-config)
277 PYTHON_CONFIG := $(if $(PYTHON_CONFIG_AUTO),$(PYTHON_CONFIG_AUTO),\
278 $(call $(error $(PYTHON)-config not found)))
282 # Select either auto detected python and python-config or use user supplied values if they are
283 # defined. get-executable-or-default fails with an error if the first argument is supplied but
285 override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
286 override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
288 grep-libs = $(filter -l%,$(1))
289 strip-libs = $(filter-out -l%,$(1))
291 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
293 # Python 3.8 changed the output of `python-config --ldflags` to not include the
294 # '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for
295 # libpython fails if that flag is not included in LDFLAGS
296 ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0)
297 PYTHON_CONFIG_LDFLAGS := --ldflags --embed
299 PYTHON_CONFIG_LDFLAGS := --ldflags
303 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null)
304 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
305 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
306 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
307 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
308 ifeq ($(CC_NO_CLANG), 0)
309 PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
313 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
314 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
316 FEATURE_CHECK_LDFLAGS-libaio = -lrt
318 FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
319 FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
321 CORE_CFLAGS += -fno-omit-frame-pointer
322 CORE_CFLAGS += -ggdb3
323 CORE_CFLAGS += -funwind-tables
325 CORE_CFLAGS += -Wextra
326 CORE_CFLAGS += -std=gnu11
328 CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
330 CXXFLAGS += -fno-omit-frame-pointer
332 CXXFLAGS += -funwind-tables
333 CXXFLAGS += -Wno-strict-aliasing
336 HOSTCFLAGS += -Wextra
338 # Enforce a non-executable stack, as we may regress (again) in the future by
339 # adding assembler files missing the .GNU-stack linker note.
340 LDFLAGS += -Wl,-z,noexecstack
342 EXTLIBS = -lpthread -lrt -lm -ldl
345 CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
346 EXTLIBS += -ltcmalloc
349 ifeq ($(FEATURES_DUMP),)
350 # We will display at the end of this Makefile.config, using $(call feature_display_entries)
351 # As we may retry some feature detection here, see the disassembler-four-args case, for instance
352 FEATURE_DISPLAY_DEFERRED := 1
353 include $(srctree)/tools/build/Makefile.feature
355 include $(FEATURES_DUMP)
358 ifeq ($(feature-stackprotector-all), 1)
359 CORE_CFLAGS += -fstack-protector-all
363 ifeq ($(feature-fortify-source), 1)
364 CORE_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
368 INC_FLAGS += -I$(src-perf)/util/include
369 INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
370 INC_FLAGS += -I$(srctree)/tools/include/
371 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
372 INC_FLAGS += -I$(srctree)/tools/include/uapi
373 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
374 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
376 # $(obj-perf) for generated common-cmds.h
377 # $(obj-perf)/util for generated bison/flex headers
379 INC_FLAGS += -I$(obj-perf)/util
380 INC_FLAGS += -I$(obj-perf)
383 INC_FLAGS += -I$(src-perf)/util
384 INC_FLAGS += -I$(src-perf)
386 CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
388 CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS)
389 CXXFLAGS += $(INC_FLAGS)
391 LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
393 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
394 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
397 ifeq ($(feature-pthread-barrier), 1)
398 CFLAGS += -DHAVE_PTHREAD_BARRIER
402 $(call feature_check,bionic)
403 ifeq ($(feature-bionic), 1)
405 CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
406 CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
407 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
408 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
412 ifeq ($(feature-eventfd), 1)
413 CFLAGS += -DHAVE_EVENTFD_SUPPORT
416 ifeq ($(feature-get_current_dir_name), 1)
417 CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
420 ifeq ($(feature-gettid), 1)
421 CFLAGS += -DHAVE_GETTID
424 ifeq ($(feature-file-handle), 1)
425 CFLAGS += -DHAVE_FILE_HANDLE
431 NO_LIBDW_DWARF_UNWIND := 1
435 ifeq ($(feature-libelf), 0)
436 ifeq ($(feature-glibc), 1)
442 ifeq ($(LIBC_SUPPORT),1)
443 msg := $(error ERROR: No libelf found. Disables 'probe' tool, jvmti and BPF support. Please install libelf-dev, libelf-devel, elfutils-libelf-devel or build with NO_LIBELF=1.)
445 ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
446 ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
447 msg := $(error No libasan found, please install libasan);
451 ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),)
452 ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
453 msg := $(error No libubsan found, please install libubsan);
457 ifneq ($(filter s% -static%,$(LDFLAGS),),)
458 msg := $(error No static glibc found, please install glibc-static);
460 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
464 ifndef NO_LIBDW_DWARF_UNWIND
465 ifneq ($(feature-libdw-dwarf-unwind),1)
466 NO_LIBDW_DWARF_UNWIND := 1
467 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
470 ifneq ($(feature-dwarf), 1)
472 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);
476 ifneq ($(feature-dwarf_getlocations), 1)
477 msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
479 CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
480 endif # dwarf_getlocations
481 endif # Dwarf support
482 endif # libelf support
485 ifeq ($(feature-libaio), 1)
487 CFLAGS += -DHAVE_AIO_SUPPORT
492 NO_LIBDW_DWARF_UNWIND := 1
495 ifeq ($(feature-scandirat), 1)
496 CFLAGS += -DHAVE_SCANDIRAT_SUPPORT
499 ifeq ($(feature-sched_getcpu), 1)
500 CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
503 ifeq ($(feature-setns), 1)
504 CFLAGS += -DHAVE_SETNS_SUPPORT
505 $(call detected,CONFIG_SETNS)
509 $(call feature_check,libopencsd)
510 ifeq ($(feature-libopencsd), 1)
511 CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
512 ifeq ($(feature-reallocarray), 0)
513 CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
515 LDFLAGS += $(LIBOPENCSD_LDFLAGS)
516 EXTLIBS += $(OPENCSDLIBS)
517 $(call detected,CONFIG_LIBOPENCSD)
519 CFLAGS += -DCS_DEBUG_RAW
520 ifeq (${CSTRACE_RAW}, packed)
521 CFLAGS += -DCS_RAW_PACKED
525 dummy := $(error Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1)
530 CFLAGS += -DHAVE_LIBELF_SUPPORT
532 $(call detected,CONFIG_LIBELF)
534 ifeq ($(feature-libelf-getphdrnum), 1)
535 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
538 ifeq ($(feature-libelf-gelf_getnote), 1)
539 CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
541 msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
544 ifeq ($(feature-libelf-getshdrstrndx), 1)
545 CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
548 ifndef NO_LIBDEBUGINFOD
549 $(call feature_check,libdebuginfod)
550 ifeq ($(feature-libdebuginfod), 1)
551 CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT
552 EXTLIBS += -ldebuginfod
557 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
558 msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
561 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
562 LDFLAGS += $(LIBDW_LDFLAGS)
563 EXTLIBS += ${DWARFLIBS}
564 $(call detected,CONFIG_DWARF)
565 endif # PERF_HAVE_DWARF_REGS
569 ifeq ($(feature-bpf), 1)
570 CFLAGS += -DHAVE_LIBBPF_SUPPORT
571 $(call detected,CONFIG_LIBBPF)
573 # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
574 $(call feature_check,libbpf)
577 ifeq ($(feature-libbpf), 1)
579 $(call detected,CONFIG_LIBBPF_DYNAMIC)
581 dummy := $(error Error: No libbpf devel library found or older than v1.0, please install/update libbpf-devel);
584 # Libbpf will be built as a static library from tools/lib/bpf.
590 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
591 CFLAGS += -DHAVE_BPF_PROLOGUE
592 $(call detected,CONFIG_BPF_PROLOGUE)
594 msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
597 msg := $(warning DWARF support is off, BPF prologue is disabled);
604 ifneq ($(feature-sdt), 1)
605 msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
608 CFLAGS += -DHAVE_SDT_EVENT
609 $(call detected,CONFIG_SDT_EVENT)
613 ifdef PERF_HAVE_JITDUMP
615 $(call detected,CONFIG_JITDUMP)
616 CFLAGS += -DHAVE_JITDUMP
620 ifeq ($(SRCARCH),powerpc)
622 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
629 $(call feature_check,libunwind-x86)
630 ifeq ($(feature-libunwind-x86), 1)
631 $(call detected,CONFIG_LIBUNWIND_X86)
632 CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
633 LDFLAGS += -lunwind-x86
634 EXTLIBS_LIBUNWIND += -lunwind-x86
638 $(call feature_check,libunwind-aarch64)
639 ifeq ($(feature-libunwind-aarch64), 1)
640 $(call detected,CONFIG_LIBUNWIND_AARCH64)
641 CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
642 LDFLAGS += -lunwind-aarch64
643 EXTLIBS_LIBUNWIND += -lunwind-aarch64
645 $(call feature_check,libunwind-debug-frame-aarch64)
646 ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
647 msg := $(warning No debug_frame support found in libunwind-aarch64);
648 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
652 ifneq ($(feature-libunwind), 1)
653 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
654 NO_LOCAL_LIBUNWIND := 1
657 $(call detected,CONFIG_LOCAL_LIBUNWIND)
660 ifneq ($(have_libunwind), 1)
664 NO_LOCAL_LIBUNWIND := 1
668 ifneq ($(feature-bpf), 1)
669 msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
675 $(call feature_check,clang-bpf-co-re)
676 ifeq ($(feature-clang-bpf-co-re), 0)
677 dummy := $(error Error: clang too old/not installed. Please install recent clang to build with BUILD_BPF_SKEL)
679 ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
680 dummy := $(error Error: BPF skeleton support requires libbpf)
682 $(call detected,CONFIG_PERF_BPF_SKEL)
683 CFLAGS += -DHAVE_BPF_SKEL
687 VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
690 dwarf-post-unwind := 1
691 dwarf-post-unwind-text := BUG
693 # setup DWARF post unwinder
695 ifdef NO_LIBDW_DWARF_UNWIND
696 msg := $(warning Disabling post unwind, no support found.);
697 dwarf-post-unwind := 0
699 dwarf-post-unwind-text := libdw
700 $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
703 dwarf-post-unwind-text := libunwind
704 $(call detected,CONFIG_LIBUNWIND)
705 # Enable libunwind support by default.
706 ifndef NO_LIBDW_DWARF_UNWIND
707 NO_LIBDW_DWARF_UNWIND := 1
711 ifeq ($(dwarf-post-unwind),1)
712 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
713 $(call detected,CONFIG_DWARF_UNWIND)
718 ifndef NO_LOCAL_LIBUNWIND
719 ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
720 $(call feature_check,libunwind-debug-frame)
721 ifneq ($(feature-libunwind-debug-frame), 1)
722 msg := $(warning No debug_frame support found in libunwind);
723 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
726 # non-ARM has no dwarf_find_debug_frame() function:
727 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
729 EXTLIBS += $(LIBUNWIND_LIBS)
730 LDFLAGS += $(LIBUNWIND_LIBS)
732 ifeq ($(findstring -static,${LDFLAGS}),-static)
733 # gcc -static links libgcc_eh which contans piece of libunwind
734 LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
738 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
739 CFLAGS += $(LIBUNWIND_CFLAGS)
740 LDFLAGS += $(LIBUNWIND_LDFLAGS)
741 EXTLIBS += $(EXTLIBS_LIBUNWIND)
744 ifneq ($(NO_LIBTRACEEVENT),1)
745 ifeq ($(NO_SYSCALL_TABLE),0)
746 $(call detected,CONFIG_TRACE)
749 $(call feature_check,libaudit)
750 ifneq ($(feature-libaudit), 1)
751 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
754 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
756 $(call detected,CONFIG_TRACE)
763 ifneq ($(feature-libcrypto), 1)
764 msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
767 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
769 $(call detected,CONFIG_CRYPTO)
774 ifneq ($(feature-libslang), 1)
775 ifneq ($(feature-libslang-include-subdir), 1)
776 msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
779 CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
783 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
784 CFLAGS += -DHAVE_SLANG_SUPPORT
786 $(call detected,CONFIG_SLANG)
791 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
792 $(call feature_check,gtk2)
793 ifneq ($(feature-gtk2), 1)
794 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
797 $(call feature_check,gtk2-infobar)
798 ifeq ($(feature-gtk2-infobar), 1)
799 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
801 CFLAGS += -DHAVE_GTK2_SUPPORT
802 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
803 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
809 CFLAGS += -DNO_LIBPERL
811 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
812 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
813 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
814 PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
815 PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
816 PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
817 PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
818 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
820 ifneq ($(feature-libperl), 1)
821 CFLAGS += -DNO_LIBPERL
823 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
825 LDFLAGS += $(PERL_EMBED_LDFLAGS)
826 EXTLIBS += $(PERL_EMBED_LIBADD)
827 CFLAGS += -DHAVE_LIBPERL_SUPPORT
828 ifeq ($(CC_NO_CLANG), 0)
829 CFLAGS += -Wno-compound-token-split-by-macro
831 $(call detected,CONFIG_LIBPERL)
835 ifeq ($(feature-timerfd), 1)
836 CFLAGS += -DHAVE_TIMERFD_SUPPORT
838 msg := $(warning No timerfd support. Disables 'perf kvm stat live');
841 disable-python = $(eval $(disable-python_code))
842 define disable-python_code
843 CFLAGS += -DNO_LIBPYTHON
848 PYTHON_EXTENSION_SUFFIX := '.so'
850 $(call disable-python,Python support disabled by user)
854 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
856 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
859 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
862 ifneq ($(feature-libpython), 1)
863 $(call disable-python,No 'Python.h' was found: disables Python support - please install python-devel/python-dev)
865 LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
866 EXTLIBS += $(PYTHON_EMBED_LIBADD)
867 PYTHON_SETUPTOOLS_INSTALLED := $(shell $(PYTHON) -c 'import setuptools;' 2> /dev/null && echo "yes" || echo "no")
868 ifeq ($(PYTHON_SETUPTOOLS_INSTALLED), yes)
869 PYTHON_EXTENSION_SUFFIX := $(shell $(PYTHON) -c 'from importlib import machinery; print(machinery.EXTENSION_SUFFIXES[0])')
870 LANG_BINDINGS += $(obj-perf)python/perf$(PYTHON_EXTENSION_SUFFIX)
872 msg := $(warning Missing python setuptools, the python binding won't be built, please install python3-setuptools or equivalent);
874 CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
875 $(call detected,CONFIG_LIBPYTHON)
881 ifneq ($(NO_JEVENTS),1)
882 ifeq ($(wildcard pmu-events/arch/$(SRCARCH)/mapfile.csv),)
886 ifneq ($(NO_JEVENTS),1)
889 $(error ERROR: No python interpreter needed for jevents generation. Install python or build with NO_JEVENTS=1.)
891 # jevents.py uses f-strings present in Python 3.6 released in Dec. 2016.
892 JEVENTS_PYTHON_GOOD := $(shell $(PYTHON) -c 'import sys;print("1" if(sys.version_info.major >= 3 and sys.version_info.minor >= 6) else "0")' 2> /dev/null)
893 ifneq ($(JEVENTS_PYTHON_GOOD), 1)
894 $(error ERROR: Python interpreter needed for jevents generation too old (older than 3.6). Install a newer python or build with NO_JEVENTS=1.)
899 ifdef BUILD_NONDISTRO
900 ifeq ($(feature-libbfd), 1)
901 EXTLIBS += -lbfd -lopcodes
903 # we are on a system that requires -liberty and (maybe) -lz
904 # to link against -lbfd; test each case individually here
906 # call all detections now so we get correct
907 # status in VF output
908 $(call feature_check,libbfd-liberty)
909 $(call feature_check,libbfd-liberty-z)
911 ifeq ($(feature-libbfd-liberty), 1)
912 EXTLIBS += -lbfd -lopcodes -liberty
913 FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
914 FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
916 ifeq ($(feature-libbfd-liberty-z), 1)
917 EXTLIBS += -lbfd -lopcodes -liberty -lz
918 FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
919 FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
922 $(call feature_check,disassembler-four-args)
923 $(call feature_check,disassembler-init-styled)
926 CFLAGS += -DHAVE_LIBBFD_SUPPORT
927 CXXFLAGS += -DHAVE_LIBBFD_SUPPORT
928 ifeq ($(feature-libbfd-buildid), 1)
929 CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
931 msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available);
936 $(call feature_check,cxa-demangle)
937 ifeq ($(feature-cxa-demangle), 1)
939 CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
940 CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
941 $(call detected,CONFIG_CXX_DEMANGLE)
943 ifdef BUILD_NONDISTRO
944 ifeq ($(filter -liberty,$(EXTLIBS)),)
945 $(call feature_check,cplus-demangle)
946 ifeq ($(feature-cplus-demangle), 1)
950 ifneq ($(filter -liberty,$(EXTLIBS)),)
951 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
952 CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
958 ifeq ($(feature-zlib), 1)
959 CFLAGS += -DHAVE_ZLIB_SUPPORT
961 $(call detected,CONFIG_ZLIB)
968 ifeq ($(feature-lzma), 1)
969 CFLAGS += -DHAVE_LZMA_SUPPORT
971 $(call detected,CONFIG_LZMA)
973 msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
979 ifeq ($(feature-libzstd), 1)
980 CFLAGS += -DHAVE_ZSTD_SUPPORT
981 CFLAGS += $(LIBZSTD_CFLAGS)
982 LDFLAGS += $(LIBZSTD_LDFLAGS)
984 $(call detected,CONFIG_ZSTD)
986 msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR);
992 ifeq ($(feature-libcap), 1)
993 CFLAGS += -DHAVE_LIBCAP_SUPPORT
995 $(call detected,CONFIG_LIBCAP)
997 msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev);
1003 ifeq ($(feature-backtrace), 1)
1004 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
1009 ifeq ($(feature-libnuma), 0)
1010 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
1013 ifeq ($(feature-numa_num_possible_cpus), 0)
1014 msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
1017 CFLAGS += -DHAVE_LIBNUMA_SUPPORT
1019 $(call detected,CONFIG_NUMA)
1024 ifdef HAVE_KVM_STAT_SUPPORT
1025 CFLAGS += -DHAVE_KVM_STAT_SUPPORT
1028 ifeq ($(feature-disassembler-four-args), 1)
1029 CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
1032 ifeq ($(feature-disassembler-init-styled), 1)
1033 CFLAGS += -DDISASM_INIT_STYLED
1036 ifeq (${IS_64_BIT}, 1)
1037 ifndef NO_PERF_READ_VDSO32
1038 $(call feature_check,compile-32)
1039 ifeq ($(feature-compile-32), 1)
1040 CFLAGS += -DHAVE_PERF_READ_VDSO32
1042 NO_PERF_READ_VDSO32 := 1
1045 ifneq ($(SRCARCH), x86)
1046 NO_PERF_READ_VDSOX32 := 1
1048 ifndef NO_PERF_READ_VDSOX32
1049 $(call feature_check,compile-x32)
1050 ifeq ($(feature-compile-x32), 1)
1051 CFLAGS += -DHAVE_PERF_READ_VDSOX32
1053 NO_PERF_READ_VDSOX32 := 1
1057 NO_PERF_READ_VDSO32 := 1
1058 NO_PERF_READ_VDSOX32 := 1
1061 ifndef NO_LIBBABELTRACE
1062 $(call feature_check,libbabeltrace)
1063 ifeq ($(feature-libbabeltrace), 1)
1064 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
1065 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
1066 EXTLIBS += -lbabeltrace-ctf
1067 $(call detected,CONFIG_LIBBABELTRACE)
1069 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
1074 ifeq ($(SRCARCH),x86)
1075 ifeq ($(feature-get_cpuid), 0)
1076 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
1081 $(call detected,CONFIG_AUXTRACE)
1082 CFLAGS += -DHAVE_AUXTRACE_SUPPORT
1083 ifeq ($(feature-reallocarray), 0)
1084 CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
1090 $(call detected,CONFIG_EXTRA_TESTS)
1091 CFLAGS += -DHAVE_EXTRA_TESTS
1095 ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
1096 JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
1098 ifneq (,$(wildcard /usr/sbin/alternatives))
1099 JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
1103 $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
1109 FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
1110 $(call feature_check,jvmti)
1111 ifeq ($(feature-jvmti), 1)
1112 $(call detected_var,JDIR)
1113 ifndef NO_JVMTI_CMLR
1114 FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
1115 $(call feature_check,jvmti-cmlr)
1116 ifeq ($(feature-jvmti-cmlr), 1)
1117 CFLAGS += -DHAVE_JVMTI_CMLR
1119 endif # NO_JVMTI_CMLR
1121 $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
1129 $(call feature_check,cxx)
1130 ifneq ($(feature-cxx), 1)
1131 msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
1133 $(call feature_check,llvm)
1134 $(call feature_check,llvm-version)
1135 ifneq ($(feature-llvm), 1)
1136 msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
1138 $(call feature_check,clang)
1139 ifneq ($(feature-clang), 1)
1140 msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
1142 CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
1143 CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
1144 $(call detected,CONFIG_CXX)
1145 $(call detected,CONFIG_CLANGLLVM)
1149 ifneq ($(feature-llvm-version),1)
1150 msg := $(warning This version of LLVM is not tested. May cause build errors)
1158 $(call feature_check,libpfm4)
1159 ifeq ($(feature-libpfm4), 1)
1160 CFLAGS += -DHAVE_LIBPFM
1162 ASCIIDOC_EXTRA = -aHAVE_LIBPFM=1
1163 $(call detected,CONFIG_LIBPFM4)
1165 msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev);
1169 # libtraceevent is a recommended dependency picked up from the system.
1170 ifneq ($(NO_LIBTRACEEVENT),1)
1171 $(call feature_check,libtraceevent)
1172 ifeq ($(feature-libtraceevent), 1)
1173 CFLAGS += -DHAVE_LIBTRACEEVENT
1174 EXTLIBS += -ltraceevent
1175 LIBTRACEEVENT_VERSION := $(shell $(PKG_CONFIG) --modversion libtraceevent)
1176 LIBTRACEEVENT_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
1177 LIBTRACEEVENT_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
1178 LIBTRACEEVENT_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
1179 LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3))
1180 CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP)
1181 $(call detected,CONFIG_LIBTRACEEVENT)
1183 dummy := $(error ERROR: libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel or build with NO_LIBTRACEEVENT=1)
1186 $(call feature_check,libtracefs)
1187 ifeq ($(feature-libtracefs), 1)
1188 EXTLIBS += -ltracefs
1189 LIBTRACEFS_VERSION := $(shell $(PKG_CONFIG) --modversion libtracefs)
1190 LIBTRACEFS_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEFS_VERSION)))
1191 LIBTRACEFS_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEFS_VERSION)))
1192 LIBTRACEFS_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEFS_VERSION)))
1193 LIBTRACEFS_VERSION_CPP := $(shell expr $(LIBTRACEFS_VERSION_1) \* 255 \* 255 + $(LIBTRACEFS_VERSION_2) \* 255 + $(LIBTRACEFS_VERSION_3))
1194 CFLAGS += -DLIBTRACEFS_VERSION=$(LIBTRACEFS_VERSION_CPP)
1198 # Among the variables below, these:
1200 # libbpf_include_dir
1206 # ETC_PERFCONFIG (but not sysconfdir)
1207 # can be specified as a relative path some/where/else;
1208 # this is interpreted as relative to $(prefix) and "perf" at
1209 # runtime figures out where they are based on the path to the executable.
1210 # This can help installing the suite in a relocatable way.
1212 # Make the path relative to DESTDIR, not to prefix
1216 bindir_relative = bin
1217 bindir = $(abspath $(prefix)/$(bindir_relative))
1218 includedir_relative = include
1219 includedir = $(abspath $(prefix)/$(includedir_relative))
1221 infodir = share/info
1222 perfexecdir = libexec/perf-core
1223 # FIXME: system's libbpf header directory, where we expect to find bpf/bpf_helpers.h, for instance
1224 libbpf_include_dir = /usr/include
1225 perf_examples_dir = lib/perf/examples
1226 sharedir = $(prefix)/share
1227 template_dir = share/perf-core/templates
1228 STRACE_GROUPS_DIR = share/perf-core/strace/groups
1229 htmldir = share/doc/perf-doc
1230 tipdir = share/doc/perf-tip
1231 srcdir = $(srctree)/tools/perf
1232 ifeq ($(prefix),/usr)
1234 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
1236 sysconfdir = $(prefix)/etc
1237 ETC_PERFCONFIG = etc/perfconfig
1240 ifeq ($(SRCARCH)$(IS_64_BIT), x861)
1246 libdir = $(prefix)/$(lib)
1248 # Shell quote (do not use $(call) to accommodate ancient setups);
1249 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
1250 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
1251 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1252 bindir_SQ = $(subst ','\'',$(bindir))
1253 includedir_SQ = $(subst ','\'',$(includedir))
1254 mandir_SQ = $(subst ','\'',$(mandir))
1255 infodir_SQ = $(subst ','\'',$(infodir))
1256 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
1257 libbpf_include_dir_SQ = $(subst ','\'',$(libbpf_include_dir))
1258 perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
1259 template_dir_SQ = $(subst ','\'',$(template_dir))
1260 htmldir_SQ = $(subst ','\'',$(htmldir))
1261 tipdir_SQ = $(subst ','\'',$(tipdir))
1262 prefix_SQ = $(subst ','\'',$(prefix))
1263 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
1264 libdir_SQ = $(subst ','\'',$(libdir))
1265 srcdir_SQ = $(subst ','\'',$(srcdir))
1267 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
1268 perfexec_instdir = $(perfexecdir)
1269 perf_include_instdir = $(libbpf_include_dir)
1270 perf_examples_instdir = $(perf_examples_dir)
1271 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
1272 tip_instdir = $(tipdir)
1274 perfexec_instdir = $(prefix)/$(perfexecdir)
1275 perf_include_instdir = $(prefix)/$(libbpf_include_dir)
1276 perf_examples_instdir = $(prefix)/$(perf_examples_dir)
1277 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
1278 tip_instdir = $(prefix)/$(tipdir)
1280 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
1281 perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
1282 perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
1283 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
1284 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
1286 export perfexec_instdir_SQ
1288 print_var = $(eval $(print_var_code)) $(info $(MSG))
1289 define print_var_code
1290 MSG = $(shell printf '...%40s: %s' $(1) $($(1)))
1293 ifeq ($(feature_display),1)
1294 $(call feature_display_entries)
1298 # Display EXTRA features which are detected manualy
1299 # from here with feature_check call and thus cannot
1300 # be partof global state output.
1301 $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),) $(info $(MSG)))
1302 $(call print_var,prefix)
1303 $(call print_var,bindir)
1304 $(call print_var,libdir)
1305 $(call print_var,sysconfdir)
1306 $(call print_var,LIBUNWIND_DIR)
1307 $(call print_var,LIBDW_DIR)
1308 $(call print_var,JDIR)
1310 ifeq ($(dwarf-post-unwind),1)
1311 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text)) $(info $(MSG))
1317 $(call detected_var,bindir_SQ)
1318 $(call detected_var,PYTHON_WORD)
1320 $(call detected_var,OUTPUT)
1322 $(call detected_var,htmldir_SQ)
1323 $(call detected_var,infodir_SQ)
1324 $(call detected_var,mandir_SQ)
1325 $(call detected_var,ETC_PERFCONFIG_SQ)
1326 $(call detected_var,STRACE_GROUPS_DIR_SQ)
1327 $(call detected_var,prefix_SQ)
1328 $(call detected_var,perfexecdir_SQ)
1329 $(call detected_var,libbpf_include_dir_SQ)
1330 $(call detected_var,perf_examples_dir_SQ)
1331 $(call detected_var,tipdir_SQ)
1332 $(call detected_var,srcdir_SQ)
1333 $(call detected_var,LIBDIR)
1334 $(call detected_var,GTK_CFLAGS)
1335 $(call detected_var,PERL_EMBED_CCOPTS)
1336 $(call detected_var,PYTHON_EMBED_CCOPTS)
1337 ifneq ($(BISON_FILE_PREFIX_MAP),)
1338 $(call detected_var,BISON_FILE_PREFIX_MAP)
1341 # re-generate FEATURE-DUMP as we may have called feature_check, found out
1342 # extra libraries to add to LDFLAGS of some other test and then redo those
1343 # tests, see the block about libbfd, disassembler-four-args, for instance.
1344 $(shell rm -f $(FEATURE_DUMP_FILENAME))
1345 $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))