aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile36
1 files changed, 30 insertions, 6 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3cb3449a9645..e8bf2e1ab497 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -173,6 +173,20 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
173uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') 173uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
174uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 174uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
175 175
176ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
177 -e s/arm.*/arm/ -e s/sa110/arm/ \
178 -e s/s390x/s390/ -e s/parisc64/parisc/ \
179 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
180 -e s/sh[234].*/sh/ )
181
182# Additional ARCH settings for x86
183ifeq ($(ARCH),i386)
184 ARCH := x86
185endif
186ifeq ($(ARCH),x86_64)
187 ARCH := x86
188endif
189
176# CFLAGS and LDFLAGS are for the users to override from the command line. 190# CFLAGS and LDFLAGS are for the users to override from the command line.
177 191
178# 192#
@@ -285,7 +299,7 @@ endif
285# Those must not be GNU-specific; they are shared with perl/ which may 299# Those must not be GNU-specific; they are shared with perl/ which may
286# be built by a different compiler. (Note that this is an artifact now 300# be built by a different compiler. (Note that this is an artifact now
287# but it still might be nice to keep that distinction.) 301# but it still might be nice to keep that distinction.)
288BASIC_CFLAGS = -Iutil/include 302BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include
289BASIC_LDFLAGS = 303BASIC_LDFLAGS =
290 304
291# Guard against environment variables 305# Guard against environment variables
@@ -367,6 +381,7 @@ LIB_H += util/include/asm/byteorder.h
367LIB_H += util/include/asm/swab.h 381LIB_H += util/include/asm/swab.h
368LIB_H += util/include/asm/system.h 382LIB_H += util/include/asm/system.h
369LIB_H += util/include/asm/uaccess.h 383LIB_H += util/include/asm/uaccess.h
384LIB_H += util/include/dwarf-regs.h
370LIB_H += perf.h 385LIB_H += perf.h
371LIB_H += util/cache.h 386LIB_H += util/cache.h
372LIB_H += util/callchain.h 387LIB_H += util/callchain.h
@@ -487,6 +502,15 @@ PERFLIBS = $(LIB_FILE)
487-include config.mak.autogen 502-include config.mak.autogen
488-include config.mak 503-include config.mak
489 504
505ifndef NO_DWARF
506ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
507 msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/elfutils-dev);
508 NO_DWARF := 1
509endif # Dwarf support
510endif # NO_DWARF
511
512-include arch/$(ARCH)/Makefile
513
490ifeq ($(uname_S),Darwin) 514ifeq ($(uname_S),Darwin)
491 ifndef NO_FINK 515 ifndef NO_FINK
492 ifeq ($(shell test -d /sw/lib && echo y),y) 516 ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -519,15 +543,15 @@ else
519 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); 543 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
520endif 544endif
521 545
522ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
523 msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/elfutils-dev);
524else
525ifndef NO_DWARF 546ifndef NO_DWARF
547ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
548 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
549else
526 BASIC_CFLAGS += -I/usr/include/elfutils -DDWARF_SUPPORT 550 BASIC_CFLAGS += -I/usr/include/elfutils -DDWARF_SUPPORT
527 EXTLIBS += -lelf -ldw 551 EXTLIBS += -lelf -ldw
528 LIB_OBJS += $(OUTPUT)util/probe-finder.o 552 LIB_OBJS += $(OUTPUT)util/probe-finder.o
529endif 553endif # PERF_HAVE_DWARF_REGS
530endif 554endif # NO_DWARF
531 555
532ifneq ($(shell sh -c "(echo '\#include <newt.h>'; echo 'int main(void) { newtInit(); newtCls(); return newtFinished(); }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -lnewt -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 556ifneq ($(shell sh -c "(echo '\#include <newt.h>'; echo 'int main(void) { newtInit(); newtCls(); return newtFinished(); }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -lnewt -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
533 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); 557 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);