aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile80
1 files changed, 70 insertions, 10 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7e25f59e5e89..891bc77bdb2c 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,35 @@ endif
169 169
170### --- END CONFIGURATION SECTION --- 170### --- END CONFIGURATION SECTION ---
171 171
172BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 172ifeq ($(srctree),)
173srctree := $(patsubst %/,%,$(dir $(shell pwd)))
174srctree := $(patsubst %/,%,$(dir $(srctree)))
175#$(info Determined 'srctree' to be $(srctree))
176endif
177
178ifneq ($(objtree),)
179#$(info Determined 'objtree' to be $(objtree))
180endif
181
182ifneq ($(OUTPUT),)
183#$(info Determined 'OUTPUT' to be $(OUTPUT))
184endif
185
186BASIC_CFLAGS = \
187 -Iutil/include \
188 -Iarch/$(ARCH)/include \
189 $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
190 -I$(srctree)/arch/$(ARCH)/include/uapi \
191 -I$(srctree)/arch/$(ARCH)/include \
192 $(if $(objtree),-I$(objtree)/include/generated/uapi) \
193 -I$(srctree)/include/uapi \
194 -I$(srctree)/include \
195 -I$(OUTPUT)util \
196 -Iutil \
197 -I. \
198 -I$(TRACE_EVENT_DIR) \
199 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
200
173BASIC_LDFLAGS = 201BASIC_LDFLAGS =
174 202
175ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) 203ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
@@ -371,7 +399,6 @@ LIB_OBJS += $(OUTPUT)util/help.o
371LIB_OBJS += $(OUTPUT)util/levenshtein.o 399LIB_OBJS += $(OUTPUT)util/levenshtein.o
372LIB_OBJS += $(OUTPUT)util/parse-options.o 400LIB_OBJS += $(OUTPUT)util/parse-options.o
373LIB_OBJS += $(OUTPUT)util/parse-events.o 401LIB_OBJS += $(OUTPUT)util/parse-events.o
374LIB_OBJS += $(OUTPUT)util/parse-events-test.o
375LIB_OBJS += $(OUTPUT)util/path.o 402LIB_OBJS += $(OUTPUT)util/path.o
376LIB_OBJS += $(OUTPUT)util/rbtree.o 403LIB_OBJS += $(OUTPUT)util/rbtree.o
377LIB_OBJS += $(OUTPUT)util/bitmap.o 404LIB_OBJS += $(OUTPUT)util/bitmap.o
@@ -389,7 +416,6 @@ LIB_OBJS += $(OUTPUT)util/sigchain.o
389LIB_OBJS += $(OUTPUT)util/dso.o 416LIB_OBJS += $(OUTPUT)util/dso.o
390LIB_OBJS += $(OUTPUT)util/symbol.o 417LIB_OBJS += $(OUTPUT)util/symbol.o
391LIB_OBJS += $(OUTPUT)util/symbol-elf.o 418LIB_OBJS += $(OUTPUT)util/symbol-elf.o
392LIB_OBJS += $(OUTPUT)util/dso-test-data.o
393LIB_OBJS += $(OUTPUT)util/color.o 419LIB_OBJS += $(OUTPUT)util/color.o
394LIB_OBJS += $(OUTPUT)util/pager.o 420LIB_OBJS += $(OUTPUT)util/pager.o
395LIB_OBJS += $(OUTPUT)util/header.o 421LIB_OBJS += $(OUTPUT)util/header.o
@@ -424,12 +450,29 @@ LIB_OBJS += $(OUTPUT)util/intlist.o
424LIB_OBJS += $(OUTPUT)util/vdso.o 450LIB_OBJS += $(OUTPUT)util/vdso.o
425LIB_OBJS += $(OUTPUT)util/stat.o 451LIB_OBJS += $(OUTPUT)util/stat.o
426 452
453LIB_OBJS += $(OUTPUT)ui/setup.o
427LIB_OBJS += $(OUTPUT)ui/helpline.o 454LIB_OBJS += $(OUTPUT)ui/helpline.o
455LIB_OBJS += $(OUTPUT)ui/progress.o
428LIB_OBJS += $(OUTPUT)ui/hist.o 456LIB_OBJS += $(OUTPUT)ui/hist.o
429LIB_OBJS += $(OUTPUT)ui/stdio/hist.o 457LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
430 458
431LIB_OBJS += $(OUTPUT)arch/common.o 459LIB_OBJS += $(OUTPUT)arch/common.o
432 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
433BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o 476BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
434BUILTIN_OBJS += $(OUTPUT)builtin-bench.o 477BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
435# Benchmark modules 478# Benchmark modules
@@ -459,8 +502,8 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
459BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o 502BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
460BUILTIN_OBJS += $(OUTPUT)builtin-lock.o 503BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
461BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o 504BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
462BUILTIN_OBJS += $(OUTPUT)builtin-test.o
463BUILTIN_OBJS += $(OUTPUT)builtin-inject.o 505BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
506BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
464 507
465PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) 508PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
466 509
@@ -490,6 +533,8 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
490 LIBC_SUPPORT := 1 533 LIBC_SUPPORT := 1
491 endif 534 endif
492 ifeq ($(LIBC_SUPPORT),1) 535 ifeq ($(LIBC_SUPPORT),1)
536 msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
537
493 NO_LIBELF := 1 538 NO_LIBELF := 1
494 NO_DWARF := 1 539 NO_DWARF := 1
495 NO_DEMANGLE := 1 540 NO_DEMANGLE := 1
@@ -497,7 +542,14 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
497 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 542 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
498 endif 543 endif
499else 544else
500 FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) 545 # for linking with debug library, run like:
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)
501 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) 553 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
502 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);
503 NO_DWARF := 1 555 NO_DWARF := 1
@@ -552,7 +604,8 @@ ifndef NO_DWARF
552ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 604ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
553 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);
554else 606else
555 BASIC_CFLAGS += -DDWARF_SUPPORT 607 BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
608 BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
556 EXTLIBS += -lelf -ldw 609 EXTLIBS += -lelf -ldw
557 LIB_OBJS += $(OUTPUT)util/probe-finder.o 610 LIB_OBJS += $(OUTPUT)util/probe-finder.o
558 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o 611 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
@@ -588,17 +641,16 @@ ifndef NO_NEWT
588 BASIC_CFLAGS += -I/usr/include/slang 641 BASIC_CFLAGS += -I/usr/include/slang
589 BASIC_CFLAGS += -DNEWT_SUPPORT 642 BASIC_CFLAGS += -DNEWT_SUPPORT
590 EXTLIBS += -lnewt -lslang 643 EXTLIBS += -lnewt -lslang
591 LIB_OBJS += $(OUTPUT)ui/setup.o
592 LIB_OBJS += $(OUTPUT)ui/browser.o 644 LIB_OBJS += $(OUTPUT)ui/browser.o
593 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o 645 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
594 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o 646 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
595 LIB_OBJS += $(OUTPUT)ui/browsers/map.o 647 LIB_OBJS += $(OUTPUT)ui/browsers/map.o
596 LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o 648 LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
597 LIB_OBJS += $(OUTPUT)ui/progress.o
598 LIB_OBJS += $(OUTPUT)ui/util.o 649 LIB_OBJS += $(OUTPUT)ui/util.o
599 LIB_OBJS += $(OUTPUT)ui/tui/setup.o 650 LIB_OBJS += $(OUTPUT)ui/tui/setup.o
600 LIB_OBJS += $(OUTPUT)ui/tui/util.o 651 LIB_OBJS += $(OUTPUT)ui/tui/util.o
601 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o 652 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
653 LIB_OBJS += $(OUTPUT)ui/tui/progress.o
602 LIB_H += ui/browser.h 654 LIB_H += ui/browser.h
603 LIB_H += ui/browsers/map.h 655 LIB_H += ui/browsers/map.h
604 LIB_H += ui/keysyms.h 656 LIB_H += ui/keysyms.h
@@ -624,9 +676,9 @@ ifndef NO_GTK2
624 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o 676 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
625 LIB_OBJS += $(OUTPUT)ui/gtk/util.o 677 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
626 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o 678 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
679 LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
627 # Make sure that it'd be included only once. 680 # Make sure that it'd be included only once.
628 ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),) 681 ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),)
629 LIB_OBJS += $(OUTPUT)ui/setup.o
630 LIB_OBJS += $(OUTPUT)ui/util.o 682 LIB_OBJS += $(OUTPUT)ui/util.o
631 endif 683 endif
632 endif 684 endif
@@ -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
@@ -1059,6 +1115,10 @@ install: all try-install-man
1059 $(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'
1060 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' 1116 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
1061 $(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'
1062 1122
1063install-python_ext: 1123install-python_ext:
1064 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' 1124 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'