diff options
author | Jean Pihet <jean.pihet@linaro.org> | 2013-12-10 07:24:04 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-10 14:51:12 -0500 |
commit | 1448fef40af6079de38380c3a81bcf9994a1037d (patch) | |
tree | ddf0d28512b5c844e0e2608806730d6e0ae0d786 /tools/perf/config/Makefile | |
parent | ef517c6bee5d16404b06bee1d07f00ffb74fc21a (diff) |
perf unwinding: Use the per-feature check flags
Use the per-feature check flags for the unwinding feature in order to
correctly compile the test-all, libunwind and libunwind-debug-frame
feature checks.
Tested on x86_64, ARMv7 and ARMv8 with and without LIBUNWIND_DIR set in
'make -C tools/perf'
Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linaro-kernel@lists.linaro.org
Cc: patches@linaro.org
Link: http://lkml.kernel.org/r/1386678244-13535-3-git-send-email-jean.pihet@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/config/Makefile')
-rw-r--r-- | tools/perf/config/Makefile | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 2afb132db51a..5a1f4df3c3a8 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -36,6 +36,30 @@ ifeq ($(ARCH),arm) | |||
36 | LIBUNWIND_LIBS = -lunwind -lunwind-arm | 36 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
37 | endif | 37 | endif |
38 | 38 | ||
39 | ifeq ($(LIBUNWIND_LIBS),) | ||
40 | NO_LIBUNWIND := 1 | ||
41 | else | ||
42 | # | ||
43 | # For linking with debug library, run like: | ||
44 | # | ||
45 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | ||
46 | # | ||
47 | ifdef LIBUNWIND_DIR | ||
48 | LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include | ||
49 | LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib | ||
50 | endif | ||
51 | LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS) | ||
52 | |||
53 | # Set per-feature check compilation flags | ||
54 | FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS) | ||
55 | FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) | ||
56 | FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) | ||
57 | FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) | ||
58 | # and the flags for the test-all case | ||
59 | FEATURE_CHECK_CFLAGS-all += $(LIBUNWIND_CFLAGS) | ||
60 | FEATURE_CHECK_LDFLAGS-all += $(LIBUNWIND_LDFLAGS) | ||
61 | endif | ||
62 | |||
39 | ifeq ($(NO_PERF_REGS),0) | 63 | ifeq ($(NO_PERF_REGS),0) |
40 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT | 64 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT |
41 | endif | 65 | endif |
@@ -102,7 +126,7 @@ endif | |||
102 | 126 | ||
103 | feature_check = $(eval $(feature_check_code)) | 127 | feature_check = $(eval $(feature_check_code)) |
104 | define feature_check_code | 128 | define feature_check_code |
105 | feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) | 129 | feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) |
106 | endef | 130 | endef |
107 | 131 | ||
108 | feature_set = $(eval $(feature_set_code)) | 132 | feature_set = $(eval $(feature_set_code)) |
@@ -305,21 +329,7 @@ ifndef NO_LIBELF | |||
305 | endif # NO_DWARF | 329 | endif # NO_DWARF |
306 | endif # NO_LIBELF | 330 | endif # NO_LIBELF |
307 | 331 | ||
308 | ifeq ($(LIBUNWIND_LIBS),) | ||
309 | NO_LIBUNWIND := 1 | ||
310 | endif | ||
311 | |||
312 | ifndef NO_LIBUNWIND | 332 | ifndef NO_LIBUNWIND |
313 | # | ||
314 | # For linking with debug library, run like: | ||
315 | # | ||
316 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | ||
317 | # | ||
318 | ifdef LIBUNWIND_DIR | ||
319 | LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include | ||
320 | LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib | ||
321 | endif | ||
322 | |||
323 | ifneq ($(feature-libunwind), 1) | 333 | ifneq ($(feature-libunwind), 1) |
324 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1); | 334 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1); |
325 | NO_LIBUNWIND := 1 | 335 | NO_LIBUNWIND := 1 |
@@ -334,14 +344,12 @@ ifndef NO_LIBUNWIND | |||
334 | # non-ARM has no dwarf_find_debug_frame() function: | 344 | # non-ARM has no dwarf_find_debug_frame() function: |
335 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME | 345 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME |
336 | endif | 346 | endif |
337 | endif | ||
338 | endif | ||
339 | 347 | ||
340 | ifndef NO_LIBUNWIND | 348 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT |
341 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT | 349 | EXTLIBS += $(LIBUNWIND_LIBS) |
342 | EXTLIBS += $(LIBUNWIND_LIBS) | 350 | CFLAGS += $(LIBUNWIND_CFLAGS) |
343 | CFLAGS += $(LIBUNWIND_CFLAGS) | 351 | LDFLAGS += $(LIBUNWIND_LDFLAGS) |
344 | LDFLAGS += $(LIBUNWIND_LDFLAGS) | 352 | endif # ifneq ($(feature-libunwind), 1) |
345 | endif | 353 | endif |
346 | 354 | ||
347 | ifndef NO_LIBAUDIT | 355 | ifndef NO_LIBAUDIT |