diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 36 |
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') | |||
173 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | 173 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') |
174 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 174 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
175 | 175 | ||
176 | ARCH ?= $(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 | ||
183 | ifeq ($(ARCH),i386) | ||
184 | ARCH := x86 | ||
185 | endif | ||
186 | ifeq ($(ARCH),x86_64) | ||
187 | ARCH := x86 | ||
188 | endif | ||
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.) |
288 | BASIC_CFLAGS = -Iutil/include | 302 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include |
289 | BASIC_LDFLAGS = | 303 | BASIC_LDFLAGS = |
290 | 304 | ||
291 | # Guard against environment variables | 305 | # Guard against environment variables |
@@ -367,6 +381,7 @@ LIB_H += util/include/asm/byteorder.h | |||
367 | LIB_H += util/include/asm/swab.h | 381 | LIB_H += util/include/asm/swab.h |
368 | LIB_H += util/include/asm/system.h | 382 | LIB_H += util/include/asm/system.h |
369 | LIB_H += util/include/asm/uaccess.h | 383 | LIB_H += util/include/asm/uaccess.h |
384 | LIB_H += util/include/dwarf-regs.h | ||
370 | LIB_H += perf.h | 385 | LIB_H += perf.h |
371 | LIB_H += util/cache.h | 386 | LIB_H += util/cache.h |
372 | LIB_H += util/callchain.h | 387 | LIB_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 | ||
505 | ifndef NO_DWARF | ||
506 | ifneq ($(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 | ||
509 | endif # Dwarf support | ||
510 | endif # NO_DWARF | ||
511 | |||
512 | -include arch/$(ARCH)/Makefile | ||
513 | |||
490 | ifeq ($(uname_S),Darwin) | 514 | ifeq ($(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]); |
520 | endif | 544 | endif |
521 | 545 | ||
522 | ifneq ($(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); | ||
524 | else | ||
525 | ifndef NO_DWARF | 546 | ifndef NO_DWARF |
547 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | ||
548 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | ||
549 | else | ||
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 |
529 | endif | 553 | endif # PERF_HAVE_DWARF_REGS |
530 | endif | 554 | endif # NO_DWARF |
531 | 555 | ||
532 | ifneq ($(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) | 556 | ifneq ($(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); |