diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 80 |
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 | ||
172 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 172 | ifeq ($(srctree),) |
173 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) | ||
174 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
175 | #$(info Determined 'srctree' to be $(srctree)) | ||
176 | endif | ||
177 | |||
178 | ifneq ($(objtree),) | ||
179 | #$(info Determined 'objtree' to be $(objtree)) | ||
180 | endif | ||
181 | |||
182 | ifneq ($(OUTPUT),) | ||
183 | #$(info Determined 'OUTPUT' to be $(OUTPUT)) | ||
184 | endif | ||
185 | |||
186 | BASIC_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 | |||
173 | BASIC_LDFLAGS = | 201 | BASIC_LDFLAGS = |
174 | 202 | ||
175 | ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) | 203 | ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) |
@@ -371,7 +399,6 @@ LIB_OBJS += $(OUTPUT)util/help.o | |||
371 | LIB_OBJS += $(OUTPUT)util/levenshtein.o | 399 | LIB_OBJS += $(OUTPUT)util/levenshtein.o |
372 | LIB_OBJS += $(OUTPUT)util/parse-options.o | 400 | LIB_OBJS += $(OUTPUT)util/parse-options.o |
373 | LIB_OBJS += $(OUTPUT)util/parse-events.o | 401 | LIB_OBJS += $(OUTPUT)util/parse-events.o |
374 | LIB_OBJS += $(OUTPUT)util/parse-events-test.o | ||
375 | LIB_OBJS += $(OUTPUT)util/path.o | 402 | LIB_OBJS += $(OUTPUT)util/path.o |
376 | LIB_OBJS += $(OUTPUT)util/rbtree.o | 403 | LIB_OBJS += $(OUTPUT)util/rbtree.o |
377 | LIB_OBJS += $(OUTPUT)util/bitmap.o | 404 | LIB_OBJS += $(OUTPUT)util/bitmap.o |
@@ -389,7 +416,6 @@ LIB_OBJS += $(OUTPUT)util/sigchain.o | |||
389 | LIB_OBJS += $(OUTPUT)util/dso.o | 416 | LIB_OBJS += $(OUTPUT)util/dso.o |
390 | LIB_OBJS += $(OUTPUT)util/symbol.o | 417 | LIB_OBJS += $(OUTPUT)util/symbol.o |
391 | LIB_OBJS += $(OUTPUT)util/symbol-elf.o | 418 | LIB_OBJS += $(OUTPUT)util/symbol-elf.o |
392 | LIB_OBJS += $(OUTPUT)util/dso-test-data.o | ||
393 | LIB_OBJS += $(OUTPUT)util/color.o | 419 | LIB_OBJS += $(OUTPUT)util/color.o |
394 | LIB_OBJS += $(OUTPUT)util/pager.o | 420 | LIB_OBJS += $(OUTPUT)util/pager.o |
395 | LIB_OBJS += $(OUTPUT)util/header.o | 421 | LIB_OBJS += $(OUTPUT)util/header.o |
@@ -424,12 +450,29 @@ LIB_OBJS += $(OUTPUT)util/intlist.o | |||
424 | LIB_OBJS += $(OUTPUT)util/vdso.o | 450 | LIB_OBJS += $(OUTPUT)util/vdso.o |
425 | LIB_OBJS += $(OUTPUT)util/stat.o | 451 | LIB_OBJS += $(OUTPUT)util/stat.o |
426 | 452 | ||
453 | LIB_OBJS += $(OUTPUT)ui/setup.o | ||
427 | LIB_OBJS += $(OUTPUT)ui/helpline.o | 454 | LIB_OBJS += $(OUTPUT)ui/helpline.o |
455 | LIB_OBJS += $(OUTPUT)ui/progress.o | ||
428 | LIB_OBJS += $(OUTPUT)ui/hist.o | 456 | LIB_OBJS += $(OUTPUT)ui/hist.o |
429 | LIB_OBJS += $(OUTPUT)ui/stdio/hist.o | 457 | LIB_OBJS += $(OUTPUT)ui/stdio/hist.o |
430 | 458 | ||
431 | LIB_OBJS += $(OUTPUT)arch/common.o | 459 | LIB_OBJS += $(OUTPUT)arch/common.o |
432 | 460 | ||
461 | LIB_OBJS += $(OUTPUT)tests/parse-events.o | ||
462 | LIB_OBJS += $(OUTPUT)tests/dso-data.o | ||
463 | LIB_OBJS += $(OUTPUT)tests/attr.o | ||
464 | LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o | ||
465 | LIB_OBJS += $(OUTPUT)tests/open-syscall.o | ||
466 | LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o | ||
467 | LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o | ||
468 | LIB_OBJS += $(OUTPUT)tests/mmap-basic.o | ||
469 | LIB_OBJS += $(OUTPUT)tests/perf-record.o | ||
470 | LIB_OBJS += $(OUTPUT)tests/rdpmc.o | ||
471 | LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o | ||
472 | LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o | ||
473 | LIB_OBJS += $(OUTPUT)tests/pmu.o | ||
474 | LIB_OBJS += $(OUTPUT)tests/util.o | ||
475 | |||
433 | BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o | 476 | BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o |
434 | BUILTIN_OBJS += $(OUTPUT)builtin-bench.o | 477 | BUILTIN_OBJS += $(OUTPUT)builtin-bench.o |
435 | # Benchmark modules | 478 | # Benchmark modules |
@@ -459,8 +502,8 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o | |||
459 | BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o | 502 | BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o |
460 | BUILTIN_OBJS += $(OUTPUT)builtin-lock.o | 503 | BUILTIN_OBJS += $(OUTPUT)builtin-lock.o |
461 | BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o | 504 | BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o |
462 | BUILTIN_OBJS += $(OUTPUT)builtin-test.o | ||
463 | BUILTIN_OBJS += $(OUTPUT)builtin-inject.o | 505 | BUILTIN_OBJS += $(OUTPUT)builtin-inject.o |
506 | BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o | ||
464 | 507 | ||
465 | PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) | 508 | PERFLIBS = $(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 |
499 | else | 544 | else |
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 | |||
552 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | 604 | ifeq ($(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); |
554 | else | 606 | else |
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 | ||
1063 | install-python_ext: | 1123 | install-python_ext: |
1064 | $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' | 1124 | $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' |