Commit | Line | Data |
---|---|---|
8bd407b9 | 1 | |
a6cf5f39 JO |
2 | ifeq ($(src-perf),) |
3 | src-perf := $(srctree)/tools/perf | |
4 | endif | |
8bd407b9 | 5 | |
a6cf5f39 JO |
6 | ifeq ($(obj-perf),) |
7 | obj-perf := $(OUTPUT) | |
8bd407b9 JO |
8 | endif |
9 | ||
a6cf5f39 JO |
10 | ifneq ($(obj-perf),) |
11 | obj-perf := $(abspath $(obj-perf))/ | |
12 | endif | |
13 | ||
52c0a18b | 14 | $(shell printf "" > $(OUTPUT).config-detected) |
64227379 AK |
15 | detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) |
16 | detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) | |
fcfd6611 | 17 | |
a6cf5f39 JO |
18 | CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) |
19 | ||
935e6bd3 | 20 | include $(srctree)/tools/scripts/Makefile.arch |
a6cf5f39 | 21 | |
7a759cd8 | 22 | $(call detected_var,SRCARCH) |
f39e042a | 23 | |
a6cf5f39 | 24 | NO_PERF_REGS := 1 |
901bb028 | 25 | NO_SYSCALL_TABLE := 1 |
a6cf5f39 | 26 | |
dc642e83 | 27 | # Additional ARCH settings for ppc |
7a759cd8 | 28 | ifeq ($(SRCARCH),powerpc) |
dc642e83 | 29 | NO_PERF_REGS := 0 |
4281da23 RB |
30 | NO_SYSCALL_TABLE := 0 |
31 | CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated | |
c4522469 | 32 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 |
dc642e83 A |
33 | endif |
34 | ||
a6cf5f39 | 35 | # Additional ARCH settings for x86 |
7a759cd8 | 36 | ifeq ($(SRCARCH),x86) |
f39e042a | 37 | $(call detected,CONFIG_X86) |
c6e5e9fb | 38 | ifeq (${IS_64_BIT}, 1) |
901bb028 HB |
39 | NO_SYSCALL_TABLE := 0 |
40 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated | |
8e1b3f68 | 41 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S |
60913e00 | 42 | LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma |
72965b87 | 43 | $(call detected,CONFIG_X86_64) |
8a0c4c28 | 44 | else |
05b41775 | 45 | LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind |
8e1b3f68 JO |
46 | endif |
47 | NO_PERF_REGS := 0 | |
8bd407b9 | 48 | endif |
8ab596af | 49 | |
7a759cd8 | 50 | ifeq ($(SRCARCH),arm) |
7495f374 WD |
51 | NO_PERF_REGS := 0 |
52 | LIBUNWIND_LIBS = -lunwind -lunwind-arm | |
53 | endif | |
8bd407b9 | 54 | |
7a759cd8 | 55 | ifeq ($(SRCARCH),arm64) |
8ab596af | 56 | NO_PERF_REGS := 0 |
a7f660d6 KP |
57 | NO_SYSCALL_TABLE := 0 |
58 | CFLAGS += -I$(OUTPUT)arch/arm64/include/generated | |
8ab596af JP |
59 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
60 | endif | |
61 | ||
3213486f MH |
62 | ifeq ($(SRCARCH),csky) |
63 | NO_PERF_REGS := 0 | |
64 | endif | |
65 | ||
f704ef44 HC |
66 | ifeq ($(ARCH),s390) |
67 | NO_PERF_REGS := 0 | |
901bb028 | 68 | NO_SYSCALL_TABLE := 0 |
a9a3f1d1 | 69 | CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated |
f704ef44 HC |
70 | endif |
71 | ||
3bc3374c JO |
72 | ifeq ($(NO_PERF_REGS),0) |
73 | $(call detected,CONFIG_PERF_REGS) | |
74 | endif | |
75 | ||
901bb028 | 76 | ifneq ($(NO_SYSCALL_TABLE),1) |
22e9af4e | 77 | CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT |
901bb028 HB |
78 | endif |
79 | ||
90fa9deb | 80 | # So far there's only x86 and arm libdw unwind support merged in perf. |
4dc549e5 JO |
81 | # Disable it on all other architectures in case libdw unwind |
82 | # support is detected in system. Add supported architectures | |
83 | # to the check. | |
3213486f | 84 | ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky)) |
4dc549e5 JO |
85 | NO_LIBDW_DWARF_UNWIND := 1 |
86 | endif | |
87 | ||
1448fef4 JP |
88 | ifeq ($(LIBUNWIND_LIBS),) |
89 | NO_LIBUNWIND := 1 | |
1448fef4 | 90 | endif |
5a155bb7 WN |
91 | # |
92 | # For linking with debug library, run like: | |
93 | # | |
94 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | |
95 | # | |
195106b9 HK |
96 | |
97 | libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code)) | |
98 | define libunwind_arch_set_flags_code | |
99 | FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include | |
100 | FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib | |
101 | endef | |
102 | ||
5a155bb7 WN |
103 | ifdef LIBUNWIND_DIR |
104 | LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include | |
105 | LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib | |
195106b9 HK |
106 | LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64 |
107 | $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch))) | |
5a155bb7 | 108 | endif |
5a155bb7 WN |
109 | |
110 | # Set per-feature check compilation flags | |
111 | FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS) | |
403cacb8 | 112 | FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) |
5a155bb7 | 113 | FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) |
403cacb8 | 114 | FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) |
1448fef4 | 115 | |
5c4d7c82 ACM |
116 | FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm |
117 | FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64 | |
118 | FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86 | |
119 | FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64 | |
120 | ||
271402a3 ACM |
121 | FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto |
122 | ||
aa6292f4 MP |
123 | ifdef CSINCLUDES |
124 | LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) | |
125 | endif | |
126 | OPENCSDLIBS := -lopencsd_c_api -lopencsd | |
127 | ifdef CSLIBS | |
128 | LIBOPENCSD_LDFLAGS := -L$(CSLIBS) | |
129 | endif | |
130 | FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS) | |
131 | FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS) | |
132 | ||
8bd407b9 | 133 | ifeq ($(NO_PERF_REGS),0) |
89fe808a | 134 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT |
8bd407b9 | 135 | endif |
a32f4936 | 136 | |
5a155bb7 WN |
137 | # for linking with debug library, run like: |
138 | # make DEBUG=1 LIBDW_DIR=/opt/libdw/ | |
139 | ifdef LIBDW_DIR | |
140 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include | |
141 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib | |
45757895 | 142 | endif |
ba335df4 KK |
143 | DWARFLIBS := -ldw |
144 | ifeq ($(findstring -static,${LDFLAGS}),-static) | |
145 | DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2 | |
146 | endif | |
5a155bb7 | 147 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) |
ba335df4 | 148 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS) |
45757895 | 149 | |
5a155bb7 WN |
150 | # for linking with debug library, run like: |
151 | # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/ | |
152 | ifdef LIBBABELTRACE_DIR | |
153 | LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include | |
154 | LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib | |
53d0a573 | 155 | endif |
5a155bb7 WN |
156 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
157 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf | |
53d0a573 | 158 | |
7a759cd8 | 159 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi |
7c53746e | 160 | # include ARCH specific config |
7a759cd8 | 161 | -include $(src-perf)/arch/$(SRCARCH)/Makefile |
7c53746e | 162 | |
63ab024a WN |
163 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
164 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET | |
165 | endif | |
166 | ||
ca70c24f | 167 | include $(srctree)/tools/scripts/utilities.mak |
a32f4936 JO |
168 | |
169 | ifeq ($(call get-executable,$(FLEX)),) | |
8e1b3f68 | 170 | dummy := $(error Error: $(FLEX) is missing on this system, please install it) |
a32f4936 JO |
171 | endif |
172 | ||
173 | ifeq ($(call get-executable,$(BISON)),) | |
8e1b3f68 | 174 | dummy := $(error Error: $(BISON) is missing on this system, please install it) |
a32f4936 | 175 | endif |
362493f0 JO |
176 | |
177 | # Treat warnings as errors unless directed not to | |
178 | ifneq ($(WERROR),0) | |
8e1b3f68 | 179 | CFLAGS += -Werror |
d58ac0bf | 180 | CXXFLAGS += -Werror |
362493f0 JO |
181 | endif |
182 | ||
74af377b AH |
183 | ifndef DEBUG |
184 | DEBUG := 0 | |
185 | endif | |
186 | ||
fcf92585 | 187 | ifeq ($(DEBUG),0) |
3866058e | 188 | ifeq ($(CC_NO_CLANG), 0) |
49b3cd30 ACM |
189 | CFLAGS += -O3 |
190 | else | |
8e1b3f68 | 191 | CFLAGS += -O6 |
362493f0 | 192 | endif |
49b3cd30 | 193 | endif |
362493f0 JO |
194 | |
195 | ifdef PARSER_DEBUG | |
8e1b3f68 JO |
196 | PARSER_DEBUG_BISON := -t |
197 | PARSER_DEBUG_FLEX := -d | |
198 | CFLAGS += -DPARSER_DEBUG | |
9352aaba JO |
199 | $(call detected_var,PARSER_DEBUG_BISON) |
200 | $(call detected_var,PARSER_DEBUG_FLEX) | |
362493f0 JO |
201 | endif |
202 | ||
5a155bb7 WN |
203 | # Try different combinations to accommodate systems that only have |
204 | # python[2][-config] in weird combinations but always preferring | |
205 | # python2 and python2-config as per pep-0394. If we catch a | |
206 | # python[-config] in version 3, the version check will kill it. | |
207 | PYTHON2 := $(if $(call get-executable,python2),python2,python) | |
208 | override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2)) | |
209 | PYTHON2_CONFIG := \ | |
210 | $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) | |
211 | override PYTHON_CONFIG := \ | |
212 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) | |
56c7d79e | 213 | |
7be6b316 DCC |
214 | grep-libs = $(filter -l%,$(1)) |
215 | strip-libs = $(filter-out -l%,$(1)) | |
56c7d79e | 216 | |
7be6b316 | 217 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
56c7d79e | 218 | |
7be6b316 DCC |
219 | ifdef PYTHON_CONFIG |
220 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
221 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | |
222 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil | |
32aa928a | 223 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) |
7be6b316 | 224 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
8bd8c653 ACM |
225 | endif |
226 | ||
5a155bb7 WN |
227 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
228 | FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) | |
229 | FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) | |
230 | FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) | |
56c7d79e | 231 | |
aa8f9c51 ACM |
232 | FEATURE_CHECK_LDFLAGS-libaio = -lrt |
233 | ||
8a1b1718 SL |
234 | FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes |
235 | ||
2fe73746 JO |
236 | CFLAGS += -fno-omit-frame-pointer |
237 | CFLAGS += -ggdb3 | |
238 | CFLAGS += -funwind-tables | |
239 | CFLAGS += -Wall | |
240 | CFLAGS += -Wextra | |
241 | CFLAGS += -std=gnu99 | |
9c12cf95 | 242 | |
d58ac0bf WN |
243 | CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti |
244 | CXXFLAGS += -Wall | |
245 | CXXFLAGS += -fno-omit-frame-pointer | |
246 | CXXFLAGS += -ggdb3 | |
247 | CXXFLAGS += -funwind-tables | |
248 | CXXFLAGS += -Wno-strict-aliasing | |
249 | ||
6392b4eb MK |
250 | # Enforce a non-executable stack, as we may regress (again) in the future by |
251 | # adding assembler files missing the .GNU-stack linker note. | |
252 | LDFLAGS += -Wl,-z,noexecstack | |
253 | ||
5e2d4d0e | 254 | EXTLIBS = -lpthread -lrt -lm -ldl |
362493f0 | 255 | |
96b9e70b | 256 | ifeq ($(FEATURES_DUMP),) |
e6c76d62 | 257 | include $(srctree)/tools/build/Makefile.feature |
96b9e70b JO |
258 | else |
259 | include $(FEATURES_DUMP) | |
260 | endif | |
baa9c30e | 261 | |
90ac5422 | 262 | ifeq ($(feature-stackprotector-all), 1) |
8e1b3f68 | 263 | CFLAGS += -fstack-protector-all |
362493f0 JO |
264 | endif |
265 | ||
fcf92585 | 266 | ifeq ($(DEBUG),0) |
1ea6f99e | 267 | ifeq ($(feature-fortify-source), 1) |
8e1b3f68 JO |
268 | CFLAGS += -D_FORTIFY_SOURCE=2 |
269 | endif | |
362493f0 JO |
270 | endif |
271 | ||
e67d52d4 | 272 | INC_FLAGS += -I$(src-perf)/util/include |
7a759cd8 | 273 | INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include |
e67d52d4 WN |
274 | INC_FLAGS += -I$(srctree)/tools/include/uapi |
275 | INC_FLAGS += -I$(srctree)/tools/include/ | |
7a759cd8 JW |
276 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi |
277 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ | |
278 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ | |
7c53746e JO |
279 | |
280 | # $(obj-perf) for generated common-cmds.h | |
281 | # $(obj-perf)/util for generated bison/flex headers | |
282 | ifneq ($(OUTPUT),) | |
e67d52d4 WN |
283 | INC_FLAGS += -I$(obj-perf)/util |
284 | INC_FLAGS += -I$(obj-perf) | |
7c53746e JO |
285 | endif |
286 | ||
e67d52d4 WN |
287 | INC_FLAGS += -I$(src-perf)/util |
288 | INC_FLAGS += -I$(src-perf) | |
289 | INC_FLAGS += -I$(srctree)/tools/lib/ | |
290 | ||
291 | CFLAGS += $(INC_FLAGS) | |
292 | CXXFLAGS += $(INC_FLAGS) | |
7c53746e | 293 | |
2fe73746 | 294 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
362493f0 | 295 | |
f6d31369 AH |
296 | ifeq ($(feature-sync-compare-and-swap), 1) |
297 | CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT | |
298 | endif | |
299 | ||
459a3df7 VG |
300 | ifeq ($(feature-pthread-attr-setaffinity-np), 1) |
301 | CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP | |
302 | endif | |
303 | ||
25ab5abf ACM |
304 | ifeq ($(feature-pthread-barrier), 1) |
305 | CFLAGS += -DHAVE_PTHREAD_BARRIER | |
306 | endif | |
307 | ||
4e22db46 | 308 | ifndef NO_BIONIC |
5febff00 | 309 | $(call feature_check,bionic) |
78e9d655 IM |
310 | ifeq ($(feature-bionic), 1) |
311 | BIONIC := 1 | |
748fe088 | 312 | CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE |
d7a8c4a6 | 313 | CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE |
78e9d655 IM |
314 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) |
315 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) | |
316 | endif | |
362493f0 | 317 | endif |
cf4cca10 | 318 | |
11c6cbe7 ACM |
319 | ifeq ($(feature-eventfd), 1) |
320 | CFLAGS += -DHAVE_EVENTFD | |
321 | endif | |
322 | ||
8feb8efe ACM |
323 | ifeq ($(feature-get_current_dir_name), 1) |
324 | CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME | |
325 | endif | |
326 | ||
cf4cca10 | 327 | ifdef NO_LIBELF |
8e1b3f68 JO |
328 | NO_DWARF := 1 |
329 | NO_DEMANGLE := 1 | |
330 | NO_LIBUNWIND := 1 | |
5ea84154 | 331 | NO_LIBDW_DWARF_UNWIND := 1 |
ed63f34c | 332 | NO_LIBBPF := 1 |
e5e992a7 | 333 | NO_JVMTI := 1 |
cf4cca10 | 334 | else |
8f7f8005 | 335 | ifeq ($(feature-libelf), 0) |
e12762cf | 336 | ifeq ($(feature-glibc), 1) |
50eed7a7 IM |
337 | LIBC_SUPPORT := 1 |
338 | endif | |
339 | ifeq ($(BIONIC),1) | |
340 | LIBC_SUPPORT := 1 | |
341 | endif | |
342 | ifeq ($(LIBC_SUPPORT),1) | |
e5e992a7 | 343 | 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); |
50eed7a7 IM |
344 | |
345 | NO_LIBELF := 1 | |
346 | NO_DWARF := 1 | |
347 | NO_DEMANGLE := 1 | |
94589557 ACM |
348 | NO_LIBUNWIND := 1 |
349 | NO_LIBDW_DWARF_UNWIND := 1 | |
ed63f34c | 350 | NO_LIBBPF := 1 |
e5e992a7 | 351 | NO_JVMTI := 1 |
50eed7a7 | 352 | else |
f9ca2d89 ACM |
353 | ifneq ($(filter s% -static%,$(LDFLAGS),),) |
354 | msg := $(error No static glibc found, please install glibc-static); | |
355 | else | |
356 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); | |
357 | endif | |
50eed7a7 | 358 | endif |
8e1b3f68 | 359 | else |
0a4f2b6a JO |
360 | ifndef NO_LIBDW_DWARF_UNWIND |
361 | ifneq ($(feature-libdw-dwarf-unwind),1) | |
362 | NO_LIBDW_DWARF_UNWIND := 1 | |
363 | msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR); | |
364 | endif | |
365 | endif | |
8295d4e2 | 366 | ifneq ($(feature-dwarf), 1) |
2484c4c5 DCC |
367 | ifndef NO_DWARF |
368 | 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); | |
369 | NO_DWARF := 1 | |
370 | endif | |
bd0419e2 ACM |
371 | else |
372 | ifneq ($(feature-dwarf_getlocations), 1) | |
373 | msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157); | |
374 | else | |
a36ebe4e | 375 | CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT |
bd0419e2 | 376 | endif # dwarf_getlocations |
50eed7a7 | 377 | endif # Dwarf support |
0648f839 | 378 | endif # libelf support |
cf4cca10 JO |
379 | endif # NO_LIBELF |
380 | ||
8e2c241f JY |
381 | ifeq ($(feature-glibc), 1) |
382 | CFLAGS += -DHAVE_GLIBC_SUPPORT | |
383 | endif | |
384 | ||
2a07d814 AB |
385 | ifeq ($(feature-libaio), 1) |
386 | ifndef NO_AIO | |
387 | CFLAGS += -DHAVE_AIO_SUPPORT | |
388 | endif | |
389 | endif | |
390 | ||
76d40849 NR |
391 | ifdef NO_DWARF |
392 | NO_LIBDW_DWARF_UNWIND := 1 | |
393 | endif | |
394 | ||
120010cb ACM |
395 | ifeq ($(feature-sched_getcpu), 1) |
396 | CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT | |
397 | endif | |
398 | ||
86bcdb5a ACM |
399 | ifeq ($(feature-setns), 1) |
400 | CFLAGS += -DHAVE_SETNS_SUPPORT | |
401 | $(call detected,CONFIG_SETNS) | |
402 | endif | |
403 | ||
1c3b28fd ACM |
404 | ifdef CORESIGHT |
405 | $(call feature_check,libopencsd) | |
aa6292f4 MP |
406 | ifeq ($(feature-libopencsd), 1) |
407 | CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) | |
408 | LDFLAGS += $(LIBOPENCSD_LDFLAGS) | |
409 | EXTLIBS += $(OPENCSDLIBS) | |
410 | $(call detected,CONFIG_LIBOPENCSD) | |
411 | ifdef CSTRACE_RAW | |
412 | CFLAGS += -DCS_DEBUG_RAW | |
413 | ifeq (${CSTRACE_RAW}, packed) | |
414 | CFLAGS += -DCS_RAW_PACKED | |
415 | endif | |
416 | endif | |
417 | endif | |
418 | endif | |
419 | ||
cf4cca10 | 420 | ifndef NO_LIBELF |
fb3d333b | 421 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
5e2d4d0e | 422 | EXTLIBS += -lelf |
709e6791 | 423 | $(call detected,CONFIG_LIBELF) |
779724fd | 424 | |
8869b17e | 425 | ifeq ($(feature-libelf-mmap), 1) |
fb3d333b IM |
426 | CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
427 | endif | |
779724fd | 428 | |
b7bcef6f | 429 | ifeq ($(feature-libelf-getphdrnum), 1) |
fb3d333b IM |
430 | CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT |
431 | endif | |
432 | ||
1c1a3a47 ACM |
433 | ifeq ($(feature-libelf-gelf_getnote), 1) |
434 | CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT | |
435 | else | |
436 | msg := $(warning gelf_getnote() not found on libelf, SDT support disabled); | |
437 | endif | |
438 | ||
2492c465 ACM |
439 | ifeq ($(feature-libelf-getshdrstrndx), 1) |
440 | CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT | |
441 | endif | |
442 | ||
fb3d333b IM |
443 | ifndef NO_DWARF |
444 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | |
7a759cd8 | 445 | msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled); |
fb3d333b IM |
446 | NO_DWARF := 1 |
447 | else | |
448 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) | |
449 | LDFLAGS += $(LIBDW_LDFLAGS) | |
7aec51cb | 450 | EXTLIBS += ${DWARFLIBS} |
8379fce4 | 451 | $(call detected,CONFIG_DWARF) |
fb3d333b IM |
452 | endif # PERF_HAVE_DWARF_REGS |
453 | endif # NO_DWARF | |
ed63f34c WN |
454 | |
455 | ifndef NO_LIBBPF | |
456 | ifeq ($(feature-bpf), 1) | |
457 | CFLAGS += -DHAVE_LIBBPF_SUPPORT | |
458 | $(call detected,CONFIG_LIBBPF) | |
459 | endif | |
1c0ed632 WN |
460 | |
461 | ifndef NO_DWARF | |
462 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET | |
463 | CFLAGS += -DHAVE_BPF_PROLOGUE | |
464 | $(call detected,CONFIG_BPF_PROLOGUE) | |
465 | else | |
7a759cd8 | 466 | msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset()); |
1c0ed632 WN |
467 | endif |
468 | else | |
469 | msg := $(warning DWARF support is off, BPF prologue is disabled); | |
470 | endif | |
471 | ||
ed63f34c | 472 | endif # NO_LIBBPF |
cf4cca10 | 473 | endif # NO_LIBELF |
0e433feb | 474 | |
e26e63be MH |
475 | ifndef NO_SDT |
476 | ifneq ($(feature-sdt), 1) | |
477 | msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev); | |
478 | NO_SDT := 1; | |
479 | else | |
480 | CFLAGS += -DHAVE_SDT_EVENT | |
481 | $(call detected,CONFIG_SDT_EVENT) | |
482 | endif | |
483 | endif | |
484 | ||
e12b202f | 485 | ifdef PERF_HAVE_JITDUMP |
621cb4e7 | 486 | ifndef NO_LIBELF |
e12b202f JO |
487 | $(call detected,CONFIG_JITDUMP) |
488 | CFLAGS += -DHAVE_JITDUMP | |
489 | endif | |
490 | endif | |
491 | ||
7a759cd8 | 492 | ifeq ($(SRCARCH),powerpc) |
65ccb4fa AB |
493 | ifndef NO_DWARF |
494 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX | |
495 | endif | |
496 | endif | |
497 | ||
0e433feb | 498 | ifndef NO_LIBUNWIND |
9d8e14d3 | 499 | have_libunwind := |
52ffe0ff | 500 | |
5c4d7c82 | 501 | $(call feature_check,libunwind-x86) |
52ffe0ff HK |
502 | ifeq ($(feature-libunwind-x86), 1) |
503 | $(call detected,CONFIG_LIBUNWIND_X86) | |
504 | CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT | |
505 | LDFLAGS += -lunwind-x86 | |
906a8276 | 506 | EXTLIBS_LIBUNWIND += -lunwind-x86 |
52ffe0ff HK |
507 | have_libunwind = 1 |
508 | endif | |
509 | ||
5c4d7c82 | 510 | $(call feature_check,libunwind-aarch64) |
057fbfb2 HK |
511 | ifeq ($(feature-libunwind-aarch64), 1) |
512 | $(call detected,CONFIG_LIBUNWIND_AARCH64) | |
513 | CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT | |
514 | LDFLAGS += -lunwind-aarch64 | |
906a8276 | 515 | EXTLIBS_LIBUNWIND += -lunwind-aarch64 |
057fbfb2 HK |
516 | have_libunwind = 1 |
517 | $(call feature_check,libunwind-debug-frame-aarch64) | |
518 | ifneq ($(feature-libunwind-debug-frame-aarch64), 1) | |
519 | msg := $(warning No debug_frame support found in libunwind-aarch64); | |
520 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64 | |
521 | endif | |
522 | endif | |
523 | ||
058f952d | 524 | ifneq ($(feature-libunwind), 1) |
0a4f2b6a | 525 | msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR); |
9d8e14d3 HK |
526 | NO_LOCAL_LIBUNWIND := 1 |
527 | else | |
528 | have_libunwind := 1 | |
529 | $(call detected,CONFIG_LOCAL_LIBUNWIND) | |
530 | endif | |
531 | ||
532 | ifneq ($(have_libunwind), 1) | |
308e1e70 | 533 | NO_LIBUNWIND := 1 |
0a4f2b6a | 534 | endif |
9d8e14d3 HK |
535 | else |
536 | NO_LOCAL_LIBUNWIND := 1 | |
0a4f2b6a JO |
537 | endif |
538 | ||
ed63f34c WN |
539 | ifndef NO_LIBBPF |
540 | ifneq ($(feature-bpf), 1) | |
541 | msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.) | |
542 | NO_LIBBPF := 1 | |
543 | endif | |
544 | endif | |
545 | ||
0a4f2b6a JO |
546 | dwarf-post-unwind := 1 |
547 | dwarf-post-unwind-text := BUG | |
548 | ||
549 | # setup DWARF post unwinder | |
550 | ifdef NO_LIBUNWIND | |
551 | ifdef NO_LIBDW_DWARF_UNWIND | |
552 | msg := $(warning Disabling post unwind, no support found.); | |
553 | dwarf-post-unwind := 0 | |
f47671e2 | 554 | else |
0a4f2b6a | 555 | dwarf-post-unwind-text := libdw |
b2e45c32 | 556 | $(call detected,CONFIG_LIBDW_DWARF_UNWIND) |
0a4f2b6a JO |
557 | endif |
558 | else | |
559 | dwarf-post-unwind-text := libunwind | |
b2e45c32 | 560 | $(call detected,CONFIG_LIBUNWIND) |
0a4f2b6a JO |
561 | # Enable libunwind support by default. |
562 | ifndef NO_LIBDW_DWARF_UNWIND | |
563 | NO_LIBDW_DWARF_UNWIND := 1 | |
564 | endif | |
565 | endif | |
566 | ||
567 | ifeq ($(dwarf-post-unwind),1) | |
568 | CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT | |
f39e042a | 569 | $(call detected,CONFIG_DWARF_UNWIND) |
0a4f2b6a JO |
570 | else |
571 | NO_DWARF_UNWIND := 1 | |
572 | endif | |
573 | ||
9d8e14d3 | 574 | ifndef NO_LOCAL_LIBUNWIND |
7a759cd8 | 575 | ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64)) |
0a4f2b6a JO |
576 | $(call feature_check,libunwind-debug-frame) |
577 | ifneq ($(feature-libunwind-debug-frame), 1) | |
578 | msg := $(warning No debug_frame support found in libunwind); | |
f47671e2 LT |
579 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME |
580 | endif | |
0a4f2b6a JO |
581 | else |
582 | # non-ARM has no dwarf_find_debug_frame() function: | |
583 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME | |
584 | endif | |
0a4f2b6a | 585 | EXTLIBS += $(LIBUNWIND_LIBS) |
9d8e14d3 HK |
586 | LDFLAGS += $(LIBUNWIND_LIBS) |
587 | endif | |
60913e00 KK |
588 | ifeq ($(findstring -static,${LDFLAGS}),-static) |
589 | # gcc -static links libgcc_eh which contans piece of libunwind | |
590 | LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition | |
591 | endif | |
9d8e14d3 HK |
592 | |
593 | ifndef NO_LIBUNWIND | |
594 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT | |
0a4f2b6a JO |
595 | CFLAGS += $(LIBUNWIND_CFLAGS) |
596 | LDFLAGS += $(LIBUNWIND_LDFLAGS) | |
906a8276 | 597 | EXTLIBS += $(EXTLIBS_LIBUNWIND) |
058f952d | 598 | endif |
a8279525 | 599 | |
b3fa3896 HB |
600 | ifeq ($(NO_SYSCALL_TABLE),0) |
601 | $(call detected,CONFIG_TRACE) | |
602 | else | |
603 | ifndef NO_LIBAUDIT | |
604 | ifneq ($(feature-libaudit), 1) | |
605 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); | |
606 | NO_LIBAUDIT := 1 | |
607 | else | |
608 | CFLAGS += -DHAVE_LIBAUDIT_SUPPORT | |
609 | EXTLIBS += -laudit | |
610 | $(call detected,CONFIG_TRACE) | |
611 | endif | |
8e1b3f68 | 612 | endif |
a8279525 | 613 | endif |
4a8f888a | 614 | |
8ee46460 SE |
615 | ifndef NO_LIBCRYPTO |
616 | ifneq ($(feature-libcrypto), 1) | |
54fceb0b | 617 | msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev); |
8ee46460 SE |
618 | NO_LIBCRYPTO := 1 |
619 | else | |
620 | CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT | |
621 | EXTLIBS += -lcrypto | |
622 | $(call detected,CONFIG_CRYPTO) | |
623 | endif | |
624 | endif | |
625 | ||
4a8f888a | 626 | ifdef NO_NEWT |
8e1b3f68 | 627 | NO_SLANG=1 |
4a8f888a JO |
628 | endif |
629 | ||
630 | ifndef NO_SLANG | |
b9498b50 | 631 | ifneq ($(feature-libslang), 1) |
9f776ba1 | 632 | msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev); |
8e1b3f68 JO |
633 | NO_SLANG := 1 |
634 | else | |
635 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h | |
636 | CFLAGS += -I/usr/include/slang | |
89fe808a | 637 | CFLAGS += -DHAVE_SLANG_SUPPORT |
8e1b3f68 | 638 | EXTLIBS += -lslang |
cf15c74c | 639 | $(call detected,CONFIG_SLANG) |
8e1b3f68 | 640 | endif |
4a8f888a | 641 | endif |
58cabf6a JO |
642 | |
643 | ifndef NO_GTK2 | |
a8a5cd8b | 644 | FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) |
7ef9e055 | 645 | ifneq ($(feature-gtk2), 1) |
8e1b3f68 JO |
646 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
647 | NO_GTK2 := 1 | |
648 | else | |
c7a79e96 | 649 | ifeq ($(feature-gtk2-infobar), 1) |
fc67297b | 650 | GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT |
8e1b3f68 | 651 | endif |
89fe808a | 652 | CFLAGS += -DHAVE_GTK2_SUPPORT |
a8a5cd8b MR |
653 | GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) |
654 | GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) | |
e2137086 | 655 | EXTLIBS += -ldl |
8e1b3f68 | 656 | endif |
58cabf6a | 657 | endif |
3082cb33 | 658 | |
3082cb33 | 659 | ifdef NO_LIBPERL |
8e1b3f68 | 660 | CFLAGS += -DNO_LIBPERL |
3082cb33 | 661 | else |
8e1b3f68 JO |
662 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
663 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) | |
664 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | |
86f5fe01 | 665 | PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) |
c6707fde JO |
666 | PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) |
667 | PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) | |
8e1b3f68 JO |
668 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
669 | ||
7181a671 | 670 | ifneq ($(feature-libperl), 1) |
8e1b3f68 JO |
671 | CFLAGS += -DNO_LIBPERL |
672 | NO_LIBPERL := 1 | |
a954e684 | 673 | msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev); |
8e1b3f68 JO |
674 | else |
675 | LDFLAGS += $(PERL_EMBED_LDFLAGS) | |
676 | EXTLIBS += $(PERL_EMBED_LIBADD) | |
8e2c241f | 677 | CFLAGS += -DHAVE_LIBPERL_SUPPORT |
c7355f84 | 678 | $(call detected,CONFIG_LIBPERL) |
8e1b3f68 | 679 | endif |
3082cb33 | 680 | endif |
6e533cf1 | 681 | |
87419c9a DA |
682 | ifeq ($(feature-timerfd), 1) |
683 | CFLAGS += -DHAVE_TIMERFD_SUPPORT | |
684 | else | |
685 | msg := $(warning No timerfd support. Disables 'perf kvm stat live'); | |
686 | endif | |
687 | ||
6e533cf1 JO |
688 | disable-python = $(eval $(disable-python_code)) |
689 | define disable-python_code | |
9c12cf95 | 690 | CFLAGS += -DNO_LIBPYTHON |
6c5aa237 | 691 | $(warning $1) |
6e533cf1 JO |
692 | NO_LIBPYTHON := 1 |
693 | endef | |
694 | ||
56c7d79e | 695 | ifdef NO_LIBPYTHON |
6c5aa237 | 696 | $(call disable-python,Python support disabled by user) |
6e533cf1 JO |
697 | else |
698 | ||
56c7d79e | 699 | ifndef PYTHON |
6c5aa237 | 700 | $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev) |
6e533cf1 | 701 | else |
56c7d79e | 702 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) |
6e533cf1 JO |
703 | |
704 | ifndef PYTHON_CONFIG | |
6c5aa237 | 705 | $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) |
6e533cf1 JO |
706 | else |
707 | ||
9734163b | 708 | ifneq ($(feature-libpython), 1) |
6c5aa237 | 709 | $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) |
6e533cf1 | 710 | else |
66dfdff0 JÅ |
711 | LDFLAGS += $(PYTHON_EMBED_LDFLAGS) |
712 | EXTLIBS += $(PYTHON_EMBED_LIBADD) | |
713 | LANG_BINDINGS += $(obj-perf)python/perf.so | |
8e2c241f | 714 | CFLAGS += -DHAVE_LIBPYTHON_SUPPORT |
66dfdff0 | 715 | $(call detected,CONFIG_LIBPYTHON) |
6e533cf1 JO |
716 | endif |
717 | endif | |
718 | endif | |
719 | endif | |
c3cf8368 | 720 | |
3e6a147d | 721 | ifeq ($(feature-libbfd), 1) |
31be9478 | 722 | EXTLIBS += -lbfd -lopcodes |
14541b1e SF |
723 | else |
724 | # we are on a system that requires -liberty and (maybe) -lz | |
725 | # to link against -lbfd; test each case individually here | |
2cf90407 JO |
726 | |
727 | # call all detections now so we get correct | |
728 | # status in VF output | |
14541b1e SF |
729 | $(call feature_check,libbfd-liberty) |
730 | $(call feature_check,libbfd-liberty-z) | |
2cf90407 | 731 | |
14541b1e | 732 | ifeq ($(feature-libbfd-liberty), 1) |
31be9478 | 733 | EXTLIBS += -lbfd -lopcodes -liberty |
8a1b1718 | 734 | FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl |
2cf90407 | 735 | else |
14541b1e | 736 | ifeq ($(feature-libbfd-liberty-z), 1) |
31be9478 | 737 | EXTLIBS += -lbfd -lopcodes -liberty -lz |
8a1b1718 | 738 | FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl |
2cf90407 JO |
739 | endif |
740 | endif | |
8a1b1718 | 741 | $(call feature_check,disassembler-four-args) |
3e6a147d JO |
742 | endif |
743 | ||
c3cf8368 | 744 | ifdef NO_DEMANGLE |
8e1b3f68 | 745 | CFLAGS += -DNO_DEMANGLE |
c3cf8368 | 746 | else |
89fe808a | 747 | ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
8e1b3f68 | 748 | EXTLIBS += -liberty |
8e1b3f68 | 749 | else |
14541b1e SF |
750 | ifeq ($(filter -liberty,$(EXTLIBS)),) |
751 | $(call feature_check,cplus-demangle) | |
752 | ||
753 | # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT | |
754 | # or any of 'bfd iberty z' trinity | |
755 | ifeq ($(feature-cplus-demangle), 1) | |
756 | EXTLIBS += -liberty | |
757 | else | |
758 | msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) | |
759 | CFLAGS += -DNO_DEMANGLE | |
8e1b3f68 JO |
760 | endif |
761 | endif | |
762 | endif | |
14541b1e SF |
763 | |
764 | ifneq ($(filter -liberty,$(EXTLIBS)),) | |
765 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT | |
766 | endif | |
c3cf8368 | 767 | endif |
a1c7c9e7 | 768 | |
3e6a147d JO |
769 | ifneq ($(filter -lbfd,$(EXTLIBS)),) |
770 | CFLAGS += -DHAVE_LIBBFD_SUPPORT | |
771 | endif | |
772 | ||
e92ce12e NK |
773 | ifndef NO_ZLIB |
774 | ifeq ($(feature-zlib), 1) | |
775 | CFLAGS += -DHAVE_ZLIB_SUPPORT | |
776 | EXTLIBS += -lz | |
1571b695 | 777 | $(call detected,CONFIG_ZLIB) |
e92ce12e NK |
778 | else |
779 | NO_ZLIB := 1 | |
780 | endif | |
781 | endif | |
782 | ||
80a32e5b JO |
783 | ifndef NO_LZMA |
784 | ifeq ($(feature-lzma), 1) | |
785 | CFLAGS += -DHAVE_LZMA_SUPPORT | |
786 | EXTLIBS += -llzma | |
787 | $(call detected,CONFIG_LZMA) | |
788 | else | |
789 | msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev); | |
790 | NO_LZMA := 1 | |
791 | endif | |
792 | endif | |
793 | ||
a1c7c9e7 | 794 | ifndef NO_BACKTRACE |
4cc9117a | 795 | ifeq ($(feature-backtrace), 1) |
89fe808a | 796 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT |
8e1b3f68 | 797 | endif |
a1c7c9e7 | 798 | endif |
58a0abd7 JO |
799 | |
800 | ifndef NO_LIBNUMA | |
3ae069cf | 801 | ifeq ($(feature-libnuma), 0) |
6305edfc | 802 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev); |
8e1b3f68 JO |
803 | NO_LIBNUMA := 1 |
804 | else | |
f8ac8606 ACM |
805 | ifeq ($(feature-numa_num_possible_cpus), 0) |
806 | msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8); | |
807 | NO_LIBNUMA := 1 | |
808 | else | |
809 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT | |
810 | EXTLIBS += -lnuma | |
811 | $(call detected,CONFIG_NUMA) | |
812 | endif | |
8e1b3f68 | 813 | endif |
58a0abd7 | 814 | endif |
cd1c39f2 | 815 | |
da50ad69 AY |
816 | ifdef HAVE_KVM_STAT_SUPPORT |
817 | CFLAGS += -DHAVE_KVM_STAT_SUPPORT | |
818 | endif | |
819 | ||
8a1b1718 SL |
820 | ifeq ($(feature-disassembler-four-args), 1) |
821 | CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE | |
822 | endif | |
823 | ||
e477f3f0 AH |
824 | ifeq (${IS_64_BIT}, 1) |
825 | ifndef NO_PERF_READ_VDSO32 | |
826 | $(call feature_check,compile-32) | |
46b1fa85 AH |
827 | ifeq ($(feature-compile-32), 1) |
828 | CFLAGS += -DHAVE_PERF_READ_VDSO32 | |
829 | else | |
e477f3f0 AH |
830 | NO_PERF_READ_VDSO32 := 1 |
831 | endif | |
832 | endif | |
7a759cd8 | 833 | ifneq ($(SRCARCH), x86) |
e477f3f0 AH |
834 | NO_PERF_READ_VDSOX32 := 1 |
835 | endif | |
836 | ifndef NO_PERF_READ_VDSOX32 | |
837 | $(call feature_check,compile-x32) | |
46b1fa85 AH |
838 | ifeq ($(feature-compile-x32), 1) |
839 | CFLAGS += -DHAVE_PERF_READ_VDSOX32 | |
840 | else | |
e477f3f0 AH |
841 | NO_PERF_READ_VDSOX32 := 1 |
842 | endif | |
843 | endif | |
844 | else | |
845 | NO_PERF_READ_VDSO32 := 1 | |
846 | NO_PERF_READ_VDSOX32 := 1 | |
847 | endif | |
848 | ||
24787afb | 849 | ifndef NO_LIBBABELTRACE |
97e7a515 JO |
850 | $(call feature_check,libbabeltrace) |
851 | ifeq ($(feature-libbabeltrace), 1) | |
53d0a573 JO |
852 | CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS) |
853 | LDFLAGS += $(LIBBABELTRACE_LDFLAGS) | |
854 | EXTLIBS += -lbabeltrace-ctf | |
edbe9817 | 855 | $(call detected,CONFIG_LIBBABELTRACE) |
97e7a515 JO |
856 | else |
857 | msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev); | |
53d0a573 JO |
858 | endif |
859 | endif | |
860 | ||
e31f0d01 | 861 | ifndef NO_AUXTRACE |
7a759cd8 | 862 | ifeq ($(SRCARCH),x86) |
08d5204a MP |
863 | ifeq ($(feature-get_cpuid), 0) |
864 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); | |
865 | NO_AUXTRACE := 1 | |
866 | endif | |
867 | endif | |
868 | ifndef NO_AUXTRACE | |
b0063dbf ACM |
869 | $(call detected,CONFIG_AUXTRACE) |
870 | CFLAGS += -DHAVE_AUXTRACE_SUPPORT | |
871 | endif | |
e31f0d01 AH |
872 | endif |
873 | ||
d4dfdf00 JO |
874 | ifndef NO_JVMTI |
875 | ifneq (,$(wildcard /usr/sbin/update-java-alternatives)) | |
876 | JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}') | |
877 | else | |
878 | ifneq (,$(wildcard /usr/sbin/alternatives)) | |
36b8d462 | 879 | JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g') |
d4dfdf00 JO |
880 | endif |
881 | endif | |
882 | ifndef JDIR | |
883 | $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory) | |
884 | NO_JVMTI := 1 | |
885 | endif | |
886 | endif | |
887 | ||
888 | ifndef NO_JVMTI | |
889 | FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux | |
890 | $(call feature_check,jvmti) | |
891 | ifeq ($(feature-jvmti), 1) | |
892 | $(call detected_var,JDIR) | |
dd1d0044 JO |
893 | ifndef NO_JVMTI_CMLR |
894 | FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti) | |
895 | $(call feature_check,jvmti-cmlr) | |
896 | ifeq ($(feature-jvmti-cmlr), 1) | |
897 | CFLAGS += -DHAVE_JVMTI_CMLR | |
898 | endif | |
899 | endif # NO_JVMTI_CMLR | |
d4dfdf00 | 900 | else |
e14b733c | 901 | $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel) |
d4dfdf00 JO |
902 | NO_JVMTI := 1 |
903 | endif | |
904 | endif | |
905 | ||
d58ac0bf WN |
906 | USE_CXX = 0 |
907 | USE_CLANGLLVM = 0 | |
908 | ifdef LIBCLANGLLVM | |
909 | $(call feature_check,cxx) | |
910 | ifneq ($(feature-cxx), 1) | |
911 | msg := $(warning No g++ found, disable clang and llvm support. Please install g++) | |
912 | else | |
913 | $(call feature_check,llvm) | |
a940cad3 | 914 | $(call feature_check,llvm-version) |
d58ac0bf | 915 | ifneq ($(feature-llvm), 1) |
a940cad3 | 916 | msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0)) |
d58ac0bf WN |
917 | else |
918 | $(call feature_check,clang) | |
919 | ifneq ($(feature-clang), 1) | |
a940cad3 | 920 | msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0)) |
d58ac0bf WN |
921 | else |
922 | CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT | |
923 | CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir) | |
924 | $(call detected,CONFIG_CXX) | |
925 | $(call detected,CONFIG_CLANGLLVM) | |
926 | USE_CXX = 1 | |
927 | USE_LLVM = 1 | |
928 | USE_CLANG = 1 | |
a940cad3 WN |
929 | ifneq ($(feature-llvm-version),1) |
930 | msg := $(warning This version of LLVM is not tested. May cause build errors) | |
931 | endif | |
d58ac0bf WN |
932 | endif |
933 | endif | |
934 | endif | |
935 | endif | |
936 | ||
cd1c39f2 JO |
937 | # Among the variables below, these: |
938 | # perfexecdir | |
1b16fffa | 939 | # perf_include_dir |
8f12a2ff | 940 | # perf_examples_dir |
cd1c39f2 JO |
941 | # template_dir |
942 | # mandir | |
943 | # infodir | |
944 | # htmldir | |
945 | # ETC_PERFCONFIG (but not sysconfdir) | |
946 | # can be specified as a relative path some/where/else; | |
947 | # this is interpreted as relative to $(prefix) and "perf" at | |
948 | # runtime figures out where they are based on the path to the executable. | |
949 | # This can help installing the suite in a relocatable way. | |
950 | ||
951 | # Make the path relative to DESTDIR, not to prefix | |
952 | ifndef DESTDIR | |
fc9cabea | 953 | prefix ?= $(HOME) |
cd1c39f2 JO |
954 | endif |
955 | bindir_relative = bin | |
0927beec | 956 | bindir = $(abspath $(prefix)/$(bindir_relative)) |
cd1c39f2 JO |
957 | mandir = share/man |
958 | infodir = share/info | |
959 | perfexecdir = libexec/perf-core | |
83868bf7 TR |
960 | perf_include_dir = lib/perf/include |
961 | perf_examples_dir = lib/perf/examples | |
cd1c39f2 JO |
962 | sharedir = $(prefix)/share |
963 | template_dir = share/perf-core/templates | |
005438a8 | 964 | STRACE_GROUPS_DIR = share/perf-core/strace/groups |
cd1c39f2 | 965 | htmldir = share/doc/perf-doc |
14cbfbeb | 966 | tipdir = share/doc/perf-tip |
84cfac7f | 967 | srcdir = $(srctree)/tools/perf |
cd1c39f2 JO |
968 | ifeq ($(prefix),/usr) |
969 | sysconfdir = /etc | |
970 | ETC_PERFCONFIG = $(sysconfdir)/perfconfig | |
971 | else | |
972 | sysconfdir = $(prefix)/etc | |
973 | ETC_PERFCONFIG = etc/perfconfig | |
974 | endif | |
6997af72 | 975 | ifndef lib |
7a759cd8 | 976 | ifeq ($(SRCARCH)$(IS_64_BIT), x861) |
fc67297b NK |
977 | lib = lib64 |
978 | else | |
cd1c39f2 | 979 | lib = lib |
fc67297b | 980 | endif |
6997af72 | 981 | endif # lib |
fc67297b | 982 | libdir = $(prefix)/$(lib) |
cd1c39f2 JO |
983 | |
984 | # Shell quote (do not use $(call) to accommodate ancient setups); | |
985 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) | |
005438a8 | 986 | STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR)) |
cd1c39f2 JO |
987 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
988 | bindir_SQ = $(subst ','\'',$(bindir)) | |
989 | mandir_SQ = $(subst ','\'',$(mandir)) | |
990 | infodir_SQ = $(subst ','\'',$(infodir)) | |
991 | perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) | |
1b16fffa | 992 | perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir)) |
8f12a2ff | 993 | perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir)) |
cd1c39f2 JO |
994 | template_dir_SQ = $(subst ','\'',$(template_dir)) |
995 | htmldir_SQ = $(subst ','\'',$(htmldir)) | |
14cbfbeb | 996 | tipdir_SQ = $(subst ','\'',$(tipdir)) |
cd1c39f2 JO |
997 | prefix_SQ = $(subst ','\'',$(prefix)) |
998 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) | |
fc67297b | 999 | libdir_SQ = $(subst ','\'',$(libdir)) |
84cfac7f | 1000 | srcdir_SQ = $(subst ','\'',$(srcdir)) |
cd1c39f2 JO |
1001 | |
1002 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) | |
1003 | perfexec_instdir = $(perfexecdir) | |
1b16fffa | 1004 | perf_include_instdir = $(perf_include_dir) |
8f12a2ff | 1005 | perf_examples_instdir = $(perf_examples_dir) |
005438a8 | 1006 | STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR) |
14cbfbeb | 1007 | tip_instdir = $(tipdir) |
cd1c39f2 JO |
1008 | else |
1009 | perfexec_instdir = $(prefix)/$(perfexecdir) | |
1b16fffa | 1010 | perf_include_instdir = $(prefix)/$(perf_include_dir) |
8f12a2ff | 1011 | perf_examples_instdir = $(prefix)/$(perf_examples_dir) |
005438a8 | 1012 | STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR) |
14cbfbeb | 1013 | tip_instdir = $(prefix)/$(tipdir) |
cd1c39f2 JO |
1014 | endif |
1015 | perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) | |
1b16fffa | 1016 | perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir)) |
8f12a2ff | 1017 | perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir)) |
005438a8 | 1018 | STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR)) |
14cbfbeb | 1019 | tip_instdir_SQ = $(subst ','\'',$(tip_instdir)) |
3d7c0144 JO |
1020 | |
1021 | # If we install to $(HOME) we keep the traceevent default: | |
1022 | # $(HOME)/.traceevent/plugins | |
1023 | # Otherwise we install plugins into the global $(libdir). | |
1024 | ifdef DESTDIR | |
1025 | plugindir=$(libdir)/traceevent/plugins | |
b935a58d | 1026 | plugindir_SQ= $(subst ','\'',$(plugindir)) |
3d7c0144 | 1027 | endif |
0695e57b | 1028 | |
4b20d684 JO |
1029 | print_var = $(eval $(print_var_code)) $(info $(MSG)) |
1030 | define print_var_code | |
8d79076a JO |
1031 | MSG = $(shell printf '...%30s: %s' $(1) $($(1))) |
1032 | endef | |
1033 | ||
0695e57b | 1034 | ifeq ($(VF),1) |
99402e06 JO |
1035 | # Display EXTRA features which are detected manualy |
1036 | # from here with feature_check call and thus cannot | |
1037 | # be partof global state output. | |
1038 | $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),)) | |
4b20d684 JO |
1039 | $(call print_var,prefix) |
1040 | $(call print_var,bindir) | |
1041 | $(call print_var,libdir) | |
1042 | $(call print_var,sysconfdir) | |
1043 | $(call print_var,LIBUNWIND_DIR) | |
1044 | $(call print_var,LIBDW_DIR) | |
d4dfdf00 | 1045 | $(call print_var,JDIR) |
76ee2ff3 JO |
1046 | |
1047 | ifeq ($(dwarf-post-unwind),1) | |
1048 | $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text)) | |
1049 | endif | |
0695e57b JO |
1050 | $(info ) |
1051 | endif | |
f39e042a JO |
1052 | |
1053 | $(call detected_var,bindir_SQ) | |
1054 | $(call detected_var,PYTHON_WORD) | |
1055 | ifneq ($(OUTPUT),) | |
1056 | $(call detected_var,OUTPUT) | |
1057 | endif | |
285ab8bf JO |
1058 | $(call detected_var,htmldir_SQ) |
1059 | $(call detected_var,infodir_SQ) | |
1060 | $(call detected_var,mandir_SQ) | |
9352aaba | 1061 | $(call detected_var,ETC_PERFCONFIG_SQ) |
005438a8 | 1062 | $(call detected_var,STRACE_GROUPS_DIR_SQ) |
9352aaba JO |
1063 | $(call detected_var,prefix_SQ) |
1064 | $(call detected_var,perfexecdir_SQ) | |
1b16fffa | 1065 | $(call detected_var,perf_include_dir_SQ) |
8f12a2ff | 1066 | $(call detected_var,perf_examples_dir_SQ) |
14cbfbeb | 1067 | $(call detected_var,tipdir_SQ) |
84cfac7f | 1068 | $(call detected_var,srcdir_SQ) |
3b939a63 | 1069 | $(call detected_var,LIBDIR) |
88aeea06 | 1070 | $(call detected_var,GTK_CFLAGS) |
c7355f84 JO |
1071 | $(call detected_var,PERL_EMBED_CCOPTS) |
1072 | $(call detected_var,PYTHON_EMBED_CCOPTS) |