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