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 include $(srctree)/tools/scripts/Makefile.arch
24 $(call detected_var,SRCARCH)
28 ifneq ($(NO_SYSCALL_TABLE),1)
32 ifeq (${IS_64_BIT}, 1)
36 ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc arm64 s390 mips))
41 ifneq ($(NO_SYSCALL_TABLE),1)
42 CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
46 # Additional ARCH settings for ppc
47 ifeq ($(SRCARCH),powerpc)
49 CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated
50 LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
53 # Additional ARCH settings for x86
55 $(call detected,CONFIG_X86)
56 ifeq (${IS_64_BIT}, 1)
57 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
58 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
59 LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
60 $(call detected,CONFIG_X86_64)
62 LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
69 LIBUNWIND_LIBS = -lunwind -lunwind-arm
72 ifeq ($(SRCARCH),arm64)
74 CFLAGS += -I$(OUTPUT)arch/arm64/include/generated
75 LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
78 ifeq ($(SRCARCH),riscv)
82 ifeq ($(SRCARCH),csky)
88 CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated
93 CFLAGS += -I$(OUTPUT)arch/mips/include/generated
94 LIBUNWIND_LIBS = -lunwind -lunwind-mips
97 ifeq ($(NO_PERF_REGS),0)
98 $(call detected,CONFIG_PERF_REGS)
101 # So far there's only x86 and arm libdw unwind support merged in perf.
102 # Disable it on all other architectures in case libdw unwind
103 # support is detected in system. Add supported architectures
105 ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv))
106 NO_LIBDW_DWARF_UNWIND := 1
109 ifeq ($(LIBUNWIND_LIBS),)
113 # For linking with debug library, run like:
115 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
118 libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
119 define libunwind_arch_set_flags_code
120 FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
121 FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
125 LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
126 LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
127 LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
128 $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
131 # Set per-feature check compilation flags
132 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
133 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
134 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
135 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
137 FEATURE_CHECK_LDFLAGS-libunwind-arm += -lunwind -lunwind-arm
138 FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64
139 FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86
140 FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64
142 FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
145 LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
147 OPENCSDLIBS := -lopencsd_c_api
148 ifeq ($(findstring -static,${LDFLAGS}),-static)
149 OPENCSDLIBS += -lopencsd -lstdc++
152 LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
154 FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
155 FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
157 ifeq ($(NO_PERF_REGS),0)
158 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
161 # for linking with debug library, run like:
162 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
164 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
165 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
168 ifeq ($(findstring -static,${LDFLAGS}),-static)
169 DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2
171 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
172 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
174 # for linking with debug library, run like:
175 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
176 ifdef LIBBABELTRACE_DIR
177 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
178 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
180 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
181 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
184 LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib
185 LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib
187 FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
188 FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
190 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
191 # include ARCH specific config
192 -include $(src-perf)/arch/$(SRCARCH)/Makefile
194 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
195 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
198 include $(srctree)/tools/scripts/utilities.mak
200 ifeq ($(call get-executable,$(FLEX)),)
201 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
204 ifeq ($(call get-executable,$(BISON)),)
205 dummy := $(error Error: $(BISON) is missing on this system, please install it)
209 ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
210 BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
214 # Treat warnings as errors unless directed not to
216 CORE_CFLAGS += -Werror
218 HOSTCFLAGS += -Werror
226 ifeq ($(CC_NO_CLANG), 0)
234 PARSER_DEBUG_BISON := -t
235 PARSER_DEBUG_FLEX := -d
236 CFLAGS += -DPARSER_DEBUG
237 $(call detected_var,PARSER_DEBUG_BISON)
238 $(call detected_var,PARSER_DEBUG_FLEX)
241 # Try different combinations to accommodate systems that only have
242 # python[2][3]-config in weird combinations in the following order of
243 # priority from lowest to highest:
244 # * python2-config as per pep-0394.
247 # * $(PYTHON)-config (If PYTHON is user supplied but PYTHON_CONFIG isn't)
249 PYTHON_AUTO := python-config
250 PYTHON_AUTO := $(if $(call get-executable,python2-config),python2-config,$(PYTHON_AUTO))
251 PYTHON_AUTO := $(if $(call get-executable,python-config),python-config,$(PYTHON_AUTO))
252 PYTHON_AUTO := $(if $(call get-executable,python3-config),python3-config,$(PYTHON_AUTO))
254 # If PYTHON is defined but PYTHON_CONFIG isn't, then take $(PYTHON)-config as if it was the user
255 # supplied value for PYTHON_CONFIG. Because it's "user supplied", error out if it doesn't exist.
258 PYTHON_CONFIG_AUTO := $(call get-executable,$(PYTHON)-config)
259 PYTHON_CONFIG := $(if $(PYTHON_CONFIG_AUTO),$(PYTHON_CONFIG_AUTO),\
260 $(call $(error $(PYTHON)-config not found)))
264 # Select either auto detected python and python-config or use user supplied values if they are
265 # defined. get-executable-or-default fails with an error if the first argument is supplied but
267 override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
268 override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
270 grep-libs = $(filter -l%,$(1))
271 strip-libs = $(filter-out -l%,$(1))
273 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
275 # Python 3.8 changed the output of `python-config --ldflags` to not include the
276 # '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for
277 # libpython fails if that flag is not included in LDFLAGS
278 ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0)
279 PYTHON_CONFIG_LDFLAGS := --ldflags --embed
281 PYTHON_CONFIG_LDFLAGS := --ldflags
285 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null)
286 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
287 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
288 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
289 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
290 ifeq ($(CC_NO_CLANG), 0)
291 PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
295 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
296 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
298 FEATURE_CHECK_LDFLAGS-libaio = -lrt
300 CORE_CFLAGS += -fno-omit-frame-pointer
301 CORE_CFLAGS += -ggdb3
302 CORE_CFLAGS += -funwind-tables
304 CORE_CFLAGS += -Wextra
305 CORE_CFLAGS += -std=gnu99
307 CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
309 CXXFLAGS += -fno-omit-frame-pointer
311 CXXFLAGS += -funwind-tables
312 CXXFLAGS += -Wno-strict-aliasing
315 HOSTCFLAGS += -Wextra
317 # Enforce a non-executable stack, as we may regress (again) in the future by
318 # adding assembler files missing the .GNU-stack linker note.
319 LDFLAGS += -Wl,-z,noexecstack
321 EXTLIBS = -lpthread -lrt -lm -ldl
324 CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
325 EXTLIBS += -ltcmalloc
328 ifeq ($(FEATURES_DUMP),)
329 # We will display at the end of this Makefile.config, using $(call feature_display_entries),
330 # as we may retry some feature detection here.
331 FEATURE_DISPLAY_DEFERRED := 1
332 include $(srctree)/tools/build/Makefile.feature
334 include $(FEATURES_DUMP)
337 ifeq ($(feature-stackprotector-all), 1)
338 CORE_CFLAGS += -fstack-protector-all
342 ifeq ($(feature-fortify-source), 1)
343 CORE_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
347 INC_FLAGS += -I$(srctree)/tools/lib/perf/include
348 INC_FLAGS += -I$(src-perf)/util/include
349 INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
350 INC_FLAGS += -I$(srctree)/tools/include/
351 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
352 INC_FLAGS += -I$(srctree)/tools/include/uapi
353 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
354 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
356 # $(obj-perf) for generated common-cmds.h
357 # $(obj-perf)/util for generated bison/flex headers
359 INC_FLAGS += -I$(obj-perf)/util
360 INC_FLAGS += -I$(obj-perf)
363 INC_FLAGS += -I$(src-perf)/util
364 INC_FLAGS += -I$(src-perf)
365 INC_FLAGS += -I$(srctree)/tools/lib/
367 CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
369 CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS)
370 CXXFLAGS += $(INC_FLAGS)
372 LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
374 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
375 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
378 ifeq ($(feature-pthread-barrier), 1)
379 CFLAGS += -DHAVE_PTHREAD_BARRIER
383 $(call feature_check,bionic)
384 ifeq ($(feature-bionic), 1)
386 CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
387 CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
388 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
389 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
393 ifeq ($(feature-eventfd), 1)
394 CFLAGS += -DHAVE_EVENTFD_SUPPORT
397 ifeq ($(feature-get_current_dir_name), 1)
398 CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
401 ifeq ($(feature-gettid), 1)
402 CFLAGS += -DHAVE_GETTID
405 ifeq ($(feature-file-handle), 1)
406 CFLAGS += -DHAVE_FILE_HANDLE
413 NO_LIBDW_DWARF_UNWIND := 1
417 ifeq ($(feature-libelf), 0)
418 ifeq ($(feature-glibc), 1)
424 ifeq ($(LIBC_SUPPORT),1)
425 msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
431 NO_LIBDW_DWARF_UNWIND := 1
435 ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
436 ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
437 msg := $(error No libasan found, please install libasan);
441 ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),)
442 ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
443 msg := $(error No libubsan found, please install libubsan);
447 ifneq ($(filter s% -static%,$(LDFLAGS),),)
448 msg := $(error No static glibc found, please install glibc-static);
450 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
454 ifndef NO_LIBDW_DWARF_UNWIND
455 ifneq ($(feature-libdw-dwarf-unwind),1)
456 NO_LIBDW_DWARF_UNWIND := 1
457 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
460 ifneq ($(feature-dwarf), 1)
462 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);
466 ifneq ($(feature-dwarf_getlocations), 1)
467 msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
469 CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
470 endif # dwarf_getlocations
471 endif # Dwarf support
472 endif # libelf support
475 ifeq ($(feature-glibc), 1)
476 CFLAGS += -DHAVE_GLIBC_SUPPORT
479 ifeq ($(feature-libaio), 1)
481 CFLAGS += -DHAVE_AIO_SUPPORT
486 NO_LIBDW_DWARF_UNWIND := 1
489 ifeq ($(feature-sched_getcpu), 1)
490 CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
493 ifeq ($(feature-setns), 1)
494 CFLAGS += -DHAVE_SETNS_SUPPORT
495 $(call detected,CONFIG_SETNS)
499 $(call feature_check,libopencsd)
500 ifeq ($(feature-libopencsd), 1)
501 CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
502 ifeq ($(feature-reallocarray), 0)
503 CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
505 LDFLAGS += $(LIBOPENCSD_LDFLAGS)
506 EXTLIBS += $(OPENCSDLIBS)
507 $(call detected,CONFIG_LIBOPENCSD)
509 CFLAGS += -DCS_DEBUG_RAW
510 ifeq (${CSTRACE_RAW}, packed)
511 CFLAGS += -DCS_RAW_PACKED
515 dummy := $(error Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1)
520 CFLAGS += -DHAVE_LIBELF_SUPPORT
522 $(call detected,CONFIG_LIBELF)
524 ifeq ($(feature-libelf-getphdrnum), 1)
525 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
528 ifeq ($(feature-libelf-gelf_getnote), 1)
529 CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
531 msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
534 ifeq ($(feature-libelf-getshdrstrndx), 1)
535 CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
538 ifndef NO_LIBDEBUGINFOD
539 $(call feature_check,libdebuginfod)
540 ifeq ($(feature-libdebuginfod), 1)
541 CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT
542 EXTLIBS += -ldebuginfod
547 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
548 msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
551 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
552 LDFLAGS += $(LIBDW_LDFLAGS)
553 EXTLIBS += ${DWARFLIBS}
554 $(call detected,CONFIG_DWARF)
555 endif # PERF_HAVE_DWARF_REGS
559 ifeq ($(feature-bpf), 1)
560 CFLAGS += -DHAVE_LIBBPF_SUPPORT
561 $(call detected,CONFIG_LIBBPF)
563 # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
564 $(call feature_check,libbpf)
566 ifeq ($(feature-libbpf), 1)
568 $(call detected,CONFIG_LIBBPF_DYNAMIC)
570 $(call feature_check,libbpf-btf__load_from_kernel_by_id)
571 ifeq ($(feature-libbpf-btf__load_from_kernel_by_id), 1)
572 CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
574 $(call feature_check,libbpf-bpf_prog_load)
575 ifeq ($(feature-libbpf-bpf_prog_load), 1)
576 CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD
578 $(call feature_check,libbpf-bpf_object__next_program)
579 ifeq ($(feature-libbpf-bpf_object__next_program), 1)
580 CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM
582 $(call feature_check,libbpf-bpf_object__next_map)
583 ifeq ($(feature-libbpf-bpf_object__next_map), 1)
584 CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP
586 $(call feature_check,libbpf-btf__raw_data)
587 ifeq ($(feature-libbpf-btf__raw_data), 1)
588 CFLAGS += -DHAVE_LIBBPF_BTF__RAW_DATA
590 $(call feature_check,libbpf-bpf_map_create)
591 ifeq ($(feature-libbpf-bpf_map_create), 1)
592 CFLAGS += -DHAVE_LIBBPF_BPF_MAP_CREATE
595 dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
598 CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
599 CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD
600 CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM
601 CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP
602 CFLAGS += -DHAVE_LIBBPF_BTF__RAW_DATA
603 CFLAGS += -DHAVE_LIBBPF_BPF_MAP_CREATE
608 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
609 CFLAGS += -DHAVE_BPF_PROLOGUE
610 $(call detected,CONFIG_BPF_PROLOGUE)
612 msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
615 msg := $(warning DWARF support is off, BPF prologue is disabled);
622 ifneq ($(feature-sdt), 1)
623 msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
626 CFLAGS += -DHAVE_SDT_EVENT
627 $(call detected,CONFIG_SDT_EVENT)
631 ifdef PERF_HAVE_JITDUMP
633 $(call detected,CONFIG_JITDUMP)
634 CFLAGS += -DHAVE_JITDUMP
638 ifeq ($(SRCARCH),powerpc)
640 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
647 $(call feature_check,libunwind-x86)
648 ifeq ($(feature-libunwind-x86), 1)
649 $(call detected,CONFIG_LIBUNWIND_X86)
650 CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
651 LDFLAGS += -lunwind-x86
652 EXTLIBS_LIBUNWIND += -lunwind-x86
656 $(call feature_check,libunwind-aarch64)
657 ifeq ($(feature-libunwind-aarch64), 1)
658 $(call detected,CONFIG_LIBUNWIND_AARCH64)
659 CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
660 LDFLAGS += -lunwind-aarch64
661 EXTLIBS_LIBUNWIND += -lunwind-aarch64
663 $(call feature_check,libunwind-debug-frame-aarch64)
664 ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
665 msg := $(warning No debug_frame support found in libunwind-aarch64);
666 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
670 ifneq ($(feature-libunwind), 1)
671 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
672 NO_LOCAL_LIBUNWIND := 1
675 $(call detected,CONFIG_LOCAL_LIBUNWIND)
678 ifneq ($(have_libunwind), 1)
682 NO_LOCAL_LIBUNWIND := 1
686 ifneq ($(feature-bpf), 1)
687 msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
693 $(call feature_check,clang-bpf-co-re)
694 ifeq ($(feature-clang-bpf-co-re), 0)
695 dummy := $(error Error: clang too old/not installed. Please install recent clang to build with BUILD_BPF_SKEL)
697 ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
698 dummy := $(error Error: BPF skeleton support requires libbpf)
700 $(call detected,CONFIG_PERF_BPF_SKEL)
701 CFLAGS += -DHAVE_BPF_SKEL
704 dwarf-post-unwind := 1
705 dwarf-post-unwind-text := BUG
707 # setup DWARF post unwinder
709 ifdef NO_LIBDW_DWARF_UNWIND
710 msg := $(warning Disabling post unwind, no support found.);
711 dwarf-post-unwind := 0
713 dwarf-post-unwind-text := libdw
714 $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
717 dwarf-post-unwind-text := libunwind
718 $(call detected,CONFIG_LIBUNWIND)
719 # Enable libunwind support by default.
720 ifndef NO_LIBDW_DWARF_UNWIND
721 NO_LIBDW_DWARF_UNWIND := 1
725 ifeq ($(dwarf-post-unwind),1)
726 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
727 $(call detected,CONFIG_DWARF_UNWIND)
732 ifndef NO_LOCAL_LIBUNWIND
733 ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
734 $(call feature_check,libunwind-debug-frame)
735 ifneq ($(feature-libunwind-debug-frame), 1)
736 msg := $(warning No debug_frame support found in libunwind);
737 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
740 # non-ARM has no dwarf_find_debug_frame() function:
741 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
743 EXTLIBS += $(LIBUNWIND_LIBS)
744 LDFLAGS += $(LIBUNWIND_LIBS)
746 ifeq ($(findstring -static,${LDFLAGS}),-static)
747 # gcc -static links libgcc_eh which contans piece of libunwind
748 LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
752 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
753 CFLAGS += $(LIBUNWIND_CFLAGS)
754 LDFLAGS += $(LIBUNWIND_LDFLAGS)
755 EXTLIBS += $(EXTLIBS_LIBUNWIND)
758 ifeq ($(NO_SYSCALL_TABLE),0)
759 $(call detected,CONFIG_TRACE)
762 $(call feature_check,libaudit)
763 ifneq ($(feature-libaudit), 1)
764 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
767 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
769 $(call detected,CONFIG_TRACE)
775 ifneq ($(feature-libcrypto), 1)
776 msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
779 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
781 $(call detected,CONFIG_CRYPTO)
790 ifneq ($(feature-libslang), 1)
791 ifneq ($(feature-libslang-include-subdir), 1)
792 msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
795 CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
799 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
800 CFLAGS += -DHAVE_SLANG_SUPPORT
802 $(call detected,CONFIG_SLANG)
807 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
808 $(call feature_check,gtk2)
809 ifneq ($(feature-gtk2), 1)
810 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
813 $(call feature_check,gtk2-infobar)
814 ifeq ($(feature-gtk2-infobar), 1)
815 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
817 CFLAGS += -DHAVE_GTK2_SUPPORT
818 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
819 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
825 CFLAGS += -DNO_LIBPERL
827 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
828 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
829 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
830 PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
831 PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
832 PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
833 PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
834 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
836 ifneq ($(feature-libperl), 1)
837 CFLAGS += -DNO_LIBPERL
839 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
841 LDFLAGS += $(PERL_EMBED_LDFLAGS)
842 EXTLIBS += $(PERL_EMBED_LIBADD)
843 CFLAGS += -DHAVE_LIBPERL_SUPPORT
844 ifeq ($(CC_NO_CLANG), 0)
845 CFLAGS += -Wno-compound-token-split-by-macro
847 $(call detected,CONFIG_LIBPERL)
851 ifeq ($(feature-timerfd), 1)
852 CFLAGS += -DHAVE_TIMERFD_SUPPORT
854 msg := $(warning No timerfd support. Disables 'perf kvm stat live');
857 disable-python = $(eval $(disable-python_code))
858 define disable-python_code
859 CFLAGS += -DNO_LIBPYTHON
865 $(call disable-python,Python support disabled by user)
869 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
871 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
874 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
877 ifneq ($(feature-libpython), 1)
878 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
880 LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
881 EXTLIBS += $(PYTHON_EMBED_LIBADD)
882 LANG_BINDINGS += $(obj-perf)python/perf.so
883 CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
884 $(call detected,CONFIG_LIBPYTHON)
890 ifneq ($(NO_JEVENTS),1)
891 ifeq ($(wildcard pmu-events/arch/$(SRCARCH)/mapfile.csv),)
895 ifneq ($(NO_JEVENTS),1)
898 $(warning No python interpreter disabling jevent generation)
901 # jevents.py uses f-strings present in Python 3.6 released in Dec. 2016.
902 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)
903 ifneq ($(JEVENTS_PYTHON_GOOD), 1)
904 $(warning Python interpreter too old (older than 3.6) disabling jevent generation)
911 ifeq ($(feature-libbfd), 1)
912 EXTLIBS += -lbfd -lopcodes
914 # we are on a system that requires -liberty and (maybe) -lz
915 # to link against -lbfd; test each case individually here
917 # call all detections now so we get correct
918 # status in VF output
919 $(call feature_check,libbfd-liberty)
920 $(call feature_check,libbfd-liberty-z)
922 ifeq ($(feature-libbfd-liberty), 1)
923 EXTLIBS += -lbfd -lopcodes -liberty
925 ifeq ($(feature-libbfd-liberty-z), 1)
926 EXTLIBS += -lbfd -lopcodes -liberty -lz
929 $(call feature_check,disassembler-four-args)
930 $(call feature_check,disassembler-init-styled)
933 ifeq ($(feature-libbfd-buildid), 1)
934 CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
936 msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available);
941 CFLAGS += -DNO_DEMANGLE
943 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
946 ifeq ($(filter -liberty,$(EXTLIBS)),)
947 $(call feature_check,cplus-demangle)
949 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
950 # or any of 'bfd iberty z' trinity
951 ifeq ($(feature-cplus-demangle), 1)
954 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
955 CFLAGS += -DNO_DEMANGLE
960 ifneq ($(filter -liberty,$(EXTLIBS)),)
961 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
965 ifneq ($(filter -lbfd,$(EXTLIBS)),)
966 CFLAGS += -DHAVE_LIBBFD_SUPPORT
970 ifeq ($(feature-zlib), 1)
971 CFLAGS += -DHAVE_ZLIB_SUPPORT
973 $(call detected,CONFIG_ZLIB)
980 ifeq ($(feature-lzma), 1)
981 CFLAGS += -DHAVE_LZMA_SUPPORT
983 $(call detected,CONFIG_LZMA)
985 msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
991 ifeq ($(feature-libzstd), 1)
992 CFLAGS += -DHAVE_ZSTD_SUPPORT
993 CFLAGS += $(LIBZSTD_CFLAGS)
994 LDFLAGS += $(LIBZSTD_LDFLAGS)
996 $(call detected,CONFIG_ZSTD)
998 msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR);
1004 ifeq ($(feature-libcap), 1)
1005 CFLAGS += -DHAVE_LIBCAP_SUPPORT
1007 $(call detected,CONFIG_LIBCAP)
1009 msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev);
1015 ifeq ($(feature-backtrace), 1)
1016 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
1021 ifeq ($(feature-libnuma), 0)
1022 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
1025 ifeq ($(feature-numa_num_possible_cpus), 0)
1026 msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
1029 CFLAGS += -DHAVE_LIBNUMA_SUPPORT
1031 $(call detected,CONFIG_NUMA)
1036 ifdef HAVE_KVM_STAT_SUPPORT
1037 CFLAGS += -DHAVE_KVM_STAT_SUPPORT
1040 ifeq ($(feature-disassembler-four-args), 1)
1041 CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
1044 ifeq ($(feature-disassembler-init-styled), 1)
1045 CFLAGS += -DDISASM_INIT_STYLED
1048 ifeq (${IS_64_BIT}, 1)
1049 ifndef NO_PERF_READ_VDSO32
1050 $(call feature_check,compile-32)
1051 ifeq ($(feature-compile-32), 1)
1052 CFLAGS += -DHAVE_PERF_READ_VDSO32
1054 NO_PERF_READ_VDSO32 := 1
1057 ifneq ($(SRCARCH), x86)
1058 NO_PERF_READ_VDSOX32 := 1
1060 ifndef NO_PERF_READ_VDSOX32
1061 $(call feature_check,compile-x32)
1062 ifeq ($(feature-compile-x32), 1)
1063 CFLAGS += -DHAVE_PERF_READ_VDSOX32
1065 NO_PERF_READ_VDSOX32 := 1
1069 NO_PERF_READ_VDSO32 := 1
1070 NO_PERF_READ_VDSOX32 := 1
1073 ifndef NO_LIBBABELTRACE
1074 $(call feature_check,libbabeltrace)
1075 ifeq ($(feature-libbabeltrace), 1)
1076 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
1077 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
1078 EXTLIBS += -lbabeltrace-ctf
1079 $(call detected,CONFIG_LIBBABELTRACE)
1081 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
1086 ifeq ($(SRCARCH),x86)
1087 ifeq ($(feature-get_cpuid), 0)
1088 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
1093 $(call detected,CONFIG_AUXTRACE)
1094 CFLAGS += -DHAVE_AUXTRACE_SUPPORT
1095 ifeq ($(feature-reallocarray), 0)
1096 CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
1102 ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
1103 JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
1105 ifneq (,$(wildcard /usr/sbin/alternatives))
1106 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')
1110 $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
1116 FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
1117 $(call feature_check,jvmti)
1118 ifeq ($(feature-jvmti), 1)
1119 $(call detected_var,JDIR)
1120 ifndef NO_JVMTI_CMLR
1121 FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
1122 $(call feature_check,jvmti-cmlr)
1123 ifeq ($(feature-jvmti-cmlr), 1)
1124 CFLAGS += -DHAVE_JVMTI_CMLR
1126 endif # NO_JVMTI_CMLR
1128 $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
1136 $(call feature_check,cxx)
1137 ifneq ($(feature-cxx), 1)
1138 msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
1140 $(call feature_check,llvm)
1141 $(call feature_check,llvm-version)
1142 ifneq ($(feature-llvm), 1)
1143 msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
1145 $(call feature_check,clang)
1146 ifneq ($(feature-clang), 1)
1147 msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
1149 CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
1150 CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
1151 $(call detected,CONFIG_CXX)
1152 $(call detected,CONFIG_CLANGLLVM)
1156 ifneq ($(feature-llvm-version),1)
1157 msg := $(warning This version of LLVM is not tested. May cause build errors)
1165 $(call feature_check,libpfm4)
1166 ifeq ($(feature-libpfm4), 1)
1167 CFLAGS += -DHAVE_LIBPFM
1169 ASCIIDOC_EXTRA = -aHAVE_LIBPFM=1
1170 $(call detected,CONFIG_LIBPFM4)
1172 msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev);
1177 ifdef LIBTRACEEVENT_DYNAMIC
1178 $(call feature_check,libtraceevent)
1179 ifeq ($(feature-libtraceevent), 1)
1180 EXTLIBS += -ltraceevent
1181 LIBTRACEEVENT_VERSION := $(shell $(PKG_CONFIG) --modversion libtraceevent)
1182 LIBTRACEEVENT_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
1183 LIBTRACEEVENT_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
1184 LIBTRACEEVENT_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
1185 LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3))
1186 CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP)
1188 dummy := $(error Error: No libtraceevent devel library found, please install libtraceevent-devel);
1192 ifdef LIBTRACEFS_DYNAMIC
1193 $(call feature_check,libtracefs)
1194 ifeq ($(feature-libtracefs), 1)
1195 EXTLIBS += -ltracefs
1196 LIBTRACEFS_VERSION := $(shell $(PKG_CONFIG) --modversion libtracefs)
1197 LIBTRACEFS_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEFS_VERSION)))
1198 LIBTRACEFS_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEFS_VERSION)))
1199 LIBTRACEFS_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEFS_VERSION)))
1200 LIBTRACEFS_VERSION_CPP := $(shell expr $(LIBTRACEFS_VERSION_1) \* 255 \* 255 + $(LIBTRACEFS_VERSION_2) \* 255 + $(LIBTRACEFS_VERSION_3))
1201 CFLAGS += -DLIBTRACEFS_VERSION=$(LIBTRACEFS_VERSION_CPP)
1203 dummy := $(error Error: No libtracefs devel library found, please install libtracefs-dev);
1207 # Among the variables below, these:
1215 # ETC_PERFCONFIG (but not sysconfdir)
1216 # can be specified as a relative path some/where/else;
1217 # this is interpreted as relative to $(prefix) and "perf" at
1218 # runtime figures out where they are based on the path to the executable.
1219 # This can help installing the suite in a relocatable way.
1221 # Make the path relative to DESTDIR, not to prefix
1225 bindir_relative = bin
1226 bindir = $(abspath $(prefix)/$(bindir_relative))
1227 includedir_relative = include
1228 includedir = $(abspath $(prefix)/$(includedir_relative))
1230 infodir = share/info
1231 perfexecdir = libexec/perf-core
1232 perf_include_dir = lib/perf/include
1233 perf_examples_dir = lib/perf/examples
1234 sharedir = $(prefix)/share
1235 template_dir = share/perf-core/templates
1236 STRACE_GROUPS_DIR = share/perf-core/strace/groups
1237 htmldir = share/doc/perf-doc
1238 tipdir = share/doc/perf-tip
1239 srcdir = $(srctree)/tools/perf
1240 ifeq ($(prefix),/usr)
1242 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
1244 sysconfdir = $(prefix)/etc
1245 ETC_PERFCONFIG = etc/perfconfig
1248 ifeq ($(SRCARCH)$(IS_64_BIT), x861)
1254 libdir = $(prefix)/$(lib)
1256 # Shell quote (do not use $(call) to accommodate ancient setups);
1257 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
1258 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
1259 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1260 bindir_SQ = $(subst ','\'',$(bindir))
1261 includedir_SQ = $(subst ','\'',$(includedir))
1262 mandir_SQ = $(subst ','\'',$(mandir))
1263 infodir_SQ = $(subst ','\'',$(infodir))
1264 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
1265 perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir))
1266 perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
1267 template_dir_SQ = $(subst ','\'',$(template_dir))
1268 htmldir_SQ = $(subst ','\'',$(htmldir))
1269 tipdir_SQ = $(subst ','\'',$(tipdir))
1270 prefix_SQ = $(subst ','\'',$(prefix))
1271 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
1272 libdir_SQ = $(subst ','\'',$(libdir))
1273 srcdir_SQ = $(subst ','\'',$(srcdir))
1275 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
1276 perfexec_instdir = $(perfexecdir)
1277 perf_include_instdir = $(perf_include_dir)
1278 perf_examples_instdir = $(perf_examples_dir)
1279 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
1280 tip_instdir = $(tipdir)
1282 perfexec_instdir = $(prefix)/$(perfexecdir)
1283 perf_include_instdir = $(prefix)/$(perf_include_dir)
1284 perf_examples_instdir = $(prefix)/$(perf_examples_dir)
1285 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
1286 tip_instdir = $(prefix)/$(tipdir)
1288 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
1289 perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
1290 perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
1291 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
1292 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
1294 # If we install to $(HOME) we keep the traceevent default:
1295 # $(HOME)/.traceevent/plugins
1296 # Otherwise we install plugins into the global $(libdir).
1298 plugindir=$(libdir)/traceevent/plugins
1299 plugindir_SQ= $(subst ','\'',$(plugindir))
1302 print_var = $(eval $(print_var_code)) $(info $(MSG))
1303 define print_var_code
1304 MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
1308 # Display EXTRA features which are detected manualy
1309 # from here with feature_check call and thus cannot
1310 # be partof global state output.
1311 $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),))
1312 $(call print_var,prefix)
1313 $(call print_var,bindir)
1314 $(call print_var,libdir)
1315 $(call print_var,sysconfdir)
1316 $(call print_var,LIBUNWIND_DIR)
1317 $(call print_var,LIBDW_DIR)
1318 $(call print_var,JDIR)
1320 ifeq ($(dwarf-post-unwind),1)
1321 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
1326 $(call detected_var,bindir_SQ)
1327 $(call detected_var,PYTHON_WORD)
1329 $(call detected_var,OUTPUT)
1331 $(call detected_var,htmldir_SQ)
1332 $(call detected_var,infodir_SQ)
1333 $(call detected_var,mandir_SQ)
1334 $(call detected_var,ETC_PERFCONFIG_SQ)
1335 $(call detected_var,STRACE_GROUPS_DIR_SQ)
1336 $(call detected_var,prefix_SQ)
1337 $(call detected_var,perfexecdir_SQ)
1338 $(call detected_var,perf_include_dir_SQ)
1339 $(call detected_var,perf_examples_dir_SQ)
1340 $(call detected_var,tipdir_SQ)
1341 $(call detected_var,srcdir_SQ)
1342 $(call detected_var,LIBDIR)
1343 $(call detected_var,GTK_CFLAGS)
1344 $(call detected_var,PERL_EMBED_CCOPTS)
1345 $(call detected_var,PYTHON_EMBED_CCOPTS)
1346 ifneq ($(BISON_FILE_PREFIX_MAP),)
1347 $(call detected_var,BISON_FILE_PREFIX_MAP)
1350 # re-generate FEATURE-DUMP as we may have called feature_check, found out
1351 # extra libraries to add to LDFLAGS of some other test and then redo those
1353 $(shell rm -f $(FEATURE_DUMP_FILENAME))
1354 $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
1356 ifeq ($(feature_display),1)
1357 $(call feature_display_entries)