diff options
Diffstat (limited to 'tools/perf/Makefile')
| -rw-r--r-- | tools/perf/Makefile | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 7822b3d6baca..60411e94113b 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -158,8 +158,10 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | |||
| 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
| 159 | 159 | ||
| 160 | # If we're on a 64-bit kernel, use -m64 | 160 | # If we're on a 64-bit kernel, use -m64 |
| 161 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | 161 | ifndef NO_64BIT |
| 162 | M64 := -m64 | 162 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) |
| 163 | M64 := -m64 | ||
| 164 | endif | ||
| 163 | endif | 165 | endif |
| 164 | 166 | ||
| 165 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 167 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
| @@ -345,7 +347,6 @@ BUILTIN_OBJS += builtin-stat.o | |||
| 345 | BUILTIN_OBJS += builtin-top.o | 347 | BUILTIN_OBJS += builtin-top.o |
| 346 | 348 | ||
| 347 | PERFLIBS = $(LIB_FILE) | 349 | PERFLIBS = $(LIB_FILE) |
| 348 | EXTLIBS = | ||
| 349 | 350 | ||
| 350 | # | 351 | # |
| 351 | # Platform specific tweaks | 352 | # Platform specific tweaks |
| @@ -374,6 +375,32 @@ ifeq ($(uname_S),Darwin) | |||
| 374 | PTHREAD_LIBS = | 375 | PTHREAD_LIBS = |
| 375 | endif | 376 | endif |
| 376 | 377 | ||
| 378 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) | ||
| 379 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | ||
| 380 | endif | ||
| 381 | |||
| 382 | ifdef NO_DEMANGLE | ||
| 383 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
| 384 | else | ||
| 385 | |||
| 386 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") | ||
| 387 | |||
| 388 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") | ||
| 389 | |||
| 390 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") | ||
| 391 | |||
| 392 | ifeq ($(has_bfd),y) | ||
| 393 | EXTLIBS += -lbfd | ||
| 394 | else ifeq ($(has_bfd_iberty),y) | ||
| 395 | EXTLIBS += -lbfd -liberty | ||
| 396 | else ifeq ($(has_bfd_iberty_z),y) | ||
| 397 | EXTLIBS += -lbfd -liberty -lz | ||
| 398 | else | ||
| 399 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | ||
| 400 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
| 401 | endif | ||
| 402 | endif | ||
| 403 | |||
| 377 | ifndef CC_LD_DYNPATH | 404 | ifndef CC_LD_DYNPATH |
| 378 | ifdef NO_R_TO_GCC_LINKER | 405 | ifdef NO_R_TO_GCC_LINKER |
| 379 | # Some gcc does not accept and pass -R to the linker to specify | 406 | # Some gcc does not accept and pass -R to the linker to specify |
