aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-08-07 09:20:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-10 15:46:07 -0400
commit6a40cd90f5deb6dec322eeb54587ae55a934db2c (patch)
tree88e77297d85457427bb12c31d2e06d2eb8b237b1 /tools/perf/Makefile
parent2bcd355b71dafa5793a680c5db043abe9f708418 (diff)
perf tools: Add libunwind dependency for DWARF CFI unwinding
Adding libunwind to be linked with perf if available. It's required for the to get dwarf cfi unwinding support. Also building perf with the dwarf call frame informations by default, so that we can unwind callchains in perf itself. Adding LIBUNWIND_DIR Makefile variable allowing user to specify the directory with libunwind to be linked. This is used for debug purposes. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Original-patch-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: "Frank Ch. Eigler" <fche@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Benjamin Redelings <benjamin.redelings@nescent.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/r/1344345647-11536-10-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile29
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 27ae84bb5e4c..0aee6a916493 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -43,6 +43,8 @@ include config/utilities.mak
43# 43#
44# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) 44# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
45# 45#
46# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
47# backtrace post unwind.
46 48
47$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 49$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
48 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 50 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -64,6 +66,7 @@ AR = $(CROSS_COMPILE)ar
64ifeq ($(ARCH),i386) 66ifeq ($(ARCH),i386)
65 ARCH := x86 67 ARCH := x86
66 NO_PERF_REGS := 0 68 NO_PERF_REGS := 0
69 LIBUNWIND_LIBS = -lunwind -lunwind-x86
67endif 70endif
68ifeq ($(ARCH),x86_64) 71ifeq ($(ARCH),x86_64)
69 ARCH := x86 72 ARCH := x86
@@ -77,6 +80,7 @@ ifeq ($(ARCH),x86_64)
77 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S 80 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
78 endif 81 endif
79 NO_PERF_REGS := 0 82 NO_PERF_REGS := 0
83 LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
80endif 84endif
81 85
82# Treat warnings as errors unless directed not to 86# Treat warnings as errors unless directed not to
@@ -97,7 +101,7 @@ ifdef PARSER_DEBUG
97 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG 101 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
98endif 102endif
99 103
100CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) 104CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
101EXTLIBS = -lpthread -lrt -lelf -lm 105EXTLIBS = -lpthread -lrt -lelf -lm
102ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 106ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
103ALL_LDFLAGS = $(LDFLAGS) 107ALL_LDFLAGS = $(LDFLAGS)
@@ -476,6 +480,21 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
476endif 480endif
477endif # NO_LIBELF 481endif # NO_LIBELF
478 482
483ifndef NO_LIBUNWIND
484# for linking with debug library, run like:
485# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
486ifdef LIBUNWIND_DIR
487 LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include
488 LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
489endif
490
491FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
492ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y)
493 msg := $(warning No libunwind found. Please install libunwind >= 0.99);
494 NO_LIBUNWIND := 1
495endif # Libunwind support
496endif # NO_LIBUNWIND
497
479-include arch/$(ARCH)/Makefile 498-include arch/$(ARCH)/Makefile
480 499
481ifneq ($(OUTPUT),) 500ifneq ($(OUTPUT),)
@@ -522,6 +541,14 @@ endif # PERF_HAVE_DWARF_REGS
522endif # NO_DWARF 541endif # NO_DWARF
523endif # NO_LIBELF 542endif # NO_LIBELF
524 543
544ifdef NO_LIBUNWIND
545 BASIC_CFLAGS += -DNO_LIBUNWIND_SUPPORT
546else
547 EXTLIBS += $(LIBUNWIND_LIBS)
548 BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
549 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
550endif
551
525ifdef NO_NEWT 552ifdef NO_NEWT
526 BASIC_CFLAGS += -DNO_NEWT_SUPPORT 553 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
527else 554else