summaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile173
1 files changed, 139 insertions, 34 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 35655c3a7b7a..e5e71e7d95a0 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -37,7 +37,14 @@ 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#
46# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
47# backtrace post unwind.
41 48
42$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 49$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
43 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 50 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -50,16 +57,19 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
50 -e s/s390x/s390/ -e s/parisc64/parisc/ \ 57 -e s/s390x/s390/ -e s/parisc64/parisc/ \
51 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 58 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
52 -e s/sh[234].*/sh/ ) 59 -e s/sh[234].*/sh/ )
60NO_PERF_REGS := 1
53 61
54CC = $(CROSS_COMPILE)gcc 62CC = $(CROSS_COMPILE)gcc
55AR = $(CROSS_COMPILE)ar 63AR = $(CROSS_COMPILE)ar
56 64
57# Additional ARCH settings for x86 65# Additional ARCH settings for x86
58ifeq ($(ARCH),i386) 66ifeq ($(ARCH),i386)
59 ARCH := x86 67 override ARCH := x86
68 NO_PERF_REGS := 0
69 LIBUNWIND_LIBS = -lunwind -lunwind-x86
60endif 70endif
61ifeq ($(ARCH),x86_64) 71ifeq ($(ARCH),x86_64)
62 ARCH := x86 72 override ARCH := x86
63 IS_X86_64 := 0 73 IS_X86_64 := 0
64 ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) 74 ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
65 IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) 75 IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
@@ -69,6 +79,8 @@ ifeq ($(ARCH),x86_64)
69 ARCH_CFLAGS := -DARCH_X86_64 79 ARCH_CFLAGS := -DARCH_X86_64
70 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S 80 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
71 endif 81 endif
82 NO_PERF_REGS := 0
83 LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
72endif 84endif
73 85
74# Treat warnings as errors unless directed not to 86# Treat warnings as errors unless directed not to
@@ -89,7 +101,7 @@ ifdef PARSER_DEBUG
89 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG 101 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
90endif 102endif
91 103
92CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) 104CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
93EXTLIBS = -lpthread -lrt -lelf -lm 105EXTLIBS = -lpthread -lrt -lelf -lm
94ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 106ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
95ALL_LDFLAGS = $(LDFLAGS) 107ALL_LDFLAGS = $(LDFLAGS)
@@ -186,10 +198,10 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
186 198
187TRACE_EVENT_DIR = ../lib/traceevent/ 199TRACE_EVENT_DIR = ../lib/traceevent/
188 200
189ifeq ("$(origin O)", "command line") 201ifneq ($(OUTPUT),)
190 TE_PATH=$(OUTPUT)/ 202 TE_PATH=$(OUTPUT)
191else 203else
192 TE_PATH=$(TRACE_EVENT_DIR)/ 204 TE_PATH=$(TRACE_EVENT_DIR)
193endif 205endif
194 206
195LIBTRACEEVENT = $(TE_PATH)libtraceevent.a 207LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
@@ -221,13 +233,13 @@ export PERL_PATH
221FLEX = flex 233FLEX = flex
222BISON= bison 234BISON= bison
223 235
224$(OUTPUT)util/parse-events-flex.c: util/parse-events.l 236$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
225 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c 237 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
226 238
227$(OUTPUT)util/parse-events-bison.c: util/parse-events.y 239$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
228 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c 240 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c
229 241
230$(OUTPUT)util/pmu-flex.c: util/pmu.l 242$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
231 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c 243 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
232 244
233$(OUTPUT)util/pmu-bison.c: util/pmu.y 245$(OUTPUT)util/pmu-bison.c: util/pmu.y
@@ -252,6 +264,7 @@ LIB_H += util/include/linux/ctype.h
252LIB_H += util/include/linux/kernel.h 264LIB_H += util/include/linux/kernel.h
253LIB_H += util/include/linux/list.h 265LIB_H += util/include/linux/list.h
254LIB_H += util/include/linux/export.h 266LIB_H += util/include/linux/export.h
267LIB_H += util/include/linux/magic.h
255LIB_H += util/include/linux/poison.h 268LIB_H += util/include/linux/poison.h
256LIB_H += util/include/linux/prefetch.h 269LIB_H += util/include/linux/prefetch.h
257LIB_H += util/include/linux/rbtree.h 270LIB_H += util/include/linux/rbtree.h
@@ -321,6 +334,10 @@ LIB_H += $(TRACE_EVENT_DIR)event-parse.h
321LIB_H += util/target.h 334LIB_H += util/target.h
322LIB_H += util/rblist.h 335LIB_H += util/rblist.h
323LIB_H += util/intlist.h 336LIB_H += util/intlist.h
337LIB_H += util/perf_regs.h
338LIB_H += util/unwind.h
339LIB_H += ui/helpline.h
340LIB_H += util/vdso.h
324 341
325LIB_OBJS += $(OUTPUT)util/abspath.o 342LIB_OBJS += $(OUTPUT)util/abspath.o
326LIB_OBJS += $(OUTPUT)util/alias.o 343LIB_OBJS += $(OUTPUT)util/alias.o
@@ -356,6 +373,7 @@ LIB_OBJS += $(OUTPUT)util/usage.o
356LIB_OBJS += $(OUTPUT)util/wrapper.o 373LIB_OBJS += $(OUTPUT)util/wrapper.o
357LIB_OBJS += $(OUTPUT)util/sigchain.o 374LIB_OBJS += $(OUTPUT)util/sigchain.o
358LIB_OBJS += $(OUTPUT)util/symbol.o 375LIB_OBJS += $(OUTPUT)util/symbol.o
376LIB_OBJS += $(OUTPUT)util/symbol-elf.o
359LIB_OBJS += $(OUTPUT)util/dso-test-data.o 377LIB_OBJS += $(OUTPUT)util/dso-test-data.o
360LIB_OBJS += $(OUTPUT)util/color.o 378LIB_OBJS += $(OUTPUT)util/color.o
361LIB_OBJS += $(OUTPUT)util/pager.o 379LIB_OBJS += $(OUTPUT)util/pager.o
@@ -387,11 +405,15 @@ LIB_OBJS += $(OUTPUT)util/cgroup.o
387LIB_OBJS += $(OUTPUT)util/target.o 405LIB_OBJS += $(OUTPUT)util/target.o
388LIB_OBJS += $(OUTPUT)util/rblist.o 406LIB_OBJS += $(OUTPUT)util/rblist.o
389LIB_OBJS += $(OUTPUT)util/intlist.o 407LIB_OBJS += $(OUTPUT)util/intlist.o
408LIB_OBJS += $(OUTPUT)util/vdso.o
409LIB_OBJS += $(OUTPUT)util/stat.o
390 410
391BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o 411LIB_OBJS += $(OUTPUT)ui/helpline.o
412LIB_OBJS += $(OUTPUT)ui/hist.o
413LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
392 414
415BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
393BUILTIN_OBJS += $(OUTPUT)builtin-bench.o 416BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
394
395# Benchmark modules 417# Benchmark modules
396BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o 418BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
397BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o 419BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
@@ -449,34 +471,73 @@ PYRF_OBJS += $(OUTPUT)util/xyarray.o
449-include config.mak.autogen 471-include config.mak.autogen
450-include config.mak 472-include config.mak
451 473
452ifndef NO_DWARF 474ifdef NO_LIBELF
453FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
454ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
455 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);
456 NO_DWARF := 1 475 NO_DWARF := 1
457endif # Dwarf support 476 NO_DEMANGLE := 1
458endif # NO_DWARF 477 NO_LIBUNWIND := 1
459 478else
460-include arch/$(ARCH)/Makefile
461
462ifneq ($(OUTPUT),)
463 BASIC_CFLAGS += -I$(OUTPUT)
464endif
465
466FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 479FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
467ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) 480ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
468 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) 481 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
469 ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y) 482 ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
470 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 483 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
471 else 484 else
472 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); 485 NO_LIBELF := 1
486 NO_DWARF := 1
487 NO_DEMANGLE := 1
473 endif 488 endif
474endif 489endif
490endif # NO_LIBELF
491
492ifndef NO_LIBUNWIND
493# for linking with debug library, run like:
494# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
495ifdef LIBUNWIND_DIR
496 LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include
497 LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
498endif
499
500FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
501ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y)
502 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
503 NO_LIBUNWIND := 1
504endif # Libunwind support
505endif # NO_LIBUNWIND
506
507-include arch/$(ARCH)/Makefile
508
509ifneq ($(OUTPUT),)
510 BASIC_CFLAGS += -I$(OUTPUT)
511endif
512
513ifdef NO_LIBELF
514BASIC_CFLAGS += -DNO_LIBELF_SUPPORT
515
516EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
517
518# Remove ELF/DWARF dependent codes
519LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
520LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
521LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
522LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
523
524BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
525
526# Use minimal symbol handling
527LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
528
529else # NO_LIBELF
475 530
476ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) 531ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y)
477 BASIC_CFLAGS += -DLIBELF_NO_MMAP 532 BASIC_CFLAGS += -DLIBELF_NO_MMAP
478endif 533endif
479 534
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
480ifndef NO_DWARF 541ifndef NO_DWARF
481ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 542ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
482 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); 543 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
@@ -487,6 +548,29 @@ else
487 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o 548 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
488endif # PERF_HAVE_DWARF_REGS 549endif # PERF_HAVE_DWARF_REGS
489endif # NO_DWARF 550endif # NO_DWARF
551endif # NO_LIBELF
552
553ifdef NO_LIBUNWIND
554 BASIC_CFLAGS += -DNO_LIBUNWIND_SUPPORT
555else
556 EXTLIBS += $(LIBUNWIND_LIBS)
557 BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
558 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
559 LIB_OBJS += $(OUTPUT)util/unwind.o
560endif
561
562ifdef NO_LIBAUDIT
563 BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT
564else
565 FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
566 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);
568 BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT
569 else
570 BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
571 EXTLIBS += -laudit
572 endif
573endif
490 574
491ifdef NO_NEWT 575ifdef NO_NEWT
492 BASIC_CFLAGS += -DNO_NEWT_SUPPORT 576 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
@@ -504,14 +588,13 @@ else
504 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o 588 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
505 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o 589 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
506 LIB_OBJS += $(OUTPUT)ui/browsers/map.o 590 LIB_OBJS += $(OUTPUT)ui/browsers/map.o
507 LIB_OBJS += $(OUTPUT)ui/helpline.o
508 LIB_OBJS += $(OUTPUT)ui/progress.o 591 LIB_OBJS += $(OUTPUT)ui/progress.o
509 LIB_OBJS += $(OUTPUT)ui/util.o 592 LIB_OBJS += $(OUTPUT)ui/util.o
510 LIB_OBJS += $(OUTPUT)ui/tui/setup.o 593 LIB_OBJS += $(OUTPUT)ui/tui/setup.o
511 LIB_OBJS += $(OUTPUT)ui/tui/util.o 594 LIB_OBJS += $(OUTPUT)ui/tui/util.o
595 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
512 LIB_H += ui/browser.h 596 LIB_H += ui/browser.h
513 LIB_H += ui/browsers/map.h 597 LIB_H += ui/browsers/map.h
514 LIB_H += ui/helpline.h
515 LIB_H += ui/keysyms.h 598 LIB_H += ui/keysyms.h
516 LIB_H += ui/libslang.h 599 LIB_H += ui/libslang.h
517 LIB_H += ui/progress.h 600 LIB_H += ui/progress.h
@@ -523,7 +606,7 @@ endif
523ifdef NO_GTK2 606ifdef NO_GTK2
524 BASIC_CFLAGS += -DNO_GTK2_SUPPORT 607 BASIC_CFLAGS += -DNO_GTK2_SUPPORT
525else 608else
526 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) 609 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
527 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) 610 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y)
528 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); 611 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
529 BASIC_CFLAGS += -DNO_GTK2_SUPPORT 612 BASIC_CFLAGS += -DNO_GTK2_SUPPORT
@@ -531,11 +614,12 @@ else
531 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) 614 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y)
532 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR 615 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
533 endif 616 endif
534 BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0) 617 BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
535 EXTLIBS += $(shell pkg-config --libs gtk+-2.0) 618 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
536 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o 619 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
537 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o 620 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
538 LIB_OBJS += $(OUTPUT)ui/gtk/util.o 621 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
622 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
539 # Make sure that it'd be included only once. 623 # Make sure that it'd be included only once.
540 ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) 624 ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),)
541 LIB_OBJS += $(OUTPUT)ui/setup.o 625 LIB_OBJS += $(OUTPUT)ui/setup.o
@@ -644,7 +728,7 @@ else
644 EXTLIBS += -liberty 728 EXTLIBS += -liberty
645 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE 729 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
646 else 730 else
647 FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd 731 FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
648 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD)) 732 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD))
649 ifeq ($(has_bfd),y) 733 ifeq ($(has_bfd),y)
650 EXTLIBS += -lbfd 734 EXTLIBS += -lbfd
@@ -674,6 +758,13 @@ else
674 endif 758 endif
675endif 759endif
676 760
761ifeq ($(NO_PERF_REGS),0)
762 ifeq ($(ARCH),x86)
763 LIB_H += arch/x86/include/perf_regs.h
764 endif
765else
766 BASIC_CFLAGS += -DNO_PERF_REGS
767endif
677 768
678ifdef NO_STRLCPY 769ifdef NO_STRLCPY
679 BASIC_CFLAGS += -DNO_STRLCPY 770 BASIC_CFLAGS += -DNO_STRLCPY
@@ -683,6 +774,14 @@ else
683 endif 774 endif
684endif 775endif
685 776
777ifdef NO_BACKTRACE
778 BASIC_CFLAGS += -DNO_BACKTRACE
779else
780 ifneq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
781 BASIC_CFLAGS += -DNO_BACKTRACE
782 endif
783endif
784
686ifdef ASCIIDOC8 785ifdef ASCIIDOC8
687 export ASCIIDOC8 786 export ASCIIDOC8
688endif 787endif
@@ -700,6 +799,7 @@ perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
700template_dir_SQ = $(subst ','\'',$(template_dir)) 799template_dir_SQ = $(subst ','\'',$(template_dir))
701htmldir_SQ = $(subst ','\'',$(htmldir)) 800htmldir_SQ = $(subst ','\'',$(htmldir))
702prefix_SQ = $(subst ','\'',$(prefix)) 801prefix_SQ = $(subst ','\'',$(prefix))
802sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
703 803
704SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 804SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
705 805
@@ -767,10 +867,10 @@ $(OUTPUT)perf.o perf.spec \
767# over the general rule for .o 867# over the general rule for .o
768 868
769$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS 869$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
770 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -w $< 870 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -w $<
771 871
772$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS 872$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
773 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -w $< 873 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
774 874
775$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 875$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
776 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 876 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
@@ -842,7 +942,10 @@ $(LIB_FILE): $(LIB_OBJS)
842 942
843# libtraceevent.a 943# libtraceevent.a
844$(LIBTRACEEVENT): 944$(LIBTRACEEVENT):
845 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) $(COMMAND_O) libtraceevent.a 945 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a
946
947$(LIBTRACEEVENT)-clean:
948 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
846 949
847help: 950help:
848 @echo 'Perf make targets:' 951 @echo 'Perf make targets:'
@@ -951,6 +1054,8 @@ install: all
951 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' 1054 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
952 $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' 1055 $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
953 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' 1056 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
1057 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
1058 $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
954 1059
955install-python_ext: 1060install-python_ext:
956 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' 1061 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
@@ -981,7 +1086,7 @@ quick-install-html:
981 1086
982### Cleaning rules 1087### Cleaning rules
983 1088
984clean: 1089clean: $(LIBTRACEEVENT)-clean
985 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) 1090 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
986 $(RM) $(ALL_PROGRAMS) perf 1091 $(RM) $(ALL_PROGRAMS) perf
987 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* 1092 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*