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