aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile83
1 files changed, 29 insertions, 54 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index e5e71e7d95a0..f9126f89efef 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -45,6 +45,8 @@ include config/utilities.mak
45# 45#
46# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf 46# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
47# backtrace post unwind. 47# backtrace post unwind.
48#
49# Define NO_BACKTRACE if you do not want stack backtrace debug feature
48 50
49$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 51$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
50 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 52 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -185,7 +187,7 @@ strip-libs = $(filter-out -l%,$(1))
185PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) 187PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
186PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py 188PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py
187 189
188$(OUTPUT)python/perf.so: $(PYRF_OBJS) $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) 190$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
189 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ 191 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
190 --quiet build_ext; \ 192 --quiet build_ext; \
191 mkdir -p $(OUTPUT)python && \ 193 mkdir -p $(OUTPUT)python && \
@@ -446,20 +448,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
446 448
447PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) 449PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
448 450
449# Files needed for the python binding, perf.so
450# pyrf is just an internal name needed for all those wrappers.
451# This has to be in sync with what is in the 'sources' variable in
452# tools/perf/util/setup.py
453
454PYRF_OBJS += $(OUTPUT)util/cpumap.o
455PYRF_OBJS += $(OUTPUT)util/ctype.o
456PYRF_OBJS += $(OUTPUT)util/evlist.o
457PYRF_OBJS += $(OUTPUT)util/evsel.o
458PYRF_OBJS += $(OUTPUT)util/python.o
459PYRF_OBJS += $(OUTPUT)util/thread_map.o
460PYRF_OBJS += $(OUTPUT)util/util.o
461PYRF_OBJS += $(OUTPUT)util/xyarray.o
462
463# 451#
464# Platform specific tweaks 452# Platform specific tweaks
465# 453#
@@ -486,7 +474,13 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
486 NO_DWARF := 1 474 NO_DWARF := 1
487 NO_DEMANGLE := 1 475 NO_DEMANGLE := 1
488 endif 476 endif
489endif 477else
478 FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
479 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
480 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);
481 NO_DWARF := 1
482 endif # Dwarf support
483endif # SOURCE_LIBELF
490endif # NO_LIBELF 484endif # NO_LIBELF
491 485
492ifndef NO_LIBUNWIND 486ifndef NO_LIBUNWIND
@@ -511,8 +505,6 @@ ifneq ($(OUTPUT),)
511endif 505endif
512 506
513ifdef NO_LIBELF 507ifdef NO_LIBELF
514BASIC_CFLAGS += -DNO_LIBELF_SUPPORT
515
516EXTLIBS := $(filter-out -lelf,$(EXTLIBS)) 508EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
517 509
518# Remove ELF/DWARF dependent codes 510# Remove ELF/DWARF dependent codes
@@ -527,17 +519,12 @@ BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
527LIB_OBJS += $(OUTPUT)util/symbol-minimal.o 519LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
528 520
529else # NO_LIBELF 521else # NO_LIBELF
522BASIC_CFLAGS += -DLIBELF_SUPPORT
530 523
531ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) 524ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y)
532 BASIC_CFLAGS += -DLIBELF_NO_MMAP 525 BASIC_CFLAGS += -DLIBELF_MMAP
533endif 526endif
534 527
535FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
536ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
537 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);
538 NO_DWARF := 1
539endif # Dwarf support
540
541ifndef NO_DWARF 528ifndef NO_DWARF
542ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 529ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
543 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); 530 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
@@ -550,38 +537,33 @@ endif # PERF_HAVE_DWARF_REGS
550endif # NO_DWARF 537endif # NO_DWARF
551endif # NO_LIBELF 538endif # NO_LIBELF
552 539
553ifdef NO_LIBUNWIND 540ifndef NO_LIBUNWIND
554 BASIC_CFLAGS += -DNO_LIBUNWIND_SUPPORT 541 BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
555else
556 EXTLIBS += $(LIBUNWIND_LIBS) 542 EXTLIBS += $(LIBUNWIND_LIBS)
557 BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) 543 BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
558 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) 544 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
559 LIB_OBJS += $(OUTPUT)util/unwind.o 545 LIB_OBJS += $(OUTPUT)util/unwind.o
560endif 546endif
561 547
562ifdef NO_LIBAUDIT 548ifndef NO_LIBAUDIT
563 BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT
564else
565 FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit 549 FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
566 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT)),y) 550 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT)),y)
567 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); 551 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
568 BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT
569 else 552 else
553 BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
570 BUILTIN_OBJS += $(OUTPUT)builtin-trace.o 554 BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
571 EXTLIBS += -laudit 555 EXTLIBS += -laudit
572 endif 556 endif
573endif 557endif
574 558
575ifdef NO_NEWT 559ifndef NO_NEWT
576 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
577else
578 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt 560 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
579 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) 561 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
580 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); 562 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
581 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
582 else 563 else
583 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h 564 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
584 BASIC_CFLAGS += -I/usr/include/slang 565 BASIC_CFLAGS += -I/usr/include/slang
566 BASIC_CFLAGS += -DNEWT_SUPPORT
585 EXTLIBS += -lnewt -lslang 567 EXTLIBS += -lnewt -lslang
586 LIB_OBJS += $(OUTPUT)ui/setup.o 568 LIB_OBJS += $(OUTPUT)ui/setup.o
587 LIB_OBJS += $(OUTPUT)ui/browser.o 569 LIB_OBJS += $(OUTPUT)ui/browser.o
@@ -603,17 +585,15 @@ else
603 endif 585 endif
604endif 586endif
605 587
606ifdef NO_GTK2 588ifndef NO_GTK2
607 BASIC_CFLAGS += -DNO_GTK2_SUPPORT
608else
609 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) 589 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
610 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) 590 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y)
611 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); 591 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
612 BASIC_CFLAGS += -DNO_GTK2_SUPPORT
613 else 592 else
614 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) 593 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y)
615 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR 594 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
616 endif 595 endif
596 BASIC_CFLAGS += -DGTK2_SUPPORT
617 BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) 597 BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
618 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) 598 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
619 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o 599 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
@@ -621,7 +601,7 @@ else
621 LIB_OBJS += $(OUTPUT)ui/gtk/util.o 601 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
622 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o 602 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
623 # Make sure that it'd be included only once. 603 # Make sure that it'd be included only once.
624 ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) 604 ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),)
625 LIB_OBJS += $(OUTPUT)ui/setup.o 605 LIB_OBJS += $(OUTPUT)ui/setup.o
626 LIB_OBJS += $(OUTPUT)ui/util.o 606 LIB_OBJS += $(OUTPUT)ui/util.o
627 endif 607 endif
@@ -762,23 +742,18 @@ ifeq ($(NO_PERF_REGS),0)
762 ifeq ($(ARCH),x86) 742 ifeq ($(ARCH),x86)
763 LIB_H += arch/x86/include/perf_regs.h 743 LIB_H += arch/x86/include/perf_regs.h
764 endif 744 endif
765else 745 BASIC_CFLAGS += -DHAVE_PERF_REGS
766 BASIC_CFLAGS += -DNO_PERF_REGS
767endif 746endif
768 747
769ifdef NO_STRLCPY 748ifndef NO_STRLCPY
770 BASIC_CFLAGS += -DNO_STRLCPY 749 ifeq ($(call try-cc,$(SOURCE_STRLCPY),),y)
771else 750 BASIC_CFLAGS += -DHAVE_STRLCPY
772 ifneq ($(call try-cc,$(SOURCE_STRLCPY),),y)
773 BASIC_CFLAGS += -DNO_STRLCPY
774 endif 751 endif
775endif 752endif
776 753
777ifdef NO_BACKTRACE 754ifndef NO_BACKTRACE
778 BASIC_CFLAGS += -DNO_BACKTRACE 755 ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
779else 756 BASIC_CFLAGS += -DBACKTRACE_SUPPORT
780 ifneq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
781 BASIC_CFLAGS += -DNO_BACKTRACE
782 endif 757 endif
783endif 758endif
784 759