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