Thomas Gleixner | ec8f24b | 2019-05-19 13:07:45 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0-only |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 2 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 3 | ifeq ($(src-perf),) |
| 4 | src-perf := $(srctree)/tools/perf |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 5 | endif |
| 6 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 7 | ifeq ($(obj-perf),) |
| 8 | obj-perf := $(OUTPUT) |
| 9 | endif |
| 10 | |
| 11 | ifneq ($(obj-perf),) |
| 12 | obj-perf := $(abspath $(obj-perf))/ |
| 13 | endif |
| 14 | |
Sergei Trofimovich | 52c0a18 | 2015-07-19 10:30:05 +0100 | [diff] [blame] | 15 | $(shell printf "" > $(OUTPUT).config-detected) |
Aaro Koskinen | 64227379 | 2015-07-01 14:54:42 +0300 | [diff] [blame] | 16 | detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) |
| 17 | detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) |
Jiri Olsa | fcfd661 | 2014-12-31 17:37:00 +0100 | [diff] [blame] | 18 | |
Vasily Gorbik | ab0a40e | 2020-10-09 14:25:23 +0200 | [diff] [blame] | 19 | CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) |
John Garry | c77a78c | 2021-10-30 00:30:41 +0800 | [diff] [blame] | 20 | HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 21 | |
Wang Nan | 935e6bd | 2016-01-11 13:47:58 +0000 | [diff] [blame] | 22 | include $(srctree)/tools/scripts/Makefile.arch |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 23 | |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 24 | $(call detected_var,SRCARCH) |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 25 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 26 | NO_PERF_REGS := 1 |
Arnaldo Carvalho de Melo | 9b90d97 | 2020-05-28 11:47:24 -0300 | [diff] [blame] | 27 | |
Arnaldo Carvalho de Melo | 9b90d97 | 2020-05-28 11:47:24 -0300 | [diff] [blame] | 28 | ifneq ($(NO_SYSCALL_TABLE),1) |
Arnaldo Carvalho de Melo | 43de386 | 2020-05-28 12:03:40 -0300 | [diff] [blame] | 29 | NO_SYSCALL_TABLE := 1 |
| 30 | |
| 31 | ifeq ($(SRCARCH),x86) |
| 32 | ifeq (${IS_64_BIT}, 1) |
| 33 | NO_SYSCALL_TABLE := 0 |
| 34 | endif |
| 35 | else |
Tiezhu Yang | d9fd5a7 | 2021-02-04 11:35:24 +0800 | [diff] [blame] | 36 | ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc arm64 s390 mips)) |
Arnaldo Carvalho de Melo | 43de386 | 2020-05-28 12:03:40 -0300 | [diff] [blame] | 37 | NO_SYSCALL_TABLE := 0 |
| 38 | endif |
| 39 | endif |
| 40 | |
| 41 | ifneq ($(NO_SYSCALL_TABLE),1) |
| 42 | CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT |
| 43 | endif |
Arnaldo Carvalho de Melo | 9b90d97 | 2020-05-28 11:47:24 -0300 | [diff] [blame] | 44 | endif |
| 45 | |
Anju T | dc642e8 | 2016-02-20 10:32:47 +0530 | [diff] [blame] | 46 | # Additional ARCH settings for ppc |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 47 | ifeq ($(SRCARCH),powerpc) |
Anju T | dc642e8 | 2016-02-20 10:32:47 +0530 | [diff] [blame] | 48 | NO_PERF_REGS := 0 |
Ravi Bangoria | 4281da2 | 2018-01-29 14:04:17 +0530 | [diff] [blame] | 49 | CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated |
Chandan Kumar | c452246 | 2016-04-28 15:01:09 +0530 | [diff] [blame] | 50 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 |
Anju T | dc642e8 | 2016-02-20 10:32:47 +0530 | [diff] [blame] | 51 | endif |
| 52 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 53 | # Additional ARCH settings for x86 |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 54 | ifeq ($(SRCARCH),x86) |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 55 | $(call detected,CONFIG_X86) |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 56 | ifeq (${IS_64_BIT}, 1) |
Hendrik Brueckner | 901bb02 | 2017-12-07 09:27:59 +0100 | [diff] [blame] | 57 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 58 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S |
Konstantin Khlebnikov | 60913e0 | 2017-08-20 14:39:32 +0300 | [diff] [blame] | 59 | LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 60 | $(call detected,CONFIG_X86_64) |
Adrian Hunter | 8a0c4c2 | 2013-11-01 15:51:32 +0200 | [diff] [blame] | 61 | else |
Adrian Hunter | 05b4177 | 2015-05-19 16:05:43 +0300 | [diff] [blame] | 62 | LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 63 | endif |
| 64 | NO_PERF_REGS := 0 |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 65 | endif |
Jean Pihet | 8ab596a | 2014-04-28 14:32:33 +0200 | [diff] [blame] | 66 | |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 67 | ifeq ($(SRCARCH),arm) |
Will Deacon | 7495f37 | 2013-09-26 12:36:36 +0100 | [diff] [blame] | 68 | NO_PERF_REGS := 0 |
| 69 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
| 70 | endif |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 71 | |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 72 | ifeq ($(SRCARCH),arm64) |
Jean Pihet | 8ab596a | 2014-04-28 14:32:33 +0200 | [diff] [blame] | 73 | NO_PERF_REGS := 0 |
Kim Phillips | a7f660d | 2018-07-06 16:34:54 -0500 | [diff] [blame] | 74 | CFLAGS += -I$(OUTPUT)arch/arm64/include/generated |
Jean Pihet | 8ab596a | 2014-04-28 14:32:33 +0200 | [diff] [blame] | 75 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
| 76 | endif |
| 77 | |
Mao Han | 51bc620 | 2019-09-05 11:46:36 +0800 | [diff] [blame] | 78 | ifeq ($(SRCARCH),riscv) |
| 79 | NO_PERF_REGS := 0 |
| 80 | endif |
| 81 | |
Mao Han | 3213486 | 2019-04-15 17:17:30 +0800 | [diff] [blame] | 82 | ifeq ($(SRCARCH),csky) |
| 83 | NO_PERF_REGS := 0 |
| 84 | endif |
| 85 | |
Heiko Carstens | f704ef4 | 2016-01-19 11:23:38 +0100 | [diff] [blame] | 86 | ifeq ($(ARCH),s390) |
| 87 | NO_PERF_REGS := 0 |
Hendrik Brueckner | a9a3f1d | 2017-12-13 17:46:54 -0300 | [diff] [blame] | 88 | CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated |
Heiko Carstens | f704ef4 | 2016-01-19 11:23:38 +0100 | [diff] [blame] | 89 | endif |
| 90 | |
Tiezhu Yang | b5f184f | 2021-02-04 11:35:23 +0800 | [diff] [blame] | 91 | ifeq ($(ARCH),mips) |
| 92 | NO_PERF_REGS := 0 |
Tiezhu Yang | d9fd5a7 | 2021-02-04 11:35:24 +0800 | [diff] [blame] | 93 | CFLAGS += -I$(OUTPUT)arch/mips/include/generated |
Tiezhu Yang | b5f184f | 2021-02-04 11:35:23 +0800 | [diff] [blame] | 94 | LIBUNWIND_LIBS = -lunwind -lunwind-mips |
| 95 | endif |
| 96 | |
Jiri Olsa | 3bc3374 | 2014-12-30 13:30:04 +0100 | [diff] [blame] | 97 | ifeq ($(NO_PERF_REGS),0) |
| 98 | $(call detected,CONFIG_PERF_REGS) |
| 99 | endif |
| 100 | |
Jean Pihet | 90fa9de | 2014-05-16 10:41:11 +0200 | [diff] [blame] | 101 | # So far there's only x86 and arm libdw unwind support merged in perf. |
Jiri Olsa | 4dc549e | 2014-04-20 10:50:00 +0200 | [diff] [blame] | 102 | # Disable it on all other architectures in case libdw unwind |
| 103 | # support is detected in system. Add supported architectures |
| 104 | # to the check. |
Mao Han | 51bc620 | 2019-09-05 11:46:36 +0800 | [diff] [blame] | 105 | ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv)) |
Jiri Olsa | 4dc549e | 2014-04-20 10:50:00 +0200 | [diff] [blame] | 106 | NO_LIBDW_DWARF_UNWIND := 1 |
| 107 | endif |
| 108 | |
Jean Pihet | 1448fef | 2013-12-10 13:24:04 +0100 | [diff] [blame] | 109 | ifeq ($(LIBUNWIND_LIBS),) |
| 110 | NO_LIBUNWIND := 1 |
Jean Pihet | 1448fef | 2013-12-10 13:24:04 +0100 | [diff] [blame] | 111 | endif |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 112 | # |
| 113 | # For linking with debug library, run like: |
| 114 | # |
| 115 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ |
| 116 | # |
He Kuang | 195106b | 2016-06-03 03:33:10 +0000 | [diff] [blame] | 117 | |
| 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 |
| 122 | endef |
| 123 | |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 124 | ifdef LIBUNWIND_DIR |
| 125 | LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include |
| 126 | LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib |
He Kuang | 195106b | 2016-06-03 03:33:10 +0000 | [diff] [blame] | 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))) |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 129 | endif |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 130 | |
| 131 | # Set per-feature check compilation flags |
| 132 | FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS) |
He Kuang | 403cacb | 2016-06-03 03:33:14 +0000 | [diff] [blame] | 133 | FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 134 | FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) |
He Kuang | 403cacb | 2016-06-03 03:33:14 +0000 | [diff] [blame] | 135 | FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) |
Jean Pihet | 1448fef | 2013-12-10 13:24:04 +0100 | [diff] [blame] | 136 | |
Li Huafei | cdf32b4 | 2021-08-23 21:43:40 +0800 | [diff] [blame] | 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 |
Arnaldo Carvalho de Melo | 5c4d7c8 | 2019-02-12 16:34:32 -0300 | [diff] [blame] | 141 | |
Arnaldo Carvalho de Melo | 271402a | 2019-02-12 16:19:45 -0300 | [diff] [blame] | 142 | FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto |
| 143 | |
Mathieu Poirier | aa6292f | 2018-01-17 10:52:10 -0700 | [diff] [blame] | 144 | ifdef CSINCLUDES |
| 145 | LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) |
| 146 | endif |
Uwe Kleine-König | ed17b19 | 2021-12-03 22:05:44 +0100 | [diff] [blame] | 147 | OPENCSDLIBS := -lopencsd_c_api |
| 148 | ifeq ($(findstring -static,${LDFLAGS}),-static) |
| 149 | OPENCSDLIBS += -lopencsd -lstdc++ |
| 150 | endif |
Mathieu Poirier | aa6292f | 2018-01-17 10:52:10 -0700 | [diff] [blame] | 151 | ifdef CSLIBS |
| 152 | LIBOPENCSD_LDFLAGS := -L$(CSLIBS) |
| 153 | endif |
| 154 | FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS) |
| 155 | FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS) |
| 156 | |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 157 | ifeq ($(NO_PERF_REGS),0) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 158 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 159 | endif |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 160 | |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 161 | # for linking with debug library, run like: |
| 162 | # make DEBUG=1 LIBDW_DIR=/opt/libdw/ |
| 163 | ifdef LIBDW_DIR |
| 164 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include |
| 165 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib |
Jiri Olsa | 4575789 | 2014-02-19 16:52:56 +0100 | [diff] [blame] | 166 | endif |
Konstantin Khlebnikov | ba335df | 2017-08-20 14:39:27 +0300 | [diff] [blame] | 167 | DWARFLIBS := -ldw |
| 168 | ifeq ($(findstring -static,${LDFLAGS}),-static) |
| 169 | DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2 |
| 170 | endif |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 171 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) |
Konstantin Khlebnikov | ba335df | 2017-08-20 14:39:27 +0300 | [diff] [blame] | 172 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS) |
Jiri Olsa | 4575789 | 2014-02-19 16:52:56 +0100 | [diff] [blame] | 173 | |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 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 |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 179 | endif |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 180 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
| 181 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 182 | |
Alexey Budankov | 3b1c5d9 | 2019-03-18 20:39:49 +0300 | [diff] [blame] | 183 | ifdef LIBZSTD_DIR |
| 184 | LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib |
| 185 | LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib |
| 186 | endif |
| 187 | FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) |
| 188 | FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) |
| 189 | |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 190 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 191 | # include ARCH specific config |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 192 | -include $(src-perf)/arch/$(SRCARCH)/Makefile |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 193 | |
Wang Nan | 63ab024 | 2015-09-14 23:02:49 -0300 | [diff] [blame] | 194 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
| 195 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
| 196 | endif |
| 197 | |
Arnaldo Carvalho de Melo | ca70c24 | 2016-03-18 13:57:20 -0300 | [diff] [blame] | 198 | include $(srctree)/tools/scripts/utilities.mak |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 199 | |
| 200 | ifeq ($(call get-executable,$(FLEX)),) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 201 | dummy := $(error Error: $(FLEX) is missing on this system, please install it) |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 202 | endif |
| 203 | |
| 204 | ifeq ($(call get-executable,$(BISON)),) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 205 | dummy := $(error Error: $(BISON) is missing on this system, please install it) |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 206 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 207 | |
Denys Zagorui | 6793672 | 2021-05-24 04:15:14 -0700 | [diff] [blame] | 208 | ifneq ($(OUTPUT),) |
| 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)= |
| 211 | endif |
| 212 | endif |
| 213 | |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 214 | # Treat warnings as errors unless directed not to |
| 215 | ifneq ($(WERROR),0) |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 216 | CORE_CFLAGS += -Werror |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 217 | CXXFLAGS += -Werror |
John Garry | c77a78c | 2021-10-30 00:30:41 +0800 | [diff] [blame] | 218 | HOSTCFLAGS += -Werror |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 219 | endif |
| 220 | |
Adrian Hunter | 74af377 | 2013-10-22 10:34:05 +0300 | [diff] [blame] | 221 | ifndef DEBUG |
| 222 | DEBUG := 0 |
| 223 | endif |
| 224 | |
Ingo Molnar | fcf9258 | 2013-10-10 08:05:25 +0200 | [diff] [blame] | 225 | ifeq ($(DEBUG),0) |
David Carrillo-Cisneros | 3866058 | 2017-08-27 00:54:40 -0700 | [diff] [blame] | 226 | ifeq ($(CC_NO_CLANG), 0) |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 227 | CORE_CFLAGS += -O3 |
Arnaldo Carvalho de Melo | 49b3cd3 | 2017-02-14 10:55:27 -0300 | [diff] [blame] | 228 | else |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 229 | CORE_CFLAGS += -O6 |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 230 | endif |
Arnaldo Carvalho de Melo | 49b3cd3 | 2017-02-14 10:55:27 -0300 | [diff] [blame] | 231 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 232 | |
| 233 | ifdef PARSER_DEBUG |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 234 | PARSER_DEBUG_BISON := -t |
| 235 | PARSER_DEBUG_FLEX := -d |
| 236 | CFLAGS += -DPARSER_DEBUG |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 237 | $(call detected_var,PARSER_DEBUG_BISON) |
| 238 | $(call detected_var,PARSER_DEBUG_FLEX) |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 239 | endif |
| 240 | |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 241 | # Try different combinations to accommodate systems that only have |
| 242 | # python[2][-config] in weird combinations but always preferring |
James Clark | 7937308 | 2020-10-05 09:06:45 +0100 | [diff] [blame] | 243 | # python2 and python2-config as per pep-0394. If python2 or python |
| 244 | # aren't found, then python3 is used. |
| 245 | PYTHON_AUTO := python |
| 246 | PYTHON_AUTO := $(if $(call get-executable,python3),python3,$(PYTHON_AUTO)) |
| 247 | PYTHON_AUTO := $(if $(call get-executable,python),python,$(PYTHON_AUTO)) |
| 248 | PYTHON_AUTO := $(if $(call get-executable,python2),python2,$(PYTHON_AUTO)) |
| 249 | override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO)) |
| 250 | PYTHON_AUTO_CONFIG := \ |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 251 | $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) |
| 252 | override PYTHON_CONFIG := \ |
James Clark | 7937308 | 2020-10-05 09:06:45 +0100 | [diff] [blame] | 253 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO_CONFIG)) |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 254 | |
David Carrillo-Cisneros | 7be6b31 | 2017-04-11 23:49:13 -0700 | [diff] [blame] | 255 | grep-libs = $(filter -l%,$(1)) |
| 256 | strip-libs = $(filter-out -l%,$(1)) |
| 257 | |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 258 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 259 | |
Sam Lunt | b9c9ce4 | 2020-01-31 12:11:23 -0600 | [diff] [blame] | 260 | # Python 3.8 changed the output of `python-config --ldflags` to not include the |
| 261 | # '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for |
| 262 | # libpython fails if that flag is not included in LDFLAGS |
| 263 | ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0) |
| 264 | PYTHON_CONFIG_LDFLAGS := --ldflags --embed |
| 265 | else |
| 266 | PYTHON_CONFIG_LDFLAGS := --ldflags |
| 267 | endif |
| 268 | |
David Carrillo-Cisneros | 7be6b31 | 2017-04-11 23:49:13 -0700 | [diff] [blame] | 269 | ifdef PYTHON_CONFIG |
Sam Lunt | b9c9ce4 | 2020-01-31 12:11:23 -0600 | [diff] [blame] | 270 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null) |
David Carrillo-Cisneros | 7be6b31 | 2017-04-11 23:49:13 -0700 | [diff] [blame] | 271 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
| 272 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil |
Jeremy Cline | 32aa928 | 2018-07-10 11:46:12 -0400 | [diff] [blame] | 273 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) |
David Carrillo-Cisneros | 7be6b31 | 2017-04-11 23:49:13 -0700 | [diff] [blame] | 274 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
Arnaldo Carvalho de Melo | 8bd8c65 | 2017-02-15 21:31:40 -0300 | [diff] [blame] | 275 | endif |
| 276 | |
Wang Nan | 5a155bb | 2016-01-29 05:57:30 +0000 | [diff] [blame] | 277 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
| 278 | FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 279 | |
Arnaldo Carvalho de Melo | aa8f9c5 | 2019-02-12 11:20:56 -0300 | [diff] [blame] | 280 | FEATURE_CHECK_LDFLAGS-libaio = -lrt |
| 281 | |
Arnaldo Carvalho de Melo | c638417 | 2019-05-01 16:27:00 -0400 | [diff] [blame] | 282 | FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl |
Song Liu | 8a1b171 | 2019-03-11 22:30:48 -0700 | [diff] [blame] | 283 | |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 284 | CORE_CFLAGS += -fno-omit-frame-pointer |
| 285 | CORE_CFLAGS += -ggdb3 |
| 286 | CORE_CFLAGS += -funwind-tables |
| 287 | CORE_CFLAGS += -Wall |
| 288 | CORE_CFLAGS += -Wextra |
| 289 | CORE_CFLAGS += -std=gnu99 |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 290 | |
Ian Rogers | d0d0f0c | 2021-10-11 19:13:20 -0700 | [diff] [blame] | 291 | CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 292 | CXXFLAGS += -Wall |
| 293 | CXXFLAGS += -fno-omit-frame-pointer |
| 294 | CXXFLAGS += -ggdb3 |
| 295 | CXXFLAGS += -funwind-tables |
| 296 | CXXFLAGS += -Wno-strict-aliasing |
| 297 | |
John Garry | c77a78c | 2021-10-30 00:30:41 +0800 | [diff] [blame] | 298 | HOSTCFLAGS += -Wall |
| 299 | HOSTCFLAGS += -Wextra |
| 300 | |
Mathias Krause | 6392b4e | 2014-04-27 18:51:05 +0200 | [diff] [blame] | 301 | # Enforce a non-executable stack, as we may regress (again) in the future by |
| 302 | # adding assembler files missing the .GNU-stack linker note. |
| 303 | LDFLAGS += -Wl,-z,noexecstack |
| 304 | |
Namhyung Kim | 5e2d4d0 | 2014-11-07 14:20:06 +0900 | [diff] [blame] | 305 | EXTLIBS = -lpthread -lrt -lm -ldl |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 306 | |
Jiri Olsa | bb91a07 | 2019-10-13 17:14:25 +0200 | [diff] [blame] | 307 | ifneq ($(TCMALLOC),) |
| 308 | CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free |
| 309 | EXTLIBS += -ltcmalloc |
| 310 | endif |
| 311 | |
Jiri Olsa | 96b9e70 | 2016-01-15 04:00:18 +0000 | [diff] [blame] | 312 | ifeq ($(FEATURES_DUMP),) |
Arnaldo Carvalho de Melo | c6e3bf4 | 2021-04-26 15:47:39 -0300 | [diff] [blame] | 313 | # We will display at the end of this Makefile.config, using $(call feature_display_entries) |
| 314 | # As we may retry some feature detection here, see the disassembler-four-args case, for instance |
| 315 | FEATURE_DISPLAY_DEFERRED := 1 |
Jiri Olsa | e6c76d6 | 2015-03-01 21:19:44 +0100 | [diff] [blame] | 316 | include $(srctree)/tools/build/Makefile.feature |
Jiri Olsa | 96b9e70 | 2016-01-15 04:00:18 +0000 | [diff] [blame] | 317 | else |
| 318 | include $(FEATURES_DUMP) |
| 319 | endif |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 320 | |
Ingo Molnar | 90ac542 | 2013-09-30 13:48:44 +0200 | [diff] [blame] | 321 | ifeq ($(feature-stackprotector-all), 1) |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 322 | CORE_CFLAGS += -fstack-protector-all |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 323 | endif |
| 324 | |
Ingo Molnar | fcf9258 | 2013-10-10 08:05:25 +0200 | [diff] [blame] | 325 | ifeq ($(DEBUG),0) |
Ingo Molnar | 1ea6f99 | 2013-10-07 09:38:28 +0200 | [diff] [blame] | 326 | ifeq ($(feature-fortify-source), 1) |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 327 | CORE_CFLAGS += -D_FORTIFY_SOURCE=2 |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 328 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 329 | endif |
| 330 | |
Jiri Olsa | 3ce311a | 2019-12-06 22:06:11 +0100 | [diff] [blame] | 331 | INC_FLAGS += -I$(srctree)/tools/lib/perf/include |
Wang Nan | e67d52d | 2016-11-26 07:03:37 +0000 | [diff] [blame] | 332 | INC_FLAGS += -I$(src-perf)/util/include |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 333 | INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include |
Wang Nan | e67d52d | 2016-11-26 07:03:37 +0000 | [diff] [blame] | 334 | INC_FLAGS += -I$(srctree)/tools/include/ |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 335 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi |
Arnaldo Carvalho de Melo | 146dc30 | 2019-08-19 11:11:30 -0300 | [diff] [blame] | 336 | INC_FLAGS += -I$(srctree)/tools/include/uapi |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 337 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ |
| 338 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 339 | |
| 340 | # $(obj-perf) for generated common-cmds.h |
| 341 | # $(obj-perf)/util for generated bison/flex headers |
| 342 | ifneq ($(OUTPUT),) |
Wang Nan | e67d52d | 2016-11-26 07:03:37 +0000 | [diff] [blame] | 343 | INC_FLAGS += -I$(obj-perf)/util |
| 344 | INC_FLAGS += -I$(obj-perf) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 345 | endif |
| 346 | |
Wang Nan | e67d52d | 2016-11-26 07:03:37 +0000 | [diff] [blame] | 347 | INC_FLAGS += -I$(src-perf)/util |
| 348 | INC_FLAGS += -I$(src-perf) |
| 349 | INC_FLAGS += -I$(srctree)/tools/lib/ |
| 350 | |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 351 | CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
| 352 | |
| 353 | CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS) |
Wang Nan | e67d52d | 2016-11-26 07:03:37 +0000 | [diff] [blame] | 354 | CXXFLAGS += $(INC_FLAGS) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 355 | |
Jiri Olsa | 5554211 | 2019-10-11 14:21:55 +0200 | [diff] [blame] | 356 | LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS) |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 357 | |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 358 | ifeq ($(feature-pthread-attr-setaffinity-np), 1) |
| 359 | CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP |
| 360 | endif |
| 361 | |
Arnaldo Carvalho de Melo | 25ab5ab | 2017-12-05 10:14:42 -0300 | [diff] [blame] | 362 | ifeq ($(feature-pthread-barrier), 1) |
| 363 | CFLAGS += -DHAVE_PTHREAD_BARRIER |
| 364 | endif |
| 365 | |
Jiri Olsa | 4e22db4 | 2013-05-24 14:35:24 +0200 | [diff] [blame] | 366 | ifndef NO_BIONIC |
David Ahern | 5febff0 | 2013-10-29 10:43:15 -0600 | [diff] [blame] | 367 | $(call feature_check,bionic) |
Ingo Molnar | 78e9d65 | 2013-09-30 14:11:46 +0200 | [diff] [blame] | 368 | ifeq ($(feature-bionic), 1) |
| 369 | BIONIC := 1 |
Arnaldo Carvalho de Melo | 748fe08 | 2018-12-11 15:48:47 -0300 | [diff] [blame] | 370 | CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE |
Arnaldo Carvalho de Melo | d7a8c4a | 2018-12-11 16:31:19 -0300 | [diff] [blame] | 371 | CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE |
Ingo Molnar | 78e9d65 | 2013-09-30 14:11:46 +0200 | [diff] [blame] | 372 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) |
| 373 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) |
| 374 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 375 | endif |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 376 | |
Arnaldo Carvalho de Melo | 11c6cbe | 2018-11-21 17:42:00 -0300 | [diff] [blame] | 377 | ifeq ($(feature-eventfd), 1) |
Arnaldo Carvalho de Melo | ba35fe9 | 2020-05-20 12:21:07 -0300 | [diff] [blame] | 378 | CFLAGS += -DHAVE_EVENTFD_SUPPORT |
Arnaldo Carvalho de Melo | 11c6cbe | 2018-11-21 17:42:00 -0300 | [diff] [blame] | 379 | endif |
| 380 | |
Arnaldo Carvalho de Melo | 8feb8ef | 2018-11-19 16:56:22 -0300 | [diff] [blame] | 381 | ifeq ($(feature-get_current_dir_name), 1) |
| 382 | CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME |
| 383 | endif |
| 384 | |
Arnaldo Carvalho de Melo | 4541a8b | 2019-06-13 12:04:19 -0300 | [diff] [blame] | 385 | ifeq ($(feature-gettid), 1) |
| 386 | CFLAGS += -DHAVE_GETTID |
| 387 | endif |
| 388 | |
Namhyung Kim | 49f550e | 2020-04-02 10:52:49 +0900 | [diff] [blame] | 389 | ifeq ($(feature-file-handle), 1) |
| 390 | CFLAGS += -DHAVE_FILE_HANDLE |
| 391 | endif |
| 392 | |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 393 | ifdef NO_LIBELF |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 394 | NO_DWARF := 1 |
| 395 | NO_DEMANGLE := 1 |
| 396 | NO_LIBUNWIND := 1 |
Jiri Olsa | 5ea8415 | 2014-02-19 16:52:57 +0100 | [diff] [blame] | 397 | NO_LIBDW_DWARF_UNWIND := 1 |
Wang Nan | ed63f34c | 2015-10-14 12:41:12 +0000 | [diff] [blame] | 398 | NO_LIBBPF := 1 |
David Carrillo-Cisneros | e5e992a | 2017-04-12 10:07:45 -0700 | [diff] [blame] | 399 | NO_JVMTI := 1 |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 400 | else |
Ingo Molnar | 8f7f800 | 2013-09-30 14:20:25 +0200 | [diff] [blame] | 401 | ifeq ($(feature-libelf), 0) |
Ingo Molnar | e12762c | 2013-10-07 10:34:20 +0200 | [diff] [blame] | 402 | ifeq ($(feature-glibc), 1) |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 403 | LIBC_SUPPORT := 1 |
| 404 | endif |
| 405 | ifeq ($(BIONIC),1) |
| 406 | LIBC_SUPPORT := 1 |
| 407 | endif |
| 408 | ifeq ($(LIBC_SUPPORT),1) |
David Carrillo-Cisneros | e5e992a | 2017-04-12 10:07:45 -0700 | [diff] [blame] | 409 | 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); |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 410 | |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 411 | NO_LIBELF := 1 |
| 412 | NO_DWARF := 1 |
| 413 | NO_DEMANGLE := 1 |
Arnaldo Carvalho de Melo | 9458955 | 2014-03-25 09:35:11 -0300 | [diff] [blame] | 414 | NO_LIBUNWIND := 1 |
| 415 | NO_LIBDW_DWARF_UNWIND := 1 |
Wang Nan | ed63f34c | 2015-10-14 12:41:12 +0000 | [diff] [blame] | 416 | NO_LIBBPF := 1 |
David Carrillo-Cisneros | e5e992a | 2017-04-12 10:07:45 -0700 | [diff] [blame] | 417 | NO_JVMTI := 1 |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 418 | else |
Tiezhu Yang | 6a1515c | 2020-06-18 10:06:01 +0800 | [diff] [blame] | 419 | ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),) |
| 420 | ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0) |
| 421 | msg := $(error No libasan found, please install libasan); |
| 422 | endif |
| 423 | endif |
| 424 | |
| 425 | ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),) |
| 426 | ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0) |
| 427 | msg := $(error No libubsan found, please install libubsan); |
| 428 | endif |
| 429 | endif |
| 430 | |
Arnaldo Carvalho de Melo | f9ca2d8 | 2014-06-05 12:46:04 -0300 | [diff] [blame] | 431 | ifneq ($(filter s% -static%,$(LDFLAGS),),) |
| 432 | msg := $(error No static glibc found, please install glibc-static); |
| 433 | else |
| 434 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); |
| 435 | endif |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 436 | endif |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 437 | else |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 438 | ifndef NO_LIBDW_DWARF_UNWIND |
| 439 | ifneq ($(feature-libdw-dwarf-unwind),1) |
| 440 | NO_LIBDW_DWARF_UNWIND := 1 |
| 441 | msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR); |
| 442 | endif |
| 443 | endif |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 444 | ifneq ($(feature-dwarf), 1) |
David Carrillo-Cisneros | 2484c4c | 2017-01-12 13:01:59 -0800 | [diff] [blame] | 445 | ifndef NO_DWARF |
| 446 | 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); |
| 447 | NO_DWARF := 1 |
| 448 | endif |
Arnaldo Carvalho de Melo | bd0419e | 2016-04-05 11:33:41 -0300 | [diff] [blame] | 449 | else |
| 450 | ifneq ($(feature-dwarf_getlocations), 1) |
| 451 | msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157); |
| 452 | else |
Jin Yao | a36ebe4 | 2018-03-30 17:27:13 +0800 | [diff] [blame] | 453 | CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT |
Arnaldo Carvalho de Melo | bd0419e | 2016-04-05 11:33:41 -0300 | [diff] [blame] | 454 | endif # dwarf_getlocations |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 455 | endif # Dwarf support |
Ingo Molnar | 0648f83 | 2013-10-02 15:30:35 +0200 | [diff] [blame] | 456 | endif # libelf support |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 457 | endif # NO_LIBELF |
| 458 | |
Jin Yao | 8e2c241 | 2018-03-30 17:27:12 +0800 | [diff] [blame] | 459 | ifeq ($(feature-glibc), 1) |
| 460 | CFLAGS += -DHAVE_GLIBC_SUPPORT |
| 461 | endif |
| 462 | |
Alexey Budankov | 2a07d81 | 2018-11-06 12:03:35 +0300 | [diff] [blame] | 463 | ifeq ($(feature-libaio), 1) |
| 464 | ifndef NO_AIO |
| 465 | CFLAGS += -DHAVE_AIO_SUPPORT |
| 466 | endif |
| 467 | endif |
| 468 | |
Naveen N. Rao | 76d4084 | 2015-04-29 16:45:31 +0530 | [diff] [blame] | 469 | ifdef NO_DWARF |
| 470 | NO_LIBDW_DWARF_UNWIND := 1 |
| 471 | endif |
| 472 | |
Arnaldo Carvalho de Melo | 120010c | 2017-03-02 12:55:49 -0300 | [diff] [blame] | 473 | ifeq ($(feature-sched_getcpu), 1) |
| 474 | CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT |
| 475 | endif |
| 476 | |
Arnaldo Carvalho de Melo | 86bcdb5 | 2017-07-18 17:15:29 -0300 | [diff] [blame] | 477 | ifeq ($(feature-setns), 1) |
| 478 | CFLAGS += -DHAVE_SETNS_SUPPORT |
| 479 | $(call detected,CONFIG_SETNS) |
| 480 | endif |
| 481 | |
Arnaldo Carvalho de Melo | 1c3b28f | 2019-02-12 14:37:15 -0300 | [diff] [blame] | 482 | ifdef CORESIGHT |
| 483 | $(call feature_check,libopencsd) |
Mathieu Poirier | aa6292f | 2018-01-17 10:52:10 -0700 | [diff] [blame] | 484 | ifeq ($(feature-libopencsd), 1) |
| 485 | CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) |
Mathieu Poirier | c152d4d | 2019-05-24 11:35:05 -0600 | [diff] [blame] | 486 | ifeq ($(feature-reallocarray), 0) |
| 487 | CFLAGS += -DCOMPAT_NEED_REALLOCARRAY |
| 488 | endif |
Mathieu Poirier | aa6292f | 2018-01-17 10:52:10 -0700 | [diff] [blame] | 489 | LDFLAGS += $(LIBOPENCSD_LDFLAGS) |
| 490 | EXTLIBS += $(OPENCSDLIBS) |
| 491 | $(call detected,CONFIG_LIBOPENCSD) |
| 492 | ifdef CSTRACE_RAW |
| 493 | CFLAGS += -DCS_DEBUG_RAW |
| 494 | ifeq (${CSTRACE_RAW}, packed) |
| 495 | CFLAGS += -DCS_RAW_PACKED |
| 496 | endif |
| 497 | endif |
Leo Yan | 71f7f89 | 2021-09-02 16:18:00 +0800 | [diff] [blame] | 498 | else |
| 499 | dummy := $(error Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1) |
Mathieu Poirier | aa6292f | 2018-01-17 10:52:10 -0700 | [diff] [blame] | 500 | endif |
| 501 | endif |
| 502 | |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 503 | ifndef NO_LIBELF |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 504 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
Namhyung Kim | 5e2d4d0 | 2014-11-07 14:20:06 +0900 | [diff] [blame] | 505 | EXTLIBS += -lelf |
Jiri Olsa | 709e679 | 2014-12-29 23:52:25 +0100 | [diff] [blame] | 506 | $(call detected,CONFIG_LIBELF) |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 507 | |
Ingo Molnar | b7bcef6 | 2013-09-30 14:35:27 +0200 | [diff] [blame] | 508 | ifeq ($(feature-libelf-getphdrnum), 1) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 509 | CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT |
| 510 | endif |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 511 | |
Arnaldo Carvalho de Melo | 1c1a3a4 | 2016-07-12 12:19:09 -0300 | [diff] [blame] | 512 | ifeq ($(feature-libelf-gelf_getnote), 1) |
| 513 | CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT |
| 514 | else |
| 515 | msg := $(warning gelf_getnote() not found on libelf, SDT support disabled); |
| 516 | endif |
| 517 | |
Arnaldo Carvalho de Melo | 2492c46 | 2016-07-04 19:35:47 -0300 | [diff] [blame] | 518 | ifeq ($(feature-libelf-getshdrstrndx), 1) |
| 519 | CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT |
| 520 | endif |
| 521 | |
Frank Ch. Eigler | c7a14fd | 2020-08-13 10:22:04 +0200 | [diff] [blame] | 522 | ifndef NO_LIBDEBUGINFOD |
| 523 | $(call feature_check,libdebuginfod) |
| 524 | ifeq ($(feature-libdebuginfod), 1) |
| 525 | CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT |
| 526 | EXTLIBS += -ldebuginfod |
| 527 | endif |
| 528 | endif |
| 529 | |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 530 | ifndef NO_DWARF |
| 531 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 532 | msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled); |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 533 | NO_DWARF := 1 |
| 534 | else |
| 535 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) |
| 536 | LDFLAGS += $(LIBDW_LDFLAGS) |
Andi Kleen | 7aec51c | 2015-08-12 15:48:37 -0700 | [diff] [blame] | 537 | EXTLIBS += ${DWARFLIBS} |
Jiri Olsa | 8379fce | 2014-12-30 00:06:25 +0100 | [diff] [blame] | 538 | $(call detected,CONFIG_DWARF) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 539 | endif # PERF_HAVE_DWARF_REGS |
| 540 | endif # NO_DWARF |
Wang Nan | ed63f34c | 2015-10-14 12:41:12 +0000 | [diff] [blame] | 541 | |
| 542 | ifndef NO_LIBBPF |
| 543 | ifeq ($(feature-bpf), 1) |
| 544 | CFLAGS += -DHAVE_LIBBPF_SUPPORT |
| 545 | $(call detected,CONFIG_LIBBPF) |
Jiri Olsa | 7b65e20 | 2019-11-26 13:12:53 +0100 | [diff] [blame] | 546 | |
| 547 | # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status |
| 548 | $(call feature_check,libbpf) |
| 549 | ifdef LIBBPF_DYNAMIC |
| 550 | ifeq ($(feature-libbpf), 1) |
| 551 | EXTLIBS += -lbpf |
Jiri Olsa | ad1237c | 2021-05-08 22:50:20 +0200 | [diff] [blame] | 552 | $(call detected,CONFIG_LIBBPF_DYNAMIC) |
Jiri Olsa | 7b65e20 | 2019-11-26 13:12:53 +0100 | [diff] [blame] | 553 | else |
| 554 | dummy := $(error Error: No libbpf devel library found, please install libbpf-devel); |
| 555 | endif |
| 556 | endif |
Wang Nan | ed63f34c | 2015-10-14 12:41:12 +0000 | [diff] [blame] | 557 | endif |
Wang Nan | 1c0ed63 | 2015-11-16 12:10:10 +0000 | [diff] [blame] | 558 | |
| 559 | ifndef NO_DWARF |
| 560 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
| 561 | CFLAGS += -DHAVE_BPF_PROLOGUE |
| 562 | $(call detected,CONFIG_BPF_PROLOGUE) |
| 563 | else |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 564 | msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset()); |
Wang Nan | 1c0ed63 | 2015-11-16 12:10:10 +0000 | [diff] [blame] | 565 | endif |
| 566 | else |
| 567 | msg := $(warning DWARF support is off, BPF prologue is disabled); |
| 568 | endif |
| 569 | |
Wang Nan | ed63f34c | 2015-10-14 12:41:12 +0000 | [diff] [blame] | 570 | endif # NO_LIBBPF |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 571 | endif # NO_LIBELF |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 572 | |
Masami Hiramatsu | e26e63b | 2016-07-12 19:05:56 +0900 | [diff] [blame] | 573 | ifndef NO_SDT |
| 574 | ifneq ($(feature-sdt), 1) |
| 575 | msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev); |
| 576 | NO_SDT := 1; |
| 577 | else |
| 578 | CFLAGS += -DHAVE_SDT_EVENT |
| 579 | $(call detected,CONFIG_SDT_EVENT) |
| 580 | endif |
| 581 | endif |
| 582 | |
Jiri Olsa | e12b202 | 2016-03-10 17:41:13 +0100 | [diff] [blame] | 583 | ifdef PERF_HAVE_JITDUMP |
Maciej Debski | 621cb4e | 2016-10-13 03:59:36 -0700 | [diff] [blame] | 584 | ifndef NO_LIBELF |
Jiri Olsa | e12b202 | 2016-03-10 17:41:13 +0100 | [diff] [blame] | 585 | $(call detected,CONFIG_JITDUMP) |
| 586 | CFLAGS += -DHAVE_JITDUMP |
| 587 | endif |
| 588 | endif |
| 589 | |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 590 | ifeq ($(SRCARCH),powerpc) |
Anton Blanchard | 65ccb4f | 2014-08-25 18:25:06 +1000 | [diff] [blame] | 591 | ifndef NO_DWARF |
| 592 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX |
| 593 | endif |
| 594 | endif |
| 595 | |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 596 | ifndef NO_LIBUNWIND |
He Kuang | 9d8e14d | 2016-06-03 03:33:15 +0000 | [diff] [blame] | 597 | have_libunwind := |
He Kuang | 52ffe0f | 2016-06-03 03:33:22 +0000 | [diff] [blame] | 598 | |
Arnaldo Carvalho de Melo | 5c4d7c8 | 2019-02-12 16:34:32 -0300 | [diff] [blame] | 599 | $(call feature_check,libunwind-x86) |
He Kuang | 52ffe0f | 2016-06-03 03:33:22 +0000 | [diff] [blame] | 600 | ifeq ($(feature-libunwind-x86), 1) |
| 601 | $(call detected,CONFIG_LIBUNWIND_X86) |
| 602 | CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT |
| 603 | LDFLAGS += -lunwind-x86 |
He Kuang | 906a827 | 2016-06-15 11:03:56 +0000 | [diff] [blame] | 604 | EXTLIBS_LIBUNWIND += -lunwind-x86 |
He Kuang | 52ffe0f | 2016-06-03 03:33:22 +0000 | [diff] [blame] | 605 | have_libunwind = 1 |
| 606 | endif |
| 607 | |
Arnaldo Carvalho de Melo | 5c4d7c8 | 2019-02-12 16:34:32 -0300 | [diff] [blame] | 608 | $(call feature_check,libunwind-aarch64) |
He Kuang | 057fbfb | 2016-06-03 03:33:23 +0000 | [diff] [blame] | 609 | ifeq ($(feature-libunwind-aarch64), 1) |
| 610 | $(call detected,CONFIG_LIBUNWIND_AARCH64) |
| 611 | CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT |
| 612 | LDFLAGS += -lunwind-aarch64 |
He Kuang | 906a827 | 2016-06-15 11:03:56 +0000 | [diff] [blame] | 613 | EXTLIBS_LIBUNWIND += -lunwind-aarch64 |
He Kuang | 057fbfb | 2016-06-03 03:33:23 +0000 | [diff] [blame] | 614 | have_libunwind = 1 |
| 615 | $(call feature_check,libunwind-debug-frame-aarch64) |
| 616 | ifneq ($(feature-libunwind-debug-frame-aarch64), 1) |
| 617 | msg := $(warning No debug_frame support found in libunwind-aarch64); |
| 618 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64 |
| 619 | endif |
| 620 | endif |
| 621 | |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 622 | ifneq ($(feature-libunwind), 1) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 623 | msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR); |
He Kuang | 9d8e14d | 2016-06-03 03:33:15 +0000 | [diff] [blame] | 624 | NO_LOCAL_LIBUNWIND := 1 |
| 625 | else |
| 626 | have_libunwind := 1 |
| 627 | $(call detected,CONFIG_LOCAL_LIBUNWIND) |
| 628 | endif |
| 629 | |
| 630 | ifneq ($(have_libunwind), 1) |
Ingo Molnar | 308e1e7 | 2013-10-07 10:30:47 +0200 | [diff] [blame] | 631 | NO_LIBUNWIND := 1 |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 632 | endif |
He Kuang | 9d8e14d | 2016-06-03 03:33:15 +0000 | [diff] [blame] | 633 | else |
| 634 | NO_LOCAL_LIBUNWIND := 1 |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 635 | endif |
| 636 | |
Wang Nan | ed63f34c | 2015-10-14 12:41:12 +0000 | [diff] [blame] | 637 | ifndef NO_LIBBPF |
| 638 | ifneq ($(feature-bpf), 1) |
| 639 | msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.) |
| 640 | NO_LIBBPF := 1 |
| 641 | endif |
| 642 | endif |
| 643 | |
Song Liu | fbcdaa1 | 2020-12-29 13:42:13 -0800 | [diff] [blame] | 644 | ifdef BUILD_BPF_SKEL |
| 645 | $(call feature_check,clang-bpf-co-re) |
| 646 | ifeq ($(feature-clang-bpf-co-re), 0) |
Song Liu | efb0b23 | 2021-05-09 23:49:17 -0700 | [diff] [blame] | 647 | dummy := $(error Error: clang too old/not installed. Please install recent clang to build with BUILD_BPF_SKEL) |
Song Liu | fbcdaa1 | 2020-12-29 13:42:13 -0800 | [diff] [blame] | 648 | endif |
| 649 | $(call detected,CONFIG_PERF_BPF_SKEL) |
| 650 | CFLAGS += -DHAVE_BPF_SKEL |
| 651 | endif |
| 652 | |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 653 | dwarf-post-unwind := 1 |
| 654 | dwarf-post-unwind-text := BUG |
| 655 | |
| 656 | # setup DWARF post unwinder |
| 657 | ifdef NO_LIBUNWIND |
| 658 | ifdef NO_LIBDW_DWARF_UNWIND |
| 659 | msg := $(warning Disabling post unwind, no support found.); |
| 660 | dwarf-post-unwind := 0 |
Linus Torvalds | f47671e | 2013-11-14 08:51:29 +0900 | [diff] [blame] | 661 | else |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 662 | dwarf-post-unwind-text := libdw |
Jiri Olsa | b2e45c3 | 2014-12-30 00:11:11 +0100 | [diff] [blame] | 663 | $(call detected,CONFIG_LIBDW_DWARF_UNWIND) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 664 | endif |
| 665 | else |
| 666 | dwarf-post-unwind-text := libunwind |
Jiri Olsa | b2e45c3 | 2014-12-30 00:11:11 +0100 | [diff] [blame] | 667 | $(call detected,CONFIG_LIBUNWIND) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 668 | # Enable libunwind support by default. |
| 669 | ifndef NO_LIBDW_DWARF_UNWIND |
| 670 | NO_LIBDW_DWARF_UNWIND := 1 |
| 671 | endif |
| 672 | endif |
| 673 | |
| 674 | ifeq ($(dwarf-post-unwind),1) |
| 675 | CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 676 | $(call detected,CONFIG_DWARF_UNWIND) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 677 | else |
| 678 | NO_DWARF_UNWIND := 1 |
| 679 | endif |
| 680 | |
He Kuang | 9d8e14d | 2016-06-03 03:33:15 +0000 | [diff] [blame] | 681 | ifndef NO_LOCAL_LIBUNWIND |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 682 | ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64)) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 683 | $(call feature_check,libunwind-debug-frame) |
| 684 | ifneq ($(feature-libunwind-debug-frame), 1) |
| 685 | msg := $(warning No debug_frame support found in libunwind); |
Linus Torvalds | f47671e | 2013-11-14 08:51:29 +0900 | [diff] [blame] | 686 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME |
| 687 | endif |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 688 | else |
| 689 | # non-ARM has no dwarf_find_debug_frame() function: |
| 690 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME |
| 691 | endif |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 692 | EXTLIBS += $(LIBUNWIND_LIBS) |
He Kuang | 9d8e14d | 2016-06-03 03:33:15 +0000 | [diff] [blame] | 693 | LDFLAGS += $(LIBUNWIND_LIBS) |
| 694 | endif |
Konstantin Khlebnikov | 60913e0 | 2017-08-20 14:39:32 +0300 | [diff] [blame] | 695 | ifeq ($(findstring -static,${LDFLAGS}),-static) |
| 696 | # gcc -static links libgcc_eh which contans piece of libunwind |
| 697 | LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition |
| 698 | endif |
He Kuang | 9d8e14d | 2016-06-03 03:33:15 +0000 | [diff] [blame] | 699 | |
| 700 | ifndef NO_LIBUNWIND |
| 701 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 702 | CFLAGS += $(LIBUNWIND_CFLAGS) |
| 703 | LDFLAGS += $(LIBUNWIND_LDFLAGS) |
He Kuang | 906a827 | 2016-06-15 11:03:56 +0000 | [diff] [blame] | 704 | EXTLIBS += $(EXTLIBS_LIBUNWIND) |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 705 | endif |
Jiri Olsa | a827952 | 2013-03-25 00:54:36 +0100 | [diff] [blame] | 706 | |
Hendrik Brueckner | b3fa389 | 2018-01-19 09:56:17 +0100 | [diff] [blame] | 707 | ifeq ($(NO_SYSCALL_TABLE),0) |
| 708 | $(call detected,CONFIG_TRACE) |
| 709 | else |
| 710 | ifndef NO_LIBAUDIT |
Arnaldo Carvalho de Melo | a88f70d | 2020-05-29 11:11:59 -0300 | [diff] [blame] | 711 | $(call feature_check,libaudit) |
Hendrik Brueckner | b3fa389 | 2018-01-19 09:56:17 +0100 | [diff] [blame] | 712 | ifneq ($(feature-libaudit), 1) |
| 713 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); |
| 714 | NO_LIBAUDIT := 1 |
| 715 | else |
| 716 | CFLAGS += -DHAVE_LIBAUDIT_SUPPORT |
| 717 | EXTLIBS += -laudit |
| 718 | $(call detected,CONFIG_TRACE) |
| 719 | endif |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 720 | endif |
Jiri Olsa | a827952 | 2013-03-25 00:54:36 +0100 | [diff] [blame] | 721 | endif |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 722 | |
Stephane Eranian | 8ee4646 | 2015-11-30 10:02:21 +0100 | [diff] [blame] | 723 | ifndef NO_LIBCRYPTO |
| 724 | ifneq ($(feature-libcrypto), 1) |
Arnaldo Carvalho de Melo | 54fceb0 | 2018-11-29 20:41:54 -0300 | [diff] [blame] | 725 | msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev); |
Stephane Eranian | 8ee4646 | 2015-11-30 10:02:21 +0100 | [diff] [blame] | 726 | NO_LIBCRYPTO := 1 |
| 727 | else |
| 728 | CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT |
| 729 | EXTLIBS += -lcrypto |
| 730 | $(call detected,CONFIG_CRYPTO) |
| 731 | endif |
| 732 | endif |
| 733 | |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 734 | ifdef NO_NEWT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 735 | NO_SLANG=1 |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 736 | endif |
| 737 | |
| 738 | ifndef NO_SLANG |
Ingo Molnar | b9498b5 | 2013-09-30 14:57:54 +0200 | [diff] [blame] | 739 | ifneq ($(feature-libslang), 1) |
Arnaldo Carvalho de Melo | 78d6ccc | 2019-06-18 17:48:12 -0300 | [diff] [blame] | 740 | ifneq ($(feature-libslang-include-subdir), 1) |
| 741 | msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev); |
| 742 | NO_SLANG := 1 |
| 743 | else |
| 744 | CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR |
| 745 | endif |
| 746 | endif |
| 747 | ifndef NO_SLANG |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 748 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 749 | CFLAGS += -DHAVE_SLANG_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 750 | EXTLIBS += -lslang |
Jiri Olsa | cf15c74 | 2014-12-30 00:27:52 +0100 | [diff] [blame] | 751 | $(call detected,CONFIG_SLANG) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 752 | endif |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 753 | endif |
Jiri Olsa | 58cabf6 | 2013-03-18 00:09:24 +0100 | [diff] [blame] | 754 | |
Arnaldo Carvalho de Melo | 4751bdd | 2020-09-04 17:11:59 -0300 | [diff] [blame] | 755 | ifdef GTK2 |
Mark Rutland | a8a5cd8 | 2014-01-15 10:44:08 +0000 | [diff] [blame] | 756 | FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) |
Arnaldo Carvalho de Melo | 4751bdd | 2020-09-04 17:11:59 -0300 | [diff] [blame] | 757 | $(call feature_check,gtk2) |
Ingo Molnar | 7ef9e05 | 2013-09-30 15:01:56 +0200 | [diff] [blame] | 758 | ifneq ($(feature-gtk2), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 759 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
| 760 | NO_GTK2 := 1 |
| 761 | else |
Arnaldo Carvalho de Melo | 4751bdd | 2020-09-04 17:11:59 -0300 | [diff] [blame] | 762 | $(call feature_check,gtk2-infobar) |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 763 | ifeq ($(feature-gtk2-infobar), 1) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 764 | GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 765 | endif |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 766 | CFLAGS += -DHAVE_GTK2_SUPPORT |
Mark Rutland | a8a5cd8 | 2014-01-15 10:44:08 +0000 | [diff] [blame] | 767 | GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) |
| 768 | GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) |
Jiri Olsa | e213708 | 2013-09-26 20:55:54 +0200 | [diff] [blame] | 769 | EXTLIBS += -ldl |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 770 | endif |
Jiri Olsa | 58cabf6 | 2013-03-18 00:09:24 +0100 | [diff] [blame] | 771 | endif |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 772 | |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 773 | ifdef NO_LIBPERL |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 774 | CFLAGS += -DNO_LIBPERL |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 775 | else |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 776 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
| 777 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) |
| 778 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
Jiri Olsa | 86f5fe0 | 2017-11-08 11:27:37 +0100 | [diff] [blame] | 779 | PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) |
Jiri Olsa | c6707fd | 2017-12-04 12:23:08 -0300 | [diff] [blame] | 780 | PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) |
Justin M. Forbes | b773ea6 | 2020-10-28 13:59:00 -0300 | [diff] [blame] | 781 | PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) |
Jiri Olsa | c6707fd | 2017-12-04 12:23:08 -0300 | [diff] [blame] | 782 | PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 783 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 784 | |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 785 | ifneq ($(feature-libperl), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 786 | CFLAGS += -DNO_LIBPERL |
| 787 | NO_LIBPERL := 1 |
Ingo Molnar | a954e68 | 2015-02-28 09:39:09 +0100 | [diff] [blame] | 788 | msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev); |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 789 | else |
| 790 | LDFLAGS += $(PERL_EMBED_LDFLAGS) |
| 791 | EXTLIBS += $(PERL_EMBED_LIBADD) |
Jin Yao | 8e2c241 | 2018-03-30 17:27:12 +0800 | [diff] [blame] | 792 | CFLAGS += -DHAVE_LIBPERL_SUPPORT |
Jiri Olsa | c7355f8 | 2014-12-30 13:11:32 +0100 | [diff] [blame] | 793 | $(call detected,CONFIG_LIBPERL) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 794 | endif |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 795 | endif |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 796 | |
David Ahern | 87419c9 | 2013-10-29 10:43:16 -0600 | [diff] [blame] | 797 | ifeq ($(feature-timerfd), 1) |
| 798 | CFLAGS += -DHAVE_TIMERFD_SUPPORT |
| 799 | else |
| 800 | msg := $(warning No timerfd support. Disables 'perf kvm stat live'); |
| 801 | endif |
| 802 | |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 803 | disable-python = $(eval $(disable-python_code)) |
| 804 | define disable-python_code |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 805 | CFLAGS += -DNO_LIBPYTHON |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 806 | $(warning $1) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 807 | NO_LIBPYTHON := 1 |
| 808 | endef |
| 809 | |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 810 | ifdef NO_LIBPYTHON |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 811 | $(call disable-python,Python support disabled by user) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 812 | else |
| 813 | |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 814 | ifndef PYTHON |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 815 | $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 816 | else |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 817 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 818 | |
| 819 | ifndef PYTHON_CONFIG |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 820 | $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 821 | else |
| 822 | |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 823 | ifneq ($(feature-libpython), 1) |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 824 | $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 825 | else |
Jaroslav Å karvada | 66dfdff | 2018-01-19 21:56:41 +0100 | [diff] [blame] | 826 | LDFLAGS += $(PYTHON_EMBED_LDFLAGS) |
| 827 | EXTLIBS += $(PYTHON_EMBED_LIBADD) |
| 828 | LANG_BINDINGS += $(obj-perf)python/perf.so |
Jin Yao | 8e2c241 | 2018-03-30 17:27:12 +0800 | [diff] [blame] | 829 | CFLAGS += -DHAVE_LIBPYTHON_SUPPORT |
Jaroslav Å karvada | 66dfdff | 2018-01-19 21:56:41 +0100 | [diff] [blame] | 830 | $(call detected,CONFIG_LIBPYTHON) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 831 | endif |
| 832 | endif |
| 833 | endif |
| 834 | endif |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 835 | |
Jiri Olsa | 2cf9040 | 2014-04-23 16:53:25 +0200 | [diff] [blame] | 836 | |
Ian Rogers | 0d1c50a | 2021-09-10 15:57:56 -0700 | [diff] [blame] | 837 | ifndef NO_LIBBFD |
| 838 | ifeq ($(feature-libbfd), 1) |
| 839 | EXTLIBS += -lbfd -lopcodes |
Jiri Olsa | 2cf9040 | 2014-04-23 16:53:25 +0200 | [diff] [blame] | 840 | else |
Ian Rogers | 0d1c50a | 2021-09-10 15:57:56 -0700 | [diff] [blame] | 841 | # we are on a system that requires -liberty and (maybe) -lz |
| 842 | # to link against -lbfd; test each case individually here |
Jiri Olsa | 3e6a147 | 2013-10-10 22:24:00 +0200 | [diff] [blame] | 843 | |
Ian Rogers | 0d1c50a | 2021-09-10 15:57:56 -0700 | [diff] [blame] | 844 | # call all detections now so we get correct |
| 845 | # status in VF output |
| 846 | $(call feature_check,libbfd-liberty) |
| 847 | $(call feature_check,libbfd-liberty-z) |
| 848 | |
| 849 | ifeq ($(feature-libbfd-liberty), 1) |
| 850 | EXTLIBS += -lbfd -lopcodes -liberty |
| 851 | FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl |
| 852 | else |
| 853 | ifeq ($(feature-libbfd-liberty-z), 1) |
| 854 | EXTLIBS += -lbfd -lopcodes -liberty -lz |
| 855 | FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl |
| 856 | endif |
| 857 | endif |
| 858 | $(call feature_check,disassembler-four-args) |
| 859 | endif |
| 860 | |
| 861 | ifeq ($(feature-libbfd-buildid), 1) |
| 862 | CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT |
| 863 | else |
| 864 | msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available); |
| 865 | endif |
Arnaldo Carvalho de Melo | e71e19a | 2020-09-03 13:44:39 -0300 | [diff] [blame] | 866 | endif |
| 867 | |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 868 | ifdef NO_DEMANGLE |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 869 | CFLAGS += -DNO_DEMANGLE |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 870 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 871 | ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 872 | EXTLIBS += -liberty |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 873 | else |
Stanislav Fomichev | 14541b1 | 2018-11-15 16:32:01 -0800 | [diff] [blame] | 874 | ifeq ($(filter -liberty,$(EXTLIBS)),) |
| 875 | $(call feature_check,cplus-demangle) |
| 876 | |
| 877 | # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT |
| 878 | # or any of 'bfd iberty z' trinity |
| 879 | ifeq ($(feature-cplus-demangle), 1) |
| 880 | EXTLIBS += -liberty |
| 881 | else |
| 882 | msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) |
| 883 | CFLAGS += -DNO_DEMANGLE |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 884 | endif |
| 885 | endif |
| 886 | endif |
Stanislav Fomichev | 14541b1 | 2018-11-15 16:32:01 -0800 | [diff] [blame] | 887 | |
| 888 | ifneq ($(filter -liberty,$(EXTLIBS)),) |
| 889 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
| 890 | endif |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 891 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 892 | |
Jiri Olsa | 3e6a147 | 2013-10-10 22:24:00 +0200 | [diff] [blame] | 893 | ifneq ($(filter -lbfd,$(EXTLIBS)),) |
| 894 | CFLAGS += -DHAVE_LIBBFD_SUPPORT |
| 895 | endif |
| 896 | |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 897 | ifndef NO_ZLIB |
| 898 | ifeq ($(feature-zlib), 1) |
| 899 | CFLAGS += -DHAVE_ZLIB_SUPPORT |
| 900 | EXTLIBS += -lz |
Jiri Olsa | 1571b69 | 2014-12-30 13:31:12 +0100 | [diff] [blame] | 901 | $(call detected,CONFIG_ZLIB) |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 902 | else |
| 903 | NO_ZLIB := 1 |
| 904 | endif |
| 905 | endif |
| 906 | |
Jiri Olsa | 80a32e5b | 2015-01-29 13:29:39 +0100 | [diff] [blame] | 907 | ifndef NO_LZMA |
| 908 | ifeq ($(feature-lzma), 1) |
| 909 | CFLAGS += -DHAVE_LZMA_SUPPORT |
| 910 | EXTLIBS += -llzma |
| 911 | $(call detected,CONFIG_LZMA) |
| 912 | else |
| 913 | msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev); |
| 914 | NO_LZMA := 1 |
| 915 | endif |
| 916 | endif |
| 917 | |
Alexey Budankov | 3b1c5d9 | 2019-03-18 20:39:49 +0300 | [diff] [blame] | 918 | ifndef NO_LIBZSTD |
| 919 | ifeq ($(feature-libzstd), 1) |
| 920 | CFLAGS += -DHAVE_ZSTD_SUPPORT |
| 921 | CFLAGS += $(LIBZSTD_CFLAGS) |
| 922 | LDFLAGS += $(LIBZSTD_LDFLAGS) |
| 923 | EXTLIBS += -lzstd |
| 924 | $(call detected,CONFIG_ZSTD) |
| 925 | else |
| 926 | msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR); |
| 927 | NO_LIBZSTD := 1 |
| 928 | endif |
| 929 | endif |
| 930 | |
Igor Lubashev | 74d5f3d | 2019-08-07 10:44:14 -0400 | [diff] [blame] | 931 | ifndef NO_LIBCAP |
| 932 | ifeq ($(feature-libcap), 1) |
| 933 | CFLAGS += -DHAVE_LIBCAP_SUPPORT |
| 934 | EXTLIBS += -lcap |
| 935 | $(call detected,CONFIG_LIBCAP) |
| 936 | else |
| 937 | msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev); |
| 938 | NO_LIBCAP := 1 |
| 939 | endif |
| 940 | endif |
| 941 | |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 942 | ifndef NO_BACKTRACE |
Ingo Molnar | 4cc9117 | 2013-09-30 16:49:38 +0200 | [diff] [blame] | 943 | ifeq ($(feature-backtrace), 1) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 944 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 945 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 946 | endif |
Jiri Olsa | 58a0abd | 2013-03-18 00:45:27 +0100 | [diff] [blame] | 947 | |
| 948 | ifndef NO_LIBNUMA |
Ingo Molnar | 3ae069c | 2013-09-30 13:37:10 +0200 | [diff] [blame] | 949 | ifeq ($(feature-libnuma), 0) |
Dongsheng Yang | 6305edf | 2013-12-02 10:26:48 -0500 | [diff] [blame] | 950 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev); |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 951 | NO_LIBNUMA := 1 |
| 952 | else |
Arnaldo Carvalho de Melo | f8ac860 | 2015-09-17 12:20:28 -0300 | [diff] [blame] | 953 | ifeq ($(feature-numa_num_possible_cpus), 0) |
| 954 | msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8); |
| 955 | NO_LIBNUMA := 1 |
| 956 | else |
| 957 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT |
| 958 | EXTLIBS += -lnuma |
| 959 | $(call detected,CONFIG_NUMA) |
| 960 | endif |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 961 | endif |
Jiri Olsa | 58a0abd | 2013-03-18 00:45:27 +0100 | [diff] [blame] | 962 | endif |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 963 | |
Alexander Yarygin | da50ad6 | 2014-07-03 17:59:49 +0400 | [diff] [blame] | 964 | ifdef HAVE_KVM_STAT_SUPPORT |
| 965 | CFLAGS += -DHAVE_KVM_STAT_SUPPORT |
| 966 | endif |
| 967 | |
Song Liu | 8a1b171 | 2019-03-11 22:30:48 -0700 | [diff] [blame] | 968 | ifeq ($(feature-disassembler-four-args), 1) |
| 969 | CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE |
| 970 | endif |
| 971 | |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 972 | ifeq (${IS_64_BIT}, 1) |
| 973 | ifndef NO_PERF_READ_VDSO32 |
| 974 | $(call feature_check,compile-32) |
Adrian Hunter | 46b1fa8 | 2014-10-23 13:45:24 +0300 | [diff] [blame] | 975 | ifeq ($(feature-compile-32), 1) |
| 976 | CFLAGS += -DHAVE_PERF_READ_VDSO32 |
| 977 | else |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 978 | NO_PERF_READ_VDSO32 := 1 |
| 979 | endif |
| 980 | endif |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 981 | ifneq ($(SRCARCH), x86) |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 982 | NO_PERF_READ_VDSOX32 := 1 |
| 983 | endif |
| 984 | ifndef NO_PERF_READ_VDSOX32 |
| 985 | $(call feature_check,compile-x32) |
Adrian Hunter | 46b1fa8 | 2014-10-23 13:45:24 +0300 | [diff] [blame] | 986 | ifeq ($(feature-compile-x32), 1) |
| 987 | CFLAGS += -DHAVE_PERF_READ_VDSOX32 |
| 988 | else |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 989 | NO_PERF_READ_VDSOX32 := 1 |
| 990 | endif |
| 991 | endif |
| 992 | else |
| 993 | NO_PERF_READ_VDSO32 := 1 |
| 994 | NO_PERF_READ_VDSOX32 := 1 |
| 995 | endif |
| 996 | |
Jiri Olsa | 24787af | 2018-01-07 17:03:45 +0100 | [diff] [blame] | 997 | ifndef NO_LIBBABELTRACE |
Jiri Olsa | 97e7a51 | 2015-03-11 09:00:41 +0100 | [diff] [blame] | 998 | $(call feature_check,libbabeltrace) |
| 999 | ifeq ($(feature-libbabeltrace), 1) |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 1000 | CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS) |
| 1001 | LDFLAGS += $(LIBBABELTRACE_LDFLAGS) |
| 1002 | EXTLIBS += -lbabeltrace-ctf |
Jiri Olsa | edbe981 | 2015-02-20 23:17:00 +0100 | [diff] [blame] | 1003 | $(call detected,CONFIG_LIBBABELTRACE) |
Jiri Olsa | 97e7a51 | 2015-03-11 09:00:41 +0100 | [diff] [blame] | 1004 | else |
| 1005 | msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev); |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 1006 | endif |
| 1007 | endif |
| 1008 | |
Adrian Hunter | e31f0d0 | 2015-04-30 17:37:27 +0300 | [diff] [blame] | 1009 | ifndef NO_AUXTRACE |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 1010 | ifeq ($(SRCARCH),x86) |
Mathieu Poirier | 08d5204 | 2016-09-16 09:49:58 -0600 | [diff] [blame] | 1011 | ifeq ($(feature-get_cpuid), 0) |
| 1012 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); |
| 1013 | NO_AUXTRACE := 1 |
| 1014 | endif |
| 1015 | endif |
| 1016 | ifndef NO_AUXTRACE |
Arnaldo Carvalho de Melo | b0063db | 2015-09-17 12:54:30 -0300 | [diff] [blame] | 1017 | $(call detected,CONFIG_AUXTRACE) |
| 1018 | CFLAGS += -DHAVE_AUXTRACE_SUPPORT |
Arnaldo Carvalho de Melo | 70f9c9b | 2021-11-16 14:44:17 -0300 | [diff] [blame] | 1019 | ifeq ($(feature-reallocarray), 0) |
| 1020 | CFLAGS += -DCOMPAT_NEED_REALLOCARRAY |
| 1021 | endif |
Arnaldo Carvalho de Melo | b0063db | 2015-09-17 12:54:30 -0300 | [diff] [blame] | 1022 | endif |
Adrian Hunter | e31f0d0 | 2015-04-30 17:37:27 +0300 | [diff] [blame] | 1023 | endif |
| 1024 | |
Jiri Olsa | d4dfdf0 | 2016-11-02 14:35:49 +0100 | [diff] [blame] | 1025 | ifndef NO_JVMTI |
| 1026 | ifneq (,$(wildcard /usr/sbin/update-java-alternatives)) |
| 1027 | JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}') |
| 1028 | else |
| 1029 | ifneq (,$(wildcard /usr/sbin/alternatives)) |
Thomas Richter | 815c156 | 2019-09-09 13:41:16 +0200 | [diff] [blame] | 1030 | 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') |
Jiri Olsa | d4dfdf0 | 2016-11-02 14:35:49 +0100 | [diff] [blame] | 1031 | endif |
| 1032 | endif |
| 1033 | ifndef JDIR |
| 1034 | $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory) |
| 1035 | NO_JVMTI := 1 |
| 1036 | endif |
| 1037 | endif |
| 1038 | |
| 1039 | ifndef NO_JVMTI |
| 1040 | FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux |
| 1041 | $(call feature_check,jvmti) |
| 1042 | ifeq ($(feature-jvmti), 1) |
| 1043 | $(call detected_var,JDIR) |
Jiri Olsa | dd1d004 | 2018-11-21 16:43:41 +0100 | [diff] [blame] | 1044 | ifndef NO_JVMTI_CMLR |
| 1045 | FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti) |
| 1046 | $(call feature_check,jvmti-cmlr) |
| 1047 | ifeq ($(feature-jvmti-cmlr), 1) |
| 1048 | CFLAGS += -DHAVE_JVMTI_CMLR |
| 1049 | endif |
| 1050 | endif # NO_JVMTI_CMLR |
Jiri Olsa | d4dfdf0 | 2016-11-02 14:35:49 +0100 | [diff] [blame] | 1051 | else |
Arnaldo Carvalho de Melo | e14b733 | 2018-04-11 12:08:53 -0300 | [diff] [blame] | 1052 | $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel) |
Jiri Olsa | d4dfdf0 | 2016-11-02 14:35:49 +0100 | [diff] [blame] | 1053 | NO_JVMTI := 1 |
| 1054 | endif |
| 1055 | endif |
| 1056 | |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 1057 | USE_CXX = 0 |
| 1058 | USE_CLANGLLVM = 0 |
| 1059 | ifdef LIBCLANGLLVM |
| 1060 | $(call feature_check,cxx) |
| 1061 | ifneq ($(feature-cxx), 1) |
| 1062 | msg := $(warning No g++ found, disable clang and llvm support. Please install g++) |
| 1063 | else |
| 1064 | $(call feature_check,llvm) |
Wang Nan | a940cad | 2016-12-06 07:22:30 +0000 | [diff] [blame] | 1065 | $(call feature_check,llvm-version) |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 1066 | ifneq ($(feature-llvm), 1) |
Wang Nan | a940cad | 2016-12-06 07:22:30 +0000 | [diff] [blame] | 1067 | msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0)) |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 1068 | else |
| 1069 | $(call feature_check,clang) |
| 1070 | ifneq ($(feature-clang), 1) |
Wang Nan | a940cad | 2016-12-06 07:22:30 +0000 | [diff] [blame] | 1071 | msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0)) |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 1072 | else |
| 1073 | CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT |
| 1074 | CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir) |
| 1075 | $(call detected,CONFIG_CXX) |
| 1076 | $(call detected,CONFIG_CLANGLLVM) |
| 1077 | USE_CXX = 1 |
| 1078 | USE_LLVM = 1 |
| 1079 | USE_CLANG = 1 |
Wang Nan | a940cad | 2016-12-06 07:22:30 +0000 | [diff] [blame] | 1080 | ifneq ($(feature-llvm-version),1) |
| 1081 | msg := $(warning This version of LLVM is not tested. May cause build errors) |
| 1082 | endif |
Wang Nan | d58ac0b | 2016-11-26 07:03:33 +0000 | [diff] [blame] | 1083 | endif |
| 1084 | endif |
| 1085 | endif |
| 1086 | endif |
| 1087 | |
Stephane Eranian | 7094349 | 2020-05-05 11:29:43 -0700 | [diff] [blame] | 1088 | ifdef LIBPFM4 |
| 1089 | $(call feature_check,libpfm4) |
| 1090 | ifeq ($(feature-libpfm4), 1) |
| 1091 | CFLAGS += -DHAVE_LIBPFM |
| 1092 | EXTLIBS += -lpfm |
| 1093 | ASCIIDOC_EXTRA = -aHAVE_LIBPFM=1 |
| 1094 | $(call detected,CONFIG_LIBPFM4) |
| 1095 | else |
| 1096 | msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev); |
| 1097 | NO_LIBPFM4 := 1 |
| 1098 | endif |
| 1099 | endif |
| 1100 | |
Michael Petlan | 56d32d4 | 2021-04-28 11:20:23 +0200 | [diff] [blame] | 1101 | ifdef LIBTRACEEVENT_DYNAMIC |
| 1102 | $(call feature_check,libtraceevent) |
| 1103 | ifeq ($(feature-libtraceevent), 1) |
| 1104 | EXTLIBS += -ltraceevent |
Ian Rogers | 5697151 | 2021-09-22 17:10:22 -0700 | [diff] [blame] | 1105 | LIBTRACEEVENT_VERSION := $(shell $(PKG_CONFIG) --modversion libtraceevent) |
| 1106 | LIBTRACEEVENT_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEEVENT_VERSION))) |
| 1107 | LIBTRACEEVENT_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEEVENT_VERSION))) |
| 1108 | LIBTRACEEVENT_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEEVENT_VERSION))) |
| 1109 | LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3)) |
| 1110 | CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP) |
Michael Petlan | 56d32d4 | 2021-04-28 11:20:23 +0200 | [diff] [blame] | 1111 | else |
| 1112 | dummy := $(error Error: No libtraceevent devel library found, please install libtraceevent-devel); |
| 1113 | endif |
| 1114 | endif |
| 1115 | |
Ian Rogers | b758a61 | 2021-09-22 17:10:21 -0700 | [diff] [blame] | 1116 | ifdef LIBTRACEFS_DYNAMIC |
| 1117 | $(call feature_check,libtracefs) |
| 1118 | ifeq ($(feature-libtracefs), 1) |
| 1119 | EXTLIBS += -ltracefs |
Ian Rogers | 359cad0 | 2021-09-22 17:10:23 -0700 | [diff] [blame] | 1120 | LIBTRACEFS_VERSION := $(shell $(PKG_CONFIG) --modversion libtracefs) |
| 1121 | LIBTRACEFS_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEFS_VERSION))) |
| 1122 | LIBTRACEFS_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEFS_VERSION))) |
| 1123 | LIBTRACEFS_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEFS_VERSION))) |
| 1124 | LIBTRACEFS_VERSION_CPP := $(shell expr $(LIBTRACEFS_VERSION_1) \* 255 \* 255 + $(LIBTRACEFS_VERSION_2) \* 255 + $(LIBTRACEFS_VERSION_3)) |
| 1125 | CFLAGS += -DLIBTRACEFS_VERSION=$(LIBTRACEFS_VERSION_CPP) |
Ian Rogers | b758a61 | 2021-09-22 17:10:21 -0700 | [diff] [blame] | 1126 | else |
| 1127 | dummy := $(error Error: No libtracefs devel library found, please install libtracefs-dev); |
| 1128 | endif |
| 1129 | endif |
| 1130 | |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1131 | # Among the variables below, these: |
| 1132 | # perfexecdir |
Arnaldo Carvalho de Melo | 1b16fff | 2018-05-04 10:37:27 -0300 | [diff] [blame] | 1133 | # perf_include_dir |
Arnaldo Carvalho de Melo | 8f12a2f | 2018-05-04 11:56:15 -0300 | [diff] [blame] | 1134 | # perf_examples_dir |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1135 | # template_dir |
| 1136 | # mandir |
| 1137 | # infodir |
| 1138 | # htmldir |
| 1139 | # ETC_PERFCONFIG (but not sysconfdir) |
| 1140 | # can be specified as a relative path some/where/else; |
| 1141 | # this is interpreted as relative to $(prefix) and "perf" at |
| 1142 | # runtime figures out where they are based on the path to the executable. |
| 1143 | # This can help installing the suite in a relocatable way. |
| 1144 | |
| 1145 | # Make the path relative to DESTDIR, not to prefix |
| 1146 | ifndef DESTDIR |
Jianyu Zhan | fc9cabe | 2014-06-03 00:44:34 +0800 | [diff] [blame] | 1147 | prefix ?= $(HOME) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1148 | endif |
| 1149 | bindir_relative = bin |
Pawel Moll | 0927bee | 2015-07-28 15:10:13 +0100 | [diff] [blame] | 1150 | bindir = $(abspath $(prefix)/$(bindir_relative)) |
Adrian Hunter | 0beb218 | 2021-06-27 16:18:13 +0300 | [diff] [blame] | 1151 | includedir_relative = include |
| 1152 | includedir = $(abspath $(prefix)/$(includedir_relative)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1153 | mandir = share/man |
| 1154 | infodir = share/info |
| 1155 | perfexecdir = libexec/perf-core |
Thomas Richter | 83868bf | 2018-07-31 09:32:54 +0200 | [diff] [blame] | 1156 | perf_include_dir = lib/perf/include |
| 1157 | perf_examples_dir = lib/perf/examples |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1158 | sharedir = $(prefix)/share |
| 1159 | template_dir = share/perf-core/templates |
Arnaldo Carvalho de Melo | 005438a8 | 2015-07-20 12:02:09 -0300 | [diff] [blame] | 1160 | STRACE_GROUPS_DIR = share/perf-core/strace/groups |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1161 | htmldir = share/doc/perf-doc |
Namhyung Kim | 14cbfbe | 2016-01-07 20:41:53 +0900 | [diff] [blame] | 1162 | tipdir = share/doc/perf-tip |
Namhyung Kim | 84cfac7 | 2016-01-09 19:16:28 +0900 | [diff] [blame] | 1163 | srcdir = $(srctree)/tools/perf |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1164 | ifeq ($(prefix),/usr) |
| 1165 | sysconfdir = /etc |
| 1166 | ETC_PERFCONFIG = $(sysconfdir)/perfconfig |
| 1167 | else |
| 1168 | sysconfdir = $(prefix)/etc |
| 1169 | ETC_PERFCONFIG = etc/perfconfig |
| 1170 | endif |
Jiri Olsa | 6997af72 | 2014-08-25 16:55:52 +0200 | [diff] [blame] | 1171 | ifndef lib |
Jiada Wang | 7a759cd | 2017-04-09 20:02:37 -0700 | [diff] [blame] | 1172 | ifeq ($(SRCARCH)$(IS_64_BIT), x861) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 1173 | lib = lib64 |
| 1174 | else |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1175 | lib = lib |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 1176 | endif |
Jiri Olsa | 6997af72 | 2014-08-25 16:55:52 +0200 | [diff] [blame] | 1177 | endif # lib |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 1178 | libdir = $(prefix)/$(lib) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1179 | |
| 1180 | # Shell quote (do not use $(call) to accommodate ancient setups); |
| 1181 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) |
Arnaldo Carvalho de Melo | 005438a8 | 2015-07-20 12:02:09 -0300 | [diff] [blame] | 1182 | STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1183 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
| 1184 | bindir_SQ = $(subst ','\'',$(bindir)) |
Adrian Hunter | 0beb218 | 2021-06-27 16:18:13 +0300 | [diff] [blame] | 1185 | includedir_SQ = $(subst ','\'',$(includedir)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1186 | mandir_SQ = $(subst ','\'',$(mandir)) |
| 1187 | infodir_SQ = $(subst ','\'',$(infodir)) |
| 1188 | perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) |
Arnaldo Carvalho de Melo | 1b16fff | 2018-05-04 10:37:27 -0300 | [diff] [blame] | 1189 | perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir)) |
Arnaldo Carvalho de Melo | 8f12a2f | 2018-05-04 11:56:15 -0300 | [diff] [blame] | 1190 | perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1191 | template_dir_SQ = $(subst ','\'',$(template_dir)) |
| 1192 | htmldir_SQ = $(subst ','\'',$(htmldir)) |
Namhyung Kim | 14cbfbe | 2016-01-07 20:41:53 +0900 | [diff] [blame] | 1193 | tipdir_SQ = $(subst ','\'',$(tipdir)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1194 | prefix_SQ = $(subst ','\'',$(prefix)) |
| 1195 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 1196 | libdir_SQ = $(subst ','\'',$(libdir)) |
Namhyung Kim | 84cfac7 | 2016-01-09 19:16:28 +0900 | [diff] [blame] | 1197 | srcdir_SQ = $(subst ','\'',$(srcdir)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1198 | |
| 1199 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) |
| 1200 | perfexec_instdir = $(perfexecdir) |
Arnaldo Carvalho de Melo | 1b16fff | 2018-05-04 10:37:27 -0300 | [diff] [blame] | 1201 | perf_include_instdir = $(perf_include_dir) |
Arnaldo Carvalho de Melo | 8f12a2f | 2018-05-04 11:56:15 -0300 | [diff] [blame] | 1202 | perf_examples_instdir = $(perf_examples_dir) |
Arnaldo Carvalho de Melo | 005438a8 | 2015-07-20 12:02:09 -0300 | [diff] [blame] | 1203 | STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR) |
Namhyung Kim | 14cbfbe | 2016-01-07 20:41:53 +0900 | [diff] [blame] | 1204 | tip_instdir = $(tipdir) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1205 | else |
| 1206 | perfexec_instdir = $(prefix)/$(perfexecdir) |
Arnaldo Carvalho de Melo | 1b16fff | 2018-05-04 10:37:27 -0300 | [diff] [blame] | 1207 | perf_include_instdir = $(prefix)/$(perf_include_dir) |
Arnaldo Carvalho de Melo | 8f12a2f | 2018-05-04 11:56:15 -0300 | [diff] [blame] | 1208 | perf_examples_instdir = $(prefix)/$(perf_examples_dir) |
Arnaldo Carvalho de Melo | 005438a8 | 2015-07-20 12:02:09 -0300 | [diff] [blame] | 1209 | STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR) |
Namhyung Kim | 14cbfbe | 2016-01-07 20:41:53 +0900 | [diff] [blame] | 1210 | tip_instdir = $(prefix)/$(tipdir) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 1211 | endif |
| 1212 | perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) |
Arnaldo Carvalho de Melo | 1b16fff | 2018-05-04 10:37:27 -0300 | [diff] [blame] | 1213 | perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir)) |
Arnaldo Carvalho de Melo | 8f12a2f | 2018-05-04 11:56:15 -0300 | [diff] [blame] | 1214 | perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir)) |
Arnaldo Carvalho de Melo | 005438a8 | 2015-07-20 12:02:09 -0300 | [diff] [blame] | 1215 | STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR)) |
Namhyung Kim | 14cbfbe | 2016-01-07 20:41:53 +0900 | [diff] [blame] | 1216 | tip_instdir_SQ = $(subst ','\'',$(tip_instdir)) |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 1217 | |
| 1218 | # If we install to $(HOME) we keep the traceevent default: |
| 1219 | # $(HOME)/.traceevent/plugins |
| 1220 | # Otherwise we install plugins into the global $(libdir). |
| 1221 | ifdef DESTDIR |
| 1222 | plugindir=$(libdir)/traceevent/plugins |
Josh Boyer | b935a58 | 2014-01-22 10:01:48 -0500 | [diff] [blame] | 1223 | plugindir_SQ= $(subst ','\'',$(plugindir)) |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 1224 | endif |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 1225 | |
Jiri Olsa | 4b20d68 | 2015-03-02 13:30:30 +0100 | [diff] [blame] | 1226 | print_var = $(eval $(print_var_code)) $(info $(MSG)) |
| 1227 | define print_var_code |
Jiri Olsa | 8d79076 | 2014-02-19 16:52:55 +0100 | [diff] [blame] | 1228 | MSG = $(shell printf '...%30s: %s' $(1) $($(1))) |
| 1229 | endef |
| 1230 | |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 1231 | ifeq ($(VF),1) |
Jiri Olsa | 99402e0 | 2018-01-09 10:26:46 +0100 | [diff] [blame] | 1232 | # Display EXTRA features which are detected manualy |
| 1233 | # from here with feature_check call and thus cannot |
| 1234 | # be partof global state output. |
| 1235 | $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),)) |
Jiri Olsa | 4b20d68 | 2015-03-02 13:30:30 +0100 | [diff] [blame] | 1236 | $(call print_var,prefix) |
| 1237 | $(call print_var,bindir) |
| 1238 | $(call print_var,libdir) |
| 1239 | $(call print_var,sysconfdir) |
| 1240 | $(call print_var,LIBUNWIND_DIR) |
| 1241 | $(call print_var,LIBDW_DIR) |
Jiri Olsa | d4dfdf0 | 2016-11-02 14:35:49 +0100 | [diff] [blame] | 1242 | $(call print_var,JDIR) |
Jiri Olsa | 76ee2ff | 2015-12-23 18:58:31 +0100 | [diff] [blame] | 1243 | |
| 1244 | ifeq ($(dwarf-post-unwind),1) |
| 1245 | $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text)) |
| 1246 | endif |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 1247 | $(info ) |
| 1248 | endif |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 1249 | |
| 1250 | $(call detected_var,bindir_SQ) |
| 1251 | $(call detected_var,PYTHON_WORD) |
| 1252 | ifneq ($(OUTPUT),) |
| 1253 | $(call detected_var,OUTPUT) |
| 1254 | endif |
Jiri Olsa | 285ab8b | 2014-12-29 15:13:44 +0100 | [diff] [blame] | 1255 | $(call detected_var,htmldir_SQ) |
| 1256 | $(call detected_var,infodir_SQ) |
| 1257 | $(call detected_var,mandir_SQ) |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 1258 | $(call detected_var,ETC_PERFCONFIG_SQ) |
Arnaldo Carvalho de Melo | 005438a8 | 2015-07-20 12:02:09 -0300 | [diff] [blame] | 1259 | $(call detected_var,STRACE_GROUPS_DIR_SQ) |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 1260 | $(call detected_var,prefix_SQ) |
| 1261 | $(call detected_var,perfexecdir_SQ) |
Arnaldo Carvalho de Melo | 1b16fff | 2018-05-04 10:37:27 -0300 | [diff] [blame] | 1262 | $(call detected_var,perf_include_dir_SQ) |
Arnaldo Carvalho de Melo | 8f12a2f | 2018-05-04 11:56:15 -0300 | [diff] [blame] | 1263 | $(call detected_var,perf_examples_dir_SQ) |
Namhyung Kim | 14cbfbe | 2016-01-07 20:41:53 +0900 | [diff] [blame] | 1264 | $(call detected_var,tipdir_SQ) |
Namhyung Kim | 84cfac7 | 2016-01-09 19:16:28 +0900 | [diff] [blame] | 1265 | $(call detected_var,srcdir_SQ) |
Jiri Olsa | 3b939a6 | 2014-12-30 00:16:01 +0100 | [diff] [blame] | 1266 | $(call detected_var,LIBDIR) |
Jiri Olsa | 88aeea0 | 2014-12-30 00:34:23 +0100 | [diff] [blame] | 1267 | $(call detected_var,GTK_CFLAGS) |
Jiri Olsa | c7355f8 | 2014-12-30 13:11:32 +0100 | [diff] [blame] | 1268 | $(call detected_var,PERL_EMBED_CCOPTS) |
| 1269 | $(call detected_var,PYTHON_EMBED_CCOPTS) |
Denys Zagorui | 6793672 | 2021-05-24 04:15:14 -0700 | [diff] [blame] | 1270 | ifneq ($(BISON_FILE_PREFIX_MAP),) |
| 1271 | $(call detected_var,BISON_FILE_PREFIX_MAP) |
| 1272 | endif |
Jiri Olsa | fbed59f | 2021-04-26 15:27:32 -0300 | [diff] [blame] | 1273 | |
| 1274 | # re-generate FEATURE-DUMP as we may have called feature_check, found out |
| 1275 | # extra libraries to add to LDFLAGS of some other test and then redo those |
| 1276 | # tests, see the block about libbfd, disassembler-four-args, for instance. |
| 1277 | $(shell rm -f $(FEATURE_DUMP_FILENAME)) |
| 1278 | $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME))) |
Arnaldo Carvalho de Melo | c6e3bf4 | 2021-04-26 15:47:39 -0300 | [diff] [blame] | 1279 | |
| 1280 | ifeq ($(feature_display),1) |
| 1281 | $(call feature_display_entries) |
| 1282 | endif |