aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile174
1 files changed, 106 insertions, 68 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0a619af5be43..891bc77bdb2c 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -155,15 +155,15 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
155 155
156-include config/feature-tests.mak 156-include config/feature-tests.mak
157 157
158ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y) 158ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
159 CFLAGS := $(CFLAGS) -fstack-protector-all 159 CFLAGS := $(CFLAGS) -fstack-protector-all
160endif 160endif
161 161
162ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y) 162ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
163 CFLAGS := $(CFLAGS) -Wstack-protector 163 CFLAGS := $(CFLAGS) -Wstack-protector
164endif 164endif
165 165
166ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y) 166ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
167 CFLAGS := $(CFLAGS) -Wvolatile-register-var 167 CFLAGS := $(CFLAGS) -Wvolatile-register-var
168endif 168endif
169 169
@@ -197,8 +197,16 @@ BASIC_CFLAGS = \
197 -I. \ 197 -I. \
198 -I$(TRACE_EVENT_DIR) \ 198 -I$(TRACE_EVENT_DIR) \
199 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 199 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
200
200BASIC_LDFLAGS = 201BASIC_LDFLAGS =
201 202
203ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
204 BIONIC := 1
205 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
206 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
207 BASIC_CFLAGS += -I.
208endif
209
202# Guard against environment variables 210# Guard against environment variables
203BUILTIN_OBJS = 211BUILTIN_OBJS =
204LIB_H = 212LIB_H =
@@ -330,6 +338,7 @@ LIB_H += util/evlist.h
330LIB_H += util/exec_cmd.h 338LIB_H += util/exec_cmd.h
331LIB_H += util/types.h 339LIB_H += util/types.h
332LIB_H += util/levenshtein.h 340LIB_H += util/levenshtein.h
341LIB_H += util/machine.h
333LIB_H += util/map.h 342LIB_H += util/map.h
334LIB_H += util/parse-options.h 343LIB_H += util/parse-options.h
335LIB_H += util/parse-events.h 344LIB_H += util/parse-events.h
@@ -346,6 +355,7 @@ LIB_H += util/svghelper.h
346LIB_H += util/tool.h 355LIB_H += util/tool.h
347LIB_H += util/run-command.h 356LIB_H += util/run-command.h
348LIB_H += util/sigchain.h 357LIB_H += util/sigchain.h
358LIB_H += util/dso.h
349LIB_H += util/symbol.h 359LIB_H += util/symbol.h
350LIB_H += util/color.h 360LIB_H += util/color.h
351LIB_H += util/values.h 361LIB_H += util/values.h
@@ -389,7 +399,6 @@ LIB_OBJS += $(OUTPUT)util/help.o
389LIB_OBJS += $(OUTPUT)util/levenshtein.o 399LIB_OBJS += $(OUTPUT)util/levenshtein.o
390LIB_OBJS += $(OUTPUT)util/parse-options.o 400LIB_OBJS += $(OUTPUT)util/parse-options.o
391LIB_OBJS += $(OUTPUT)util/parse-events.o 401LIB_OBJS += $(OUTPUT)util/parse-events.o
392LIB_OBJS += $(OUTPUT)util/parse-events-test.o
393LIB_OBJS += $(OUTPUT)util/path.o 402LIB_OBJS += $(OUTPUT)util/path.o
394LIB_OBJS += $(OUTPUT)util/rbtree.o 403LIB_OBJS += $(OUTPUT)util/rbtree.o
395LIB_OBJS += $(OUTPUT)util/bitmap.o 404LIB_OBJS += $(OUTPUT)util/bitmap.o
@@ -404,15 +413,16 @@ LIB_OBJS += $(OUTPUT)util/top.o
404LIB_OBJS += $(OUTPUT)util/usage.o 413LIB_OBJS += $(OUTPUT)util/usage.o
405LIB_OBJS += $(OUTPUT)util/wrapper.o 414LIB_OBJS += $(OUTPUT)util/wrapper.o
406LIB_OBJS += $(OUTPUT)util/sigchain.o 415LIB_OBJS += $(OUTPUT)util/sigchain.o
416LIB_OBJS += $(OUTPUT)util/dso.o
407LIB_OBJS += $(OUTPUT)util/symbol.o 417LIB_OBJS += $(OUTPUT)util/symbol.o
408LIB_OBJS += $(OUTPUT)util/symbol-elf.o 418LIB_OBJS += $(OUTPUT)util/symbol-elf.o
409LIB_OBJS += $(OUTPUT)util/dso-test-data.o
410LIB_OBJS += $(OUTPUT)util/color.o 419LIB_OBJS += $(OUTPUT)util/color.o
411LIB_OBJS += $(OUTPUT)util/pager.o 420LIB_OBJS += $(OUTPUT)util/pager.o
412LIB_OBJS += $(OUTPUT)util/header.o 421LIB_OBJS += $(OUTPUT)util/header.o
413LIB_OBJS += $(OUTPUT)util/callchain.o 422LIB_OBJS += $(OUTPUT)util/callchain.o
414LIB_OBJS += $(OUTPUT)util/values.o 423LIB_OBJS += $(OUTPUT)util/values.o
415LIB_OBJS += $(OUTPUT)util/debug.o 424LIB_OBJS += $(OUTPUT)util/debug.o
425LIB_OBJS += $(OUTPUT)util/machine.o
416LIB_OBJS += $(OUTPUT)util/map.o 426LIB_OBJS += $(OUTPUT)util/map.o
417LIB_OBJS += $(OUTPUT)util/pstack.o 427LIB_OBJS += $(OUTPUT)util/pstack.o
418LIB_OBJS += $(OUTPUT)util/session.o 428LIB_OBJS += $(OUTPUT)util/session.o
@@ -440,10 +450,29 @@ LIB_OBJS += $(OUTPUT)util/intlist.o
440LIB_OBJS += $(OUTPUT)util/vdso.o 450LIB_OBJS += $(OUTPUT)util/vdso.o
441LIB_OBJS += $(OUTPUT)util/stat.o 451LIB_OBJS += $(OUTPUT)util/stat.o
442 452
453LIB_OBJS += $(OUTPUT)ui/setup.o
443LIB_OBJS += $(OUTPUT)ui/helpline.o 454LIB_OBJS += $(OUTPUT)ui/helpline.o
455LIB_OBJS += $(OUTPUT)ui/progress.o
444LIB_OBJS += $(OUTPUT)ui/hist.o 456LIB_OBJS += $(OUTPUT)ui/hist.o
445LIB_OBJS += $(OUTPUT)ui/stdio/hist.o 457LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
446 458
459LIB_OBJS += $(OUTPUT)arch/common.o
460
461LIB_OBJS += $(OUTPUT)tests/parse-events.o
462LIB_OBJS += $(OUTPUT)tests/dso-data.o
463LIB_OBJS += $(OUTPUT)tests/attr.o
464LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
465LIB_OBJS += $(OUTPUT)tests/open-syscall.o
466LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
467LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
468LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
469LIB_OBJS += $(OUTPUT)tests/perf-record.o
470LIB_OBJS += $(OUTPUT)tests/rdpmc.o
471LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
472LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
473LIB_OBJS += $(OUTPUT)tests/pmu.o
474LIB_OBJS += $(OUTPUT)tests/util.o
475
447BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o 476BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
448BUILTIN_OBJS += $(OUTPUT)builtin-bench.o 477BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
449# Benchmark modules 478# Benchmark modules
@@ -473,8 +502,8 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
473BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o 502BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
474BUILTIN_OBJS += $(OUTPUT)builtin-lock.o 503BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
475BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o 504BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
476BUILTIN_OBJS += $(OUTPUT)builtin-test.o
477BUILTIN_OBJS += $(OUTPUT)builtin-inject.o 505BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
506BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
478 507
479PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) 508PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
480 509
@@ -495,18 +524,33 @@ ifdef NO_LIBELF
495 NO_LIBUNWIND := 1 524 NO_LIBUNWIND := 1
496else 525else
497FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 526FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
498ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) 527ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
499 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) 528 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
500 ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y) 529 ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
501 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 530 LIBC_SUPPORT := 1
502 else 531 endif
532 ifeq ($(BIONIC),1)
533 LIBC_SUPPORT := 1
534 endif
535 ifeq ($(LIBC_SUPPORT),1)
536 msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
537
503 NO_LIBELF := 1 538 NO_LIBELF := 1
504 NO_DWARF := 1 539 NO_DWARF := 1
505 NO_DEMANGLE := 1 540 NO_DEMANGLE := 1
541 else
542 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
506 endif 543 endif
507else 544else
508 FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) 545 # for linking with debug library, run like:
509 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y) 546 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
547 ifdef LIBDW_DIR
548 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
549 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
550 endif
551
552 FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
553 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
510 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); 554 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);
511 NO_DWARF := 1 555 NO_DWARF := 1
512 endif # Dwarf support 556 endif # Dwarf support
@@ -522,7 +566,7 @@ ifdef LIBUNWIND_DIR
522endif 566endif
523 567
524FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) 568FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
525ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y) 569ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
526 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); 570 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
527 NO_LIBUNWIND := 1 571 NO_LIBUNWIND := 1
528endif # Libunwind support 572endif # Libunwind support
@@ -551,7 +595,8 @@ LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
551else # NO_LIBELF 595else # NO_LIBELF
552BASIC_CFLAGS += -DLIBELF_SUPPORT 596BASIC_CFLAGS += -DLIBELF_SUPPORT
553 597
554ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) 598FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
599ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
555 BASIC_CFLAGS += -DLIBELF_MMAP 600 BASIC_CFLAGS += -DLIBELF_MMAP
556endif 601endif
557 602
@@ -559,7 +604,8 @@ ifndef NO_DWARF
559ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 604ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
560 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); 605 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
561else 606else
562 BASIC_CFLAGS += -DDWARF_SUPPORT 607 BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
608 BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
563 EXTLIBS += -lelf -ldw 609 EXTLIBS += -lelf -ldw
564 LIB_OBJS += $(OUTPUT)util/probe-finder.o 610 LIB_OBJS += $(OUTPUT)util/probe-finder.o
565 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o 611 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
@@ -577,7 +623,7 @@ endif
577 623
578ifndef NO_LIBAUDIT 624ifndef NO_LIBAUDIT
579 FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit 625 FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
580 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT)),y) 626 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
581 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); 627 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
582 else 628 else
583 BASIC_CFLAGS += -DLIBAUDIT_SUPPORT 629 BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
@@ -588,23 +634,23 @@ endif
588 634
589ifndef NO_NEWT 635ifndef NO_NEWT
590 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt 636 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
591 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) 637 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y)
592 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); 638 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
593 else 639 else
594 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h 640 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
595 BASIC_CFLAGS += -I/usr/include/slang 641 BASIC_CFLAGS += -I/usr/include/slang
596 BASIC_CFLAGS += -DNEWT_SUPPORT 642 BASIC_CFLAGS += -DNEWT_SUPPORT
597 EXTLIBS += -lnewt -lslang 643 EXTLIBS += -lnewt -lslang
598 LIB_OBJS += $(OUTPUT)ui/setup.o
599 LIB_OBJS += $(OUTPUT)ui/browser.o 644 LIB_OBJS += $(OUTPUT)ui/browser.o
600 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o 645 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
601 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o 646 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
602 LIB_OBJS += $(OUTPUT)ui/browsers/map.o 647 LIB_OBJS += $(OUTPUT)ui/browsers/map.o
603 LIB_OBJS += $(OUTPUT)ui/progress.o 648 LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
604 LIB_OBJS += $(OUTPUT)ui/util.o 649 LIB_OBJS += $(OUTPUT)ui/util.o
605 LIB_OBJS += $(OUTPUT)ui/tui/setup.o 650 LIB_OBJS += $(OUTPUT)ui/tui/setup.o
606 LIB_OBJS += $(OUTPUT)ui/tui/util.o 651 LIB_OBJS += $(OUTPUT)ui/tui/util.o
607 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o 652 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
653 LIB_OBJS += $(OUTPUT)ui/tui/progress.o
608 LIB_H += ui/browser.h 654 LIB_H += ui/browser.h
609 LIB_H += ui/browsers/map.h 655 LIB_H += ui/browsers/map.h
610 LIB_H += ui/keysyms.h 656 LIB_H += ui/keysyms.h
@@ -617,10 +663,10 @@ endif
617 663
618ifndef NO_GTK2 664ifndef NO_GTK2
619 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) 665 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
620 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) 666 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
621 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); 667 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
622 else 668 else
623 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) 669 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
624 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR 670 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
625 endif 671 endif
626 BASIC_CFLAGS += -DGTK2_SUPPORT 672 BASIC_CFLAGS += -DGTK2_SUPPORT
@@ -630,9 +676,9 @@ ifndef NO_GTK2
630 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o 676 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
631 LIB_OBJS += $(OUTPUT)ui/gtk/util.o 677 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
632 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o 678 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
679 LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
633 # Make sure that it'd be included only once. 680 # Make sure that it'd be included only once.
634 ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),) 681 ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),)
635 LIB_OBJS += $(OUTPUT)ui/setup.o
636 LIB_OBJS += $(OUTPUT)ui/util.o 682 LIB_OBJS += $(OUTPUT)ui/util.o
637 endif 683 endif
638 endif 684 endif
@@ -647,7 +693,7 @@ else
647 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` 693 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
648 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) 694 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
649 695
650 ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y) 696 ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
651 BASIC_CFLAGS += -DNO_LIBPERL 697 BASIC_CFLAGS += -DNO_LIBPERL
652 else 698 else
653 ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) 699 ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
@@ -701,11 +747,11 @@ else
701 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) 747 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
702 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) 748 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
703 749
704 ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y) 750 ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
705 $(call disable-python,Python.h (for Python 2.x)) 751 $(call disable-python,Python.h (for Python 2.x))
706 else 752 else
707 753
708 ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED)),y) 754 ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
709 $(warning Python 3 is not yet supported; please set) 755 $(warning Python 3 is not yet supported; please set)
710 $(warning PYTHON and/or PYTHON_CONFIG appropriately.) 756 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
711 $(warning If you also have Python 2 installed, then) 757 $(warning If you also have Python 2 installed, then)
@@ -739,22 +785,22 @@ else
739 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE 785 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
740 else 786 else
741 FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd 787 FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
742 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD)) 788 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
743 ifeq ($(has_bfd),y) 789 ifeq ($(has_bfd),y)
744 EXTLIBS += -lbfd 790 EXTLIBS += -lbfd
745 else 791 else
746 FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty 792 FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
747 has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY)) 793 has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
748 ifeq ($(has_bfd_iberty),y) 794 ifeq ($(has_bfd_iberty),y)
749 EXTLIBS += -lbfd -liberty 795 EXTLIBS += -lbfd -liberty
750 else 796 else
751 FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz 797 FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
752 has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z)) 798 has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
753 ifeq ($(has_bfd_iberty_z),y) 799 ifeq ($(has_bfd_iberty_z),y)
754 EXTLIBS += -lbfd -liberty -lz 800 EXTLIBS += -lbfd -liberty -lz
755 else 801 else
756 FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty 802 FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
757 has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE)) 803 has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
758 ifeq ($(has_cplus_demangle),y) 804 ifeq ($(has_cplus_demangle),y)
759 EXTLIBS += -liberty 805 EXTLIBS += -liberty
760 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE 806 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
@@ -776,13 +822,19 @@ ifeq ($(NO_PERF_REGS),0)
776endif 822endif
777 823
778ifndef NO_STRLCPY 824ifndef NO_STRLCPY
779 ifeq ($(call try-cc,$(SOURCE_STRLCPY),),y) 825 ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
780 BASIC_CFLAGS += -DHAVE_STRLCPY 826 BASIC_CFLAGS += -DHAVE_STRLCPY
781 endif 827 endif
782endif 828endif
783 829
830ifndef NO_ON_EXIT
831 ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
832 BASIC_CFLAGS += -DHAVE_ON_EXIT
833 endif
834endif
835
784ifndef NO_BACKTRACE 836ifndef NO_BACKTRACE
785 ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y) 837 ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
786 BASIC_CFLAGS += -DBACKTRACE_SUPPORT 838 BASIC_CFLAGS += -DBACKTRACE_SUPPORT
787 endif 839 endif
788endif 840endif
@@ -891,10 +943,14 @@ $(OUTPUT)%.s: %.S
891$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS 943$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
892 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ 944 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
893 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ 945 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
894 '-DBINDIR="$(bindir_relative_SQ)"' \
895 '-DPREFIX="$(prefix_SQ)"' \ 946 '-DPREFIX="$(prefix_SQ)"' \
896 $< 947 $<
897 948
949$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
950 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
951 '-DBINDIR="$(bindir_SQ)"' \
952 $<
953
898$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS 954$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
899 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 955 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
900 956
@@ -910,6 +966,9 @@ $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
910$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS 966$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
911 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< 967 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
912 968
969$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
970 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
971
913$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS 972$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
914 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 973 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
915 974
@@ -981,20 +1040,15 @@ help:
981 @echo 'Perf maintainer targets:' 1040 @echo 'Perf maintainer targets:'
982 @echo ' clean - clean all binary objects and build output' 1041 @echo ' clean - clean all binary objects and build output'
983 1042
984doc:
985 $(MAKE) -C Documentation all
986
987man:
988 $(MAKE) -C Documentation man
989 1043
990html: 1044DOC_TARGETS := doc man html info pdf
991 $(MAKE) -C Documentation html
992 1045
993info: 1046INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
994 $(MAKE) -C Documentation info 1047INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
995 1048
996pdf: 1049# 'make doc' should call 'make -C Documentation all'
997 $(MAKE) -C Documentation pdf 1050$(DOC_TARGETS):
1051 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
998 1052
999TAGS: 1053TAGS:
1000 $(RM) TAGS 1054 $(RM) TAGS
@@ -1045,7 +1099,7 @@ perfexec_instdir = $(prefix)/$(perfexecdir)
1045endif 1099endif
1046perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) 1100perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
1047 1101
1048install: all 1102install: all try-install-man
1049 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' 1103 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1050 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' 1104 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
1051 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' 1105 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
@@ -1061,33 +1115,17 @@ install: all
1061 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' 1115 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
1062 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' 1116 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
1063 $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' 1117 $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
1118 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
1119 $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
1120 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
1121 $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
1064 1122
1065install-python_ext: 1123install-python_ext:
1066 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' 1124 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
1067 1125
1068install-doc: 1126# 'make install-doc' should call 'make -C Documentation install'
1069 $(MAKE) -C Documentation install 1127$(INSTALL_DOC_TARGETS):
1070 1128 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
1071install-man:
1072 $(MAKE) -C Documentation install-man
1073
1074install-html:
1075 $(MAKE) -C Documentation install-html
1076
1077install-info:
1078 $(MAKE) -C Documentation install-info
1079
1080install-pdf:
1081 $(MAKE) -C Documentation install-pdf
1082
1083quick-install-doc:
1084 $(MAKE) -C Documentation quick-install
1085
1086quick-install-man:
1087 $(MAKE) -C Documentation quick-install-man
1088
1089quick-install-html:
1090 $(MAKE) -C Documentation quick-install-html
1091 1129
1092### Cleaning rules 1130### Cleaning rules
1093 1131
@@ -1095,7 +1133,7 @@ clean: $(LIBTRACEEVENT)-clean
1095 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) 1133 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
1096 $(RM) $(ALL_PROGRAMS) perf 1134 $(RM) $(ALL_PROGRAMS) perf
1097 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* 1135 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
1098 $(MAKE) -C Documentation/ clean 1136 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
1099 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS 1137 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
1100 $(RM) $(OUTPUT)util/*-bison* 1138 $(RM) $(OUTPUT)util/*-bison*
1101 $(RM) $(OUTPUT)util/*-flex* 1139 $(RM) $(OUTPUT)util/*-flex*