aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-08-06 00:41:21 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-09 15:26:38 -0400
commit393be2e3747ea3ef0d2e724115a5f42b2fa50dbd (patch)
tree6cdc2568e3a6a485f8bbf3d0f94f83873daad3a7 /tools/perf/Makefile
parente5a1845fc0aeca85c98115980c3531129f87e18d (diff)
perf symbols: Support minimal build without libelf
Now we have isolated all ELF-specific stuff, it's possible to build without libelf. The output binary can do most of jobs but lacks (user level) symbol information - kernel symbols are still accessable thanks to the kallsyms. To build perf without libelf (elfutils), give NO_LIBELF=1 to make. For now, only 'perf probe' command is removed since it depends on libelf/libdw heavily. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1344228082-15569-4-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile57
1 files changed, 43 insertions, 14 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f790e3bf14cb..de6aa8c706cf 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -37,7 +37,12 @@ include config/utilities.mak
37# 37#
38# Define NO_NEWT if you do not want TUI support. 38# Define NO_NEWT if you do not want TUI support.
39# 39#
40# Define NO_GTK2 if you do not want GTK+ GUI support.
41#
40# Define NO_DEMANGLE if you do not want C++ symbol demangling. 42# Define NO_DEMANGLE if you do not want C++ symbol demangling.
43#
44# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
45#
41 46
42$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 47$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
43 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 48 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -450,34 +455,57 @@ PYRF_OBJS += $(OUTPUT)util/xyarray.o
450-include config.mak.autogen 455-include config.mak.autogen
451-include config.mak 456-include config.mak
452 457
453ifndef NO_DWARF 458ifdef NO_LIBELF
454FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
455ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
456 msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
457 NO_DWARF := 1 459 NO_DWARF := 1
458endif # Dwarf support 460 NO_DEMANGLE := 1
459endif # NO_DWARF 461else
460
461-include arch/$(ARCH)/Makefile
462
463ifneq ($(OUTPUT),)
464 BASIC_CFLAGS += -I$(OUTPUT)
465endif
466
467FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 462FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
468ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) 463ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
469 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) 464 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
470 ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y) 465 ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
471 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 466 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
472 else 467 else
473 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); 468 NO_LIBELF := 1
469 NO_DWARF := 1
470 NO_DEMANGLE := 1
474 endif 471 endif
475endif 472endif
473endif # NO_LIBELF
474
475-include arch/$(ARCH)/Makefile
476
477ifneq ($(OUTPUT),)
478 BASIC_CFLAGS += -I$(OUTPUT)
479endif
480
481ifdef NO_LIBELF
482BASIC_CFLAGS += -DNO_LIBELF_SUPPORT
483
484EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
485
486# Remove ELF/DWARF dependent codes
487LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
488LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
489LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
490LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
491
492BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
493
494# Use minimal symbol handling
495LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
496
497else # NO_LIBELF
476 498
477ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) 499ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y)
478 BASIC_CFLAGS += -DLIBELF_NO_MMAP 500 BASIC_CFLAGS += -DLIBELF_NO_MMAP
479endif 501endif
480 502
503FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
504ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
505 msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
506 NO_DWARF := 1
507endif # Dwarf support
508
481ifndef NO_DWARF 509ifndef NO_DWARF
482ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 510ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
483 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); 511 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
@@ -488,6 +516,7 @@ else
488 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o 516 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
489endif # PERF_HAVE_DWARF_REGS 517endif # PERF_HAVE_DWARF_REGS
490endif # NO_DWARF 518endif # NO_DWARF
519endif # NO_LIBELF
491 520
492ifdef NO_NEWT 521ifdef NO_NEWT
493 BASIC_CFLAGS += -DNO_NEWT_SUPPORT 522 BASIC_CFLAGS += -DNO_NEWT_SUPPORT