1# SPDX-License-Identifier: GPL-2.0-only 2 3ifeq ($(src-perf),) 4src-perf := $(srctree)/tools/perf 5endif 6 7ifeq ($(obj-perf),) 8obj-perf := $(OUTPUT) 9endif 10 11ifneq ($(obj-perf),) 12obj-perf := $(abspath $(obj-perf))/ 13endif 14 15$(shell printf "" > $(OUTPUT).config-detected) 16detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) 17detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) 18 19CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) 20 21include $(srctree)/tools/scripts/Makefile.arch 22 23$(call detected_var,SRCARCH) 24 25NO_PERF_REGS := 1 26 27ifneq ($(NO_SYSCALL_TABLE),1) 28 NO_SYSCALL_TABLE := 1 29 30 ifeq ($(SRCARCH),x86) 31 ifeq (${IS_64_BIT}, 1) 32 NO_SYSCALL_TABLE := 0 33 endif 34 else 35 ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc arm64 s390)) 36 NO_SYSCALL_TABLE := 0 37 endif 38 endif 39 40 ifneq ($(NO_SYSCALL_TABLE),1) 41 CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT 42 endif 43endif 44 45# Additional ARCH settings for ppc 46ifeq ($(SRCARCH),powerpc) 47 NO_PERF_REGS := 0 48 CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated 49 LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 50endif 51 52# Additional ARCH settings for x86 53ifeq ($(SRCARCH),x86) 54 $(call detected,CONFIG_X86) 55 ifeq (${IS_64_BIT}, 1) 56 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated 57 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S 58 LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma 59 $(call detected,CONFIG_X86_64) 60 else 61 LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind 62 endif 63 NO_PERF_REGS := 0 64endif 65 66ifeq ($(SRCARCH),arm) 67 NO_PERF_REGS := 0 68 LIBUNWIND_LIBS = -lunwind -lunwind-arm 69endif 70 71ifeq ($(SRCARCH),arm64) 72 NO_PERF_REGS := 0 73 CFLAGS += -I$(OUTPUT)arch/arm64/include/generated 74 LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 75endif 76 77ifeq ($(SRCARCH),riscv) 78 NO_PERF_REGS := 0 79endif 80 81ifeq ($(SRCARCH),csky) 82 NO_PERF_REGS := 0 83endif 84 85ifeq ($(ARCH),s390) 86 NO_PERF_REGS := 0 87 CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated 88endif 89 90ifeq ($(ARCH),mips) 91 NO_PERF_REGS := 0 92 CFLAGS += -I../../arch/mips/include/uapi -I../../arch/mips/include/generated/uapi 93 LIBUNWIND_LIBS = -lunwind -lunwind-mips 94endif 95 96ifeq ($(NO_PERF_REGS),0) 97 $(call detected,CONFIG_PERF_REGS) 98endif 99 100# So far there's only x86 and arm libdw unwind support merged in perf. 101# Disable it on all other architectures in case libdw unwind 102# support is detected in system. Add supported architectures 103# to the check. 104ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv)) 105 NO_LIBDW_DWARF_UNWIND := 1 106endif 107 108ifeq ($(LIBUNWIND_LIBS),) 109 NO_LIBUNWIND := 1 110endif 111# 112# For linking with debug library, run like: 113# 114# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ 115# 116 117libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code)) 118define libunwind_arch_set_flags_code 119 FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include 120 FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib 121endef 122 123ifdef LIBUNWIND_DIR 124 LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include 125 LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib 126 LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64 127 $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch))) 128endif 129 130# Set per-feature check compilation flags 131FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS) 132FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) 133FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) 134FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) 135 136FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm 137FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64 138FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86 139FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64 140 141FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto 142 143ifdef CSINCLUDES 144 LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) 145endif 146OPENCSDLIBS := -lopencsd_c_api -lopencsd 147ifdef CSLIBS 148 LIBOPENCSD_LDFLAGS := -L$(CSLIBS) 149endif 150FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS) 151FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS) 152 153ifeq ($(NO_PERF_REGS),0) 154 CFLAGS += -DHAVE_PERF_REGS_SUPPORT 155endif 156 157# for linking with debug library, run like: 158# make DEBUG=1 LIBDW_DIR=/opt/libdw/ 159ifdef LIBDW_DIR 160 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include 161 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib 162endif 163DWARFLIBS := -ldw 164ifeq ($(findstring -static,${LDFLAGS}),-static) 165 DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2 166endif 167FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) 168FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS) 169 170# for linking with debug library, run like: 171# make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/ 172ifdef LIBBABELTRACE_DIR 173 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include 174 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib 175endif 176FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) 177FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf 178 179ifdef LIBZSTD_DIR 180 LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib 181 LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib 182endif 183FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) 184FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) 185 186FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi 187# include ARCH specific config 188-include $(src-perf)/arch/$(SRCARCH)/Makefile 189 190ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET 191 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET 192endif 193 194include $(srctree)/tools/scripts/utilities.mak 195 196ifeq ($(call get-executable,$(FLEX)),) 197 dummy := $(error Error: $(FLEX) is missing on this system, please install it) 198endif 199 200ifeq ($(call get-executable,$(BISON)),) 201 dummy := $(error Error: $(BISON) is missing on this system, please install it) 202endif 203 204# Treat warnings as errors unless directed not to 205ifneq ($(WERROR),0) 206 CORE_CFLAGS += -Werror 207 CXXFLAGS += -Werror 208endif 209 210ifndef DEBUG 211 DEBUG := 0 212endif 213 214ifeq ($(DEBUG),0) 215ifeq ($(CC_NO_CLANG), 0) 216 CORE_CFLAGS += -O3 217else 218 CORE_CFLAGS += -O6 219endif 220endif 221 222ifdef PARSER_DEBUG 223 PARSER_DEBUG_BISON := -t 224 PARSER_DEBUG_FLEX := -d 225 CFLAGS += -DPARSER_DEBUG 226 $(call detected_var,PARSER_DEBUG_BISON) 227 $(call detected_var,PARSER_DEBUG_FLEX) 228endif 229 230# Try different combinations to accommodate systems that only have 231# python[2][-config] in weird combinations but always preferring 232# python2 and python2-config as per pep-0394. If python2 or python 233# aren't found, then python3 is used. 234PYTHON_AUTO := python 235PYTHON_AUTO := $(if $(call get-executable,python3),python3,$(PYTHON_AUTO)) 236PYTHON_AUTO := $(if $(call get-executable,python),python,$(PYTHON_AUTO)) 237PYTHON_AUTO := $(if $(call get-executable,python2),python2,$(PYTHON_AUTO)) 238override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO)) 239PYTHON_AUTO_CONFIG := \ 240 $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) 241override PYTHON_CONFIG := \ 242 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO_CONFIG)) 243 244grep-libs = $(filter -l%,$(1)) 245strip-libs = $(filter-out -l%,$(1)) 246 247PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) 248 249# Python 3.8 changed the output of `python-config --ldflags` to not include the 250# '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for 251# libpython fails if that flag is not included in LDFLAGS 252ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0) 253 PYTHON_CONFIG_LDFLAGS := --ldflags --embed 254else 255 PYTHON_CONFIG_LDFLAGS := --ldflags 256endif 257 258ifdef PYTHON_CONFIG 259 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null) 260 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) 261 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil 262 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) 263 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) 264endif 265 266FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) 267FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) 268FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) 269FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) 270 271FEATURE_CHECK_LDFLAGS-libaio = -lrt 272 273FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl 274 275CORE_CFLAGS += -fno-omit-frame-pointer 276CORE_CFLAGS += -ggdb3 277CORE_CFLAGS += -funwind-tables 278CORE_CFLAGS += -Wall 279CORE_CFLAGS += -Wextra 280CORE_CFLAGS += -std=gnu99 281 282CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti 283CXXFLAGS += -Wall 284CXXFLAGS += -fno-omit-frame-pointer 285CXXFLAGS += -ggdb3 286CXXFLAGS += -funwind-tables 287CXXFLAGS += -Wno-strict-aliasing 288 289# Enforce a non-executable stack, as we may regress (again) in the future by 290# adding assembler files missing the .GNU-stack linker note. 291LDFLAGS += -Wl,-z,noexecstack 292 293EXTLIBS = -lpthread -lrt -lm -ldl 294 295ifneq ($(TCMALLOC),) 296 CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free 297 EXTLIBS += -ltcmalloc 298endif 299 300ifeq ($(FEATURES_DUMP),) 301include $(srctree)/tools/build/Makefile.feature 302else 303include $(FEATURES_DUMP) 304endif 305 306ifeq ($(feature-stackprotector-all), 1) 307 CORE_CFLAGS += -fstack-protector-all 308endif 309 310ifeq ($(DEBUG),0) 311 ifeq ($(feature-fortify-source), 1) 312 CORE_CFLAGS += -D_FORTIFY_SOURCE=2 313 endif 314endif 315 316INC_FLAGS += -I$(srctree)/tools/lib/perf/include 317INC_FLAGS += -I$(src-perf)/util/include 318INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include 319INC_FLAGS += -I$(srctree)/tools/include/ 320INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi 321INC_FLAGS += -I$(srctree)/tools/include/uapi 322INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ 323INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ 324 325# $(obj-perf) for generated common-cmds.h 326# $(obj-perf)/util for generated bison/flex headers 327ifneq ($(OUTPUT),) 328INC_FLAGS += -I$(obj-perf)/util 329INC_FLAGS += -I$(obj-perf) 330endif 331 332INC_FLAGS += -I$(src-perf)/util 333INC_FLAGS += -I$(src-perf) 334INC_FLAGS += -I$(srctree)/tools/lib/ 335 336CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 337 338CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS) 339CXXFLAGS += $(INC_FLAGS) 340 341LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS) 342 343ifeq ($(feature-sync-compare-and-swap), 1) 344 CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT 345endif 346 347ifeq ($(feature-pthread-attr-setaffinity-np), 1) 348 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP 349endif 350 351ifeq ($(feature-pthread-barrier), 1) 352 CFLAGS += -DHAVE_PTHREAD_BARRIER 353endif 354 355ifndef NO_BIONIC 356 $(call feature_check,bionic) 357 ifeq ($(feature-bionic), 1) 358 BIONIC := 1 359 CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE 360 CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE 361 EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) 362 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) 363 endif 364endif 365 366ifeq ($(feature-eventfd), 1) 367 CFLAGS += -DHAVE_EVENTFD_SUPPORT 368endif 369 370ifeq ($(feature-get_current_dir_name), 1) 371 CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME 372endif 373 374ifeq ($(feature-gettid), 1) 375 CFLAGS += -DHAVE_GETTID 376endif 377 378ifeq ($(feature-file-handle), 1) 379 CFLAGS += -DHAVE_FILE_HANDLE 380endif 381 382ifdef NO_LIBELF 383 NO_DWARF := 1 384 NO_DEMANGLE := 1 385 NO_LIBUNWIND := 1 386 NO_LIBDW_DWARF_UNWIND := 1 387 NO_LIBBPF := 1 388 NO_JVMTI := 1 389else 390 ifeq ($(feature-libelf), 0) 391 ifeq ($(feature-glibc), 1) 392 LIBC_SUPPORT := 1 393 endif 394 ifeq ($(BIONIC),1) 395 LIBC_SUPPORT := 1 396 endif 397 ifeq ($(LIBC_SUPPORT),1) 398 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); 399 400 NO_LIBELF := 1 401 NO_DWARF := 1 402 NO_DEMANGLE := 1 403 NO_LIBUNWIND := 1 404 NO_LIBDW_DWARF_UNWIND := 1 405 NO_LIBBPF := 1 406 NO_JVMTI := 1 407 else 408 ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),) 409 ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0) 410 msg := $(error No libasan found, please install libasan); 411 endif 412 endif 413 414 ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),) 415 ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0) 416 msg := $(error No libubsan found, please install libubsan); 417 endif 418 endif 419 420 ifneq ($(filter s% -static%,$(LDFLAGS),),) 421 msg := $(error No static glibc found, please install glibc-static); 422 else 423 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); 424 endif 425 endif 426 else 427 ifndef NO_LIBDW_DWARF_UNWIND 428 ifneq ($(feature-libdw-dwarf-unwind),1) 429 NO_LIBDW_DWARF_UNWIND := 1 430 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR); 431 endif 432 endif 433 ifneq ($(feature-dwarf), 1) 434 ifndef NO_DWARF 435 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); 436 NO_DWARF := 1 437 endif 438 else 439 ifneq ($(feature-dwarf_getlocations), 1) 440 msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157); 441 else 442 CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT 443 endif # dwarf_getlocations 444 endif # Dwarf support 445 endif # libelf support 446endif # NO_LIBELF 447 448ifeq ($(feature-glibc), 1) 449 CFLAGS += -DHAVE_GLIBC_SUPPORT 450endif 451 452ifeq ($(feature-libaio), 1) 453 ifndef NO_AIO 454 CFLAGS += -DHAVE_AIO_SUPPORT 455 endif 456endif 457 458ifdef NO_DWARF 459 NO_LIBDW_DWARF_UNWIND := 1 460endif 461 462ifeq ($(feature-sched_getcpu), 1) 463 CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT 464endif 465 466ifeq ($(feature-setns), 1) 467 CFLAGS += -DHAVE_SETNS_SUPPORT 468 $(call detected,CONFIG_SETNS) 469endif 470 471ifdef CORESIGHT 472 $(call feature_check,libopencsd) 473 ifeq ($(feature-libopencsd), 1) 474 CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) 475 ifeq ($(feature-reallocarray), 0) 476 CFLAGS += -DCOMPAT_NEED_REALLOCARRAY 477 endif 478 LDFLAGS += $(LIBOPENCSD_LDFLAGS) 479 EXTLIBS += $(OPENCSDLIBS) 480 $(call detected,CONFIG_LIBOPENCSD) 481 ifdef CSTRACE_RAW 482 CFLAGS += -DCS_DEBUG_RAW 483 ifeq (${CSTRACE_RAW}, packed) 484 CFLAGS += -DCS_RAW_PACKED 485 endif 486 endif 487 endif 488endif 489 490ifndef NO_LIBELF 491 CFLAGS += -DHAVE_LIBELF_SUPPORT 492 EXTLIBS += -lelf 493 $(call detected,CONFIG_LIBELF) 494 495 ifeq ($(feature-libelf-getphdrnum), 1) 496 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT 497 endif 498 499 ifeq ($(feature-libelf-gelf_getnote), 1) 500 CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT 501 else 502 msg := $(warning gelf_getnote() not found on libelf, SDT support disabled); 503 endif 504 505 ifeq ($(feature-libelf-getshdrstrndx), 1) 506 CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT 507 endif 508 509 ifndef NO_LIBDEBUGINFOD 510 $(call feature_check,libdebuginfod) 511 ifeq ($(feature-libdebuginfod), 1) 512 CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT 513 EXTLIBS += -ldebuginfod 514 endif 515 endif 516 517 ifndef NO_DWARF 518 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 519 msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled); 520 NO_DWARF := 1 521 else 522 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) 523 LDFLAGS += $(LIBDW_LDFLAGS) 524 EXTLIBS += ${DWARFLIBS} 525 $(call detected,CONFIG_DWARF) 526 endif # PERF_HAVE_DWARF_REGS 527 endif # NO_DWARF 528 529 ifndef NO_LIBBPF 530 ifeq ($(feature-bpf), 1) 531 CFLAGS += -DHAVE_LIBBPF_SUPPORT 532 $(call detected,CONFIG_LIBBPF) 533 534 # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status 535 $(call feature_check,libbpf) 536 ifdef LIBBPF_DYNAMIC 537 ifeq ($(feature-libbpf), 1) 538 EXTLIBS += -lbpf 539 else 540 dummy := $(error Error: No libbpf devel library found, please install libbpf-devel); 541 endif 542 endif 543 endif 544 545 ifndef NO_DWARF 546 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET 547 CFLAGS += -DHAVE_BPF_PROLOGUE 548 $(call detected,CONFIG_BPF_PROLOGUE) 549 else 550 msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset()); 551 endif 552 else 553 msg := $(warning DWARF support is off, BPF prologue is disabled); 554 endif 555 556 endif # NO_LIBBPF 557endif # NO_LIBELF 558 559ifndef NO_SDT 560 ifneq ($(feature-sdt), 1) 561 msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev); 562 NO_SDT := 1; 563 else 564 CFLAGS += -DHAVE_SDT_EVENT 565 $(call detected,CONFIG_SDT_EVENT) 566 endif 567endif 568 569ifdef PERF_HAVE_JITDUMP 570 ifndef NO_LIBELF 571 $(call detected,CONFIG_JITDUMP) 572 CFLAGS += -DHAVE_JITDUMP 573 endif 574endif 575 576ifeq ($(SRCARCH),powerpc) 577 ifndef NO_DWARF 578 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX 579 endif 580endif 581 582ifndef NO_LIBUNWIND 583 have_libunwind := 584 585 $(call feature_check,libunwind-x86) 586 ifeq ($(feature-libunwind-x86), 1) 587 $(call detected,CONFIG_LIBUNWIND_X86) 588 CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT 589 LDFLAGS += -lunwind-x86 590 EXTLIBS_LIBUNWIND += -lunwind-x86 591 have_libunwind = 1 592 endif 593 594 $(call feature_check,libunwind-aarch64) 595 ifeq ($(feature-libunwind-aarch64), 1) 596 $(call detected,CONFIG_LIBUNWIND_AARCH64) 597 CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT 598 LDFLAGS += -lunwind-aarch64 599 EXTLIBS_LIBUNWIND += -lunwind-aarch64 600 have_libunwind = 1 601 $(call feature_check,libunwind-debug-frame-aarch64) 602 ifneq ($(feature-libunwind-debug-frame-aarch64), 1) 603 msg := $(warning No debug_frame support found in libunwind-aarch64); 604 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64 605 endif 606 endif 607 608 ifneq ($(feature-libunwind), 1) 609 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR); 610 NO_LOCAL_LIBUNWIND := 1 611 else 612 have_libunwind := 1 613 $(call detected,CONFIG_LOCAL_LIBUNWIND) 614 endif 615 616 ifneq ($(have_libunwind), 1) 617 NO_LIBUNWIND := 1 618 endif 619else 620 NO_LOCAL_LIBUNWIND := 1 621endif 622 623ifndef NO_LIBBPF 624 ifneq ($(feature-bpf), 1) 625 msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.) 626 NO_LIBBPF := 1 627 endif 628endif 629 630ifdef BUILD_BPF_SKEL 631 $(call feature_check,clang-bpf-co-re) 632 ifeq ($(feature-clang-bpf-co-re), 0) 633 dummy := $(error Error: clang too old. Please install recent clang) 634 endif 635 $(call detected,CONFIG_PERF_BPF_SKEL) 636 CFLAGS += -DHAVE_BPF_SKEL 637endif 638 639dwarf-post-unwind := 1 640dwarf-post-unwind-text := BUG 641 642# setup DWARF post unwinder 643ifdef NO_LIBUNWIND 644 ifdef NO_LIBDW_DWARF_UNWIND 645 msg := $(warning Disabling post unwind, no support found.); 646 dwarf-post-unwind := 0 647 else 648 dwarf-post-unwind-text := libdw 649 $(call detected,CONFIG_LIBDW_DWARF_UNWIND) 650 endif 651else 652 dwarf-post-unwind-text := libunwind 653 $(call detected,CONFIG_LIBUNWIND) 654 # Enable libunwind support by default. 655 ifndef NO_LIBDW_DWARF_UNWIND 656 NO_LIBDW_DWARF_UNWIND := 1 657 endif 658endif 659 660ifeq ($(dwarf-post-unwind),1) 661 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT 662 $(call detected,CONFIG_DWARF_UNWIND) 663else 664 NO_DWARF_UNWIND := 1 665endif 666 667ifndef NO_LOCAL_LIBUNWIND 668 ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64)) 669 $(call feature_check,libunwind-debug-frame) 670 ifneq ($(feature-libunwind-debug-frame), 1) 671 msg := $(warning No debug_frame support found in libunwind); 672 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME 673 endif 674 else 675 # non-ARM has no dwarf_find_debug_frame() function: 676 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME 677 endif 678 EXTLIBS += $(LIBUNWIND_LIBS) 679 LDFLAGS += $(LIBUNWIND_LIBS) 680endif 681ifeq ($(findstring -static,${LDFLAGS}),-static) 682 # gcc -static links libgcc_eh which contans piece of libunwind 683 LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition 684endif 685 686ifndef NO_LIBUNWIND 687 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT 688 CFLAGS += $(LIBUNWIND_CFLAGS) 689 LDFLAGS += $(LIBUNWIND_LDFLAGS) 690 EXTLIBS += $(EXTLIBS_LIBUNWIND) 691endif 692 693ifeq ($(NO_SYSCALL_TABLE),0) 694 $(call detected,CONFIG_TRACE) 695else 696 ifndef NO_LIBAUDIT 697 $(call feature_check,libaudit) 698 ifneq ($(feature-libaudit), 1) 699 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); 700 NO_LIBAUDIT := 1 701 else 702 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT 703 EXTLIBS += -laudit 704 $(call detected,CONFIG_TRACE) 705 endif 706 endif 707endif 708 709ifndef NO_LIBCRYPTO 710 ifneq ($(feature-libcrypto), 1) 711 msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev); 712 NO_LIBCRYPTO := 1 713 else 714 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT 715 EXTLIBS += -lcrypto 716 $(call detected,CONFIG_CRYPTO) 717 endif 718endif 719 720ifdef NO_NEWT 721 NO_SLANG=1 722endif 723 724ifndef NO_SLANG 725 ifneq ($(feature-libslang), 1) 726 ifneq ($(feature-libslang-include-subdir), 1) 727 msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev); 728 NO_SLANG := 1 729 else 730 CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR 731 endif 732 endif 733 ifndef NO_SLANG 734 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h 735 CFLAGS += -DHAVE_SLANG_SUPPORT 736 EXTLIBS += -lslang 737 $(call detected,CONFIG_SLANG) 738 endif 739endif 740 741ifdef GTK2 742 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) 743 $(call feature_check,gtk2) 744 ifneq ($(feature-gtk2), 1) 745 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); 746 NO_GTK2 := 1 747 else 748 $(call feature_check,gtk2-infobar) 749 ifeq ($(feature-gtk2-infobar), 1) 750 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT 751 endif 752 CFLAGS += -DHAVE_GTK2_SUPPORT 753 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) 754 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) 755 EXTLIBS += -ldl 756 endif 757endif 758 759ifdef NO_LIBPERL 760 CFLAGS += -DNO_LIBPERL 761else 762 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) 763 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) 764 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) 765 PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) 766 PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) 767 PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) 768 PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) 769 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) 770 771 ifneq ($(feature-libperl), 1) 772 CFLAGS += -DNO_LIBPERL 773 NO_LIBPERL := 1 774 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev); 775 else 776 LDFLAGS += $(PERL_EMBED_LDFLAGS) 777 EXTLIBS += $(PERL_EMBED_LIBADD) 778 CFLAGS += -DHAVE_LIBPERL_SUPPORT 779 $(call detected,CONFIG_LIBPERL) 780 endif 781endif 782 783ifeq ($(feature-timerfd), 1) 784 CFLAGS += -DHAVE_TIMERFD_SUPPORT 785else 786 msg := $(warning No timerfd support. Disables 'perf kvm stat live'); 787endif 788 789disable-python = $(eval $(disable-python_code)) 790define disable-python_code 791 CFLAGS += -DNO_LIBPYTHON 792 $(warning $1) 793 NO_LIBPYTHON := 1 794endef 795 796ifdef NO_LIBPYTHON 797 $(call disable-python,Python support disabled by user) 798else 799 800 ifndef PYTHON 801 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev) 802 else 803 PYTHON_WORD := $(call shell-wordify,$(PYTHON)) 804 805 ifndef PYTHON_CONFIG 806 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) 807 else 808 809 ifneq ($(feature-libpython), 1) 810 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) 811 else 812 LDFLAGS += $(PYTHON_EMBED_LDFLAGS) 813 EXTLIBS += $(PYTHON_EMBED_LIBADD) 814 LANG_BINDINGS += $(obj-perf)python/perf.so 815 CFLAGS += -DHAVE_LIBPYTHON_SUPPORT 816 $(call detected,CONFIG_LIBPYTHON) 817 endif 818 endif 819 endif 820endif 821 822ifeq ($(feature-libbfd), 1) 823 EXTLIBS += -lbfd -lopcodes 824else 825 # we are on a system that requires -liberty and (maybe) -lz 826 # to link against -lbfd; test each case individually here 827 828 # call all detections now so we get correct 829 # status in VF output 830 $(call feature_check,libbfd-liberty) 831 $(call feature_check,libbfd-liberty-z) 832 833 ifeq ($(feature-libbfd-liberty), 1) 834 EXTLIBS += -lbfd -lopcodes -liberty 835 FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl 836 else 837 ifeq ($(feature-libbfd-liberty-z), 1) 838 EXTLIBS += -lbfd -lopcodes -liberty -lz 839 FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl 840 endif 841 endif 842 $(call feature_check,disassembler-four-args) 843endif 844 845ifeq ($(feature-libbfd-buildid), 1) 846 CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT 847else 848 msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available); 849endif 850 851ifdef NO_DEMANGLE 852 CFLAGS += -DNO_DEMANGLE 853else 854 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT 855 EXTLIBS += -liberty 856 else 857 ifeq ($(filter -liberty,$(EXTLIBS)),) 858 $(call feature_check,cplus-demangle) 859 860 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT 861 # or any of 'bfd iberty z' trinity 862 ifeq ($(feature-cplus-demangle), 1) 863 EXTLIBS += -liberty 864 else 865 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) 866 CFLAGS += -DNO_DEMANGLE 867 endif 868 endif 869 endif 870 871 ifneq ($(filter -liberty,$(EXTLIBS)),) 872 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT 873 endif 874endif 875 876ifneq ($(filter -lbfd,$(EXTLIBS)),) 877 CFLAGS += -DHAVE_LIBBFD_SUPPORT 878endif 879 880ifndef NO_ZLIB 881 ifeq ($(feature-zlib), 1) 882 CFLAGS += -DHAVE_ZLIB_SUPPORT 883 EXTLIBS += -lz 884 $(call detected,CONFIG_ZLIB) 885 else 886 NO_ZLIB := 1 887 endif 888endif 889 890ifndef NO_LZMA 891 ifeq ($(feature-lzma), 1) 892 CFLAGS += -DHAVE_LZMA_SUPPORT 893 EXTLIBS += -llzma 894 $(call detected,CONFIG_LZMA) 895 else 896 msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev); 897 NO_LZMA := 1 898 endif 899endif 900 901ifndef NO_LIBZSTD 902 ifeq ($(feature-libzstd), 1) 903 CFLAGS += -DHAVE_ZSTD_SUPPORT 904 CFLAGS += $(LIBZSTD_CFLAGS) 905 LDFLAGS += $(LIBZSTD_LDFLAGS) 906 EXTLIBS += -lzstd 907 $(call detected,CONFIG_ZSTD) 908 else 909 msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR); 910 NO_LIBZSTD := 1 911 endif 912endif 913 914ifndef NO_LIBCAP 915 ifeq ($(feature-libcap), 1) 916 CFLAGS += -DHAVE_LIBCAP_SUPPORT 917 EXTLIBS += -lcap 918 $(call detected,CONFIG_LIBCAP) 919 else 920 msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev); 921 NO_LIBCAP := 1 922 endif 923endif 924 925ifndef NO_BACKTRACE 926 ifeq ($(feature-backtrace), 1) 927 CFLAGS += -DHAVE_BACKTRACE_SUPPORT 928 endif 929endif 930 931ifndef NO_LIBNUMA 932 ifeq ($(feature-libnuma), 0) 933 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev); 934 NO_LIBNUMA := 1 935 else 936 ifeq ($(feature-numa_num_possible_cpus), 0) 937 msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8); 938 NO_LIBNUMA := 1 939 else 940 CFLAGS += -DHAVE_LIBNUMA_SUPPORT 941 EXTLIBS += -lnuma 942 $(call detected,CONFIG_NUMA) 943 endif 944 endif 945endif 946 947ifdef HAVE_KVM_STAT_SUPPORT 948 CFLAGS += -DHAVE_KVM_STAT_SUPPORT 949endif 950 951ifeq ($(feature-disassembler-four-args), 1) 952 CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE 953endif 954 955ifeq (${IS_64_BIT}, 1) 956 ifndef NO_PERF_READ_VDSO32 957 $(call feature_check,compile-32) 958 ifeq ($(feature-compile-32), 1) 959 CFLAGS += -DHAVE_PERF_READ_VDSO32 960 else 961 NO_PERF_READ_VDSO32 := 1 962 endif 963 endif 964 ifneq ($(SRCARCH), x86) 965 NO_PERF_READ_VDSOX32 := 1 966 endif 967 ifndef NO_PERF_READ_VDSOX32 968 $(call feature_check,compile-x32) 969 ifeq ($(feature-compile-x32), 1) 970 CFLAGS += -DHAVE_PERF_READ_VDSOX32 971 else 972 NO_PERF_READ_VDSOX32 := 1 973 endif 974 endif 975else 976 NO_PERF_READ_VDSO32 := 1 977 NO_PERF_READ_VDSOX32 := 1 978endif 979 980ifndef NO_LIBBABELTRACE 981 $(call feature_check,libbabeltrace) 982 ifeq ($(feature-libbabeltrace), 1) 983 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS) 984 LDFLAGS += $(LIBBABELTRACE_LDFLAGS) 985 EXTLIBS += -lbabeltrace-ctf 986 $(call detected,CONFIG_LIBBABELTRACE) 987 else 988 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev); 989 endif 990endif 991 992ifndef NO_AUXTRACE 993 ifeq ($(SRCARCH),x86) 994 ifeq ($(feature-get_cpuid), 0) 995 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); 996 NO_AUXTRACE := 1 997 endif 998 endif 999 ifndef NO_AUXTRACE 1000 $(call detected,CONFIG_AUXTRACE) 1001 CFLAGS += -DHAVE_AUXTRACE_SUPPORT 1002 endif 1003endif 1004 1005ifndef NO_JVMTI 1006 ifneq (,$(wildcard /usr/sbin/update-java-alternatives)) 1007 JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}') 1008 else 1009 ifneq (,$(wildcard /usr/sbin/alternatives)) 1010 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') 1011 endif 1012 endif 1013 ifndef JDIR 1014 $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory) 1015 NO_JVMTI := 1 1016 endif 1017endif 1018 1019ifndef NO_JVMTI 1020 FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux 1021 $(call feature_check,jvmti) 1022 ifeq ($(feature-jvmti), 1) 1023 $(call detected_var,JDIR) 1024 ifndef NO_JVMTI_CMLR 1025 FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti) 1026 $(call feature_check,jvmti-cmlr) 1027 ifeq ($(feature-jvmti-cmlr), 1) 1028 CFLAGS += -DHAVE_JVMTI_CMLR 1029 endif 1030 endif # NO_JVMTI_CMLR 1031 else 1032 $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel) 1033 NO_JVMTI := 1 1034 endif 1035endif 1036 1037USE_CXX = 0 1038USE_CLANGLLVM = 0 1039ifdef LIBCLANGLLVM 1040 $(call feature_check,cxx) 1041 ifneq ($(feature-cxx), 1) 1042 msg := $(warning No g++ found, disable clang and llvm support. Please install g++) 1043 else 1044 $(call feature_check,llvm) 1045 $(call feature_check,llvm-version) 1046 ifneq ($(feature-llvm), 1) 1047 msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0)) 1048 else 1049 $(call feature_check,clang) 1050 ifneq ($(feature-clang), 1) 1051 msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0)) 1052 else 1053 CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT 1054 CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir) 1055 $(call detected,CONFIG_CXX) 1056 $(call detected,CONFIG_CLANGLLVM) 1057 USE_CXX = 1 1058 USE_LLVM = 1 1059 USE_CLANG = 1 1060 ifneq ($(feature-llvm-version),1) 1061 msg := $(warning This version of LLVM is not tested. May cause build errors) 1062 endif 1063 endif 1064 endif 1065 endif 1066endif 1067 1068ifdef LIBPFM4 1069 $(call feature_check,libpfm4) 1070 ifeq ($(feature-libpfm4), 1) 1071 CFLAGS += -DHAVE_LIBPFM 1072 EXTLIBS += -lpfm 1073 ASCIIDOC_EXTRA = -aHAVE_LIBPFM=1 1074 $(call detected,CONFIG_LIBPFM4) 1075 else 1076 msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev); 1077 NO_LIBPFM4 := 1 1078 endif 1079endif 1080 1081# Among the variables below, these: 1082# perfexecdir 1083# perf_include_dir 1084# perf_examples_dir 1085# template_dir 1086# mandir 1087# infodir 1088# htmldir 1089# ETC_PERFCONFIG (but not sysconfdir) 1090# can be specified as a relative path some/where/else; 1091# this is interpreted as relative to $(prefix) and "perf" at 1092# runtime figures out where they are based on the path to the executable. 1093# This can help installing the suite in a relocatable way. 1094 1095# Make the path relative to DESTDIR, not to prefix 1096ifndef DESTDIR 1097prefix ?= $(HOME) 1098endif 1099bindir_relative = bin 1100bindir = $(abspath $(prefix)/$(bindir_relative)) 1101mandir = share/man 1102infodir = share/info 1103perfexecdir = libexec/perf-core 1104perf_include_dir = lib/perf/include 1105perf_examples_dir = lib/perf/examples 1106sharedir = $(prefix)/share 1107template_dir = share/perf-core/templates 1108STRACE_GROUPS_DIR = share/perf-core/strace/groups 1109htmldir = share/doc/perf-doc 1110tipdir = share/doc/perf-tip 1111srcdir = $(srctree)/tools/perf 1112ifeq ($(prefix),/usr) 1113sysconfdir = /etc 1114ETC_PERFCONFIG = $(sysconfdir)/perfconfig 1115else 1116sysconfdir = $(prefix)/etc 1117ETC_PERFCONFIG = etc/perfconfig 1118endif 1119ifndef lib 1120ifeq ($(SRCARCH)$(IS_64_BIT), x861) 1121lib = lib64 1122else 1123lib = lib 1124endif 1125endif # lib 1126libdir = $(prefix)/$(lib) 1127 1128# Shell quote (do not use $(call) to accommodate ancient setups); 1129ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) 1130STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR)) 1131DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) 1132bindir_SQ = $(subst ','\'',$(bindir)) 1133mandir_SQ = $(subst ','\'',$(mandir)) 1134infodir_SQ = $(subst ','\'',$(infodir)) 1135perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) 1136perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir)) 1137perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir)) 1138template_dir_SQ = $(subst ','\'',$(template_dir)) 1139htmldir_SQ = $(subst ','\'',$(htmldir)) 1140tipdir_SQ = $(subst ','\'',$(tipdir)) 1141prefix_SQ = $(subst ','\'',$(prefix)) 1142sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) 1143libdir_SQ = $(subst ','\'',$(libdir)) 1144srcdir_SQ = $(subst ','\'',$(srcdir)) 1145 1146ifneq ($(filter /%,$(firstword $(perfexecdir))),) 1147perfexec_instdir = $(perfexecdir) 1148perf_include_instdir = $(perf_include_dir) 1149perf_examples_instdir = $(perf_examples_dir) 1150STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR) 1151tip_instdir = $(tipdir) 1152else 1153perfexec_instdir = $(prefix)/$(perfexecdir) 1154perf_include_instdir = $(prefix)/$(perf_include_dir) 1155perf_examples_instdir = $(prefix)/$(perf_examples_dir) 1156STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR) 1157tip_instdir = $(prefix)/$(tipdir) 1158endif 1159perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) 1160perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir)) 1161perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir)) 1162STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR)) 1163tip_instdir_SQ = $(subst ','\'',$(tip_instdir)) 1164 1165# If we install to $(HOME) we keep the traceevent default: 1166# $(HOME)/.traceevent/plugins 1167# Otherwise we install plugins into the global $(libdir). 1168ifdef DESTDIR 1169plugindir=$(libdir)/traceevent/plugins 1170plugindir_SQ= $(subst ','\'',$(plugindir)) 1171endif 1172 1173print_var = $(eval $(print_var_code)) $(info $(MSG)) 1174define print_var_code 1175 MSG = $(shell printf '...%30s: %s' $(1) $($(1))) 1176endef 1177 1178ifeq ($(VF),1) 1179 # Display EXTRA features which are detected manualy 1180 # from here with feature_check call and thus cannot 1181 # be partof global state output. 1182 $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),)) 1183 $(call print_var,prefix) 1184 $(call print_var,bindir) 1185 $(call print_var,libdir) 1186 $(call print_var,sysconfdir) 1187 $(call print_var,LIBUNWIND_DIR) 1188 $(call print_var,LIBDW_DIR) 1189 $(call print_var,JDIR) 1190 1191 ifeq ($(dwarf-post-unwind),1) 1192 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text)) 1193 endif 1194 $(info ) 1195endif 1196 1197$(call detected_var,bindir_SQ) 1198$(call detected_var,PYTHON_WORD) 1199ifneq ($(OUTPUT),) 1200$(call detected_var,OUTPUT) 1201endif 1202$(call detected_var,htmldir_SQ) 1203$(call detected_var,infodir_SQ) 1204$(call detected_var,mandir_SQ) 1205$(call detected_var,ETC_PERFCONFIG_SQ) 1206$(call detected_var,STRACE_GROUPS_DIR_SQ) 1207$(call detected_var,prefix_SQ) 1208$(call detected_var,perfexecdir_SQ) 1209$(call detected_var,perf_include_dir_SQ) 1210$(call detected_var,perf_examples_dir_SQ) 1211$(call detected_var,tipdir_SQ) 1212$(call detected_var,srcdir_SQ) 1213$(call detected_var,LIBDIR) 1214$(call detected_var,GTK_CFLAGS) 1215$(call detected_var,PERL_EMBED_CCOPTS) 1216$(call detected_var,PYTHON_EMBED_CCOPTS) 1217