blob: dee05c3f68da6c0065d89157d19baaa54a44fd87 [file] [log] [blame]
Alexandre Belloni8dfd59d2013-06-05 23:53:30 +00001################################################################################
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +00002#
3# perf
4#
Alexandre Belloni8dfd59d2013-06-05 23:53:30 +00005################################################################################
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +00006
7# Source taken from the Linux kernel tree
8PERF_SOURCE =
9PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
10
Mischa Jonkere2fa8eb2013-09-04 21:02:10 +020011PERF_DEPENDENCIES = linux host-flex host-bison
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000012
13PERF_MAKE_FLAGS = \
14 $(LINUX_MAKE_FLAGS) \
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000015 NO_LIBAUDIT=1 \
16 NO_NEWT=1 \
17 NO_GTK2=1 \
18 NO_LIBPERL=1 \
19 NO_LIBPYTHON=1 \
20 DESTDIR=$(TARGET_DIR) \
21 prefix=/usr \
Arnout Vandecappelleba0d8622013-10-24 01:28:01 +020022 WERROR=0 \
23 ASCIIDOC=
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000024
Mischa Jonkerfc093d62014-01-28 14:10:58 +010025# The call to backtrace() function fails for ARC, because for some
26# reason the unwinder from libgcc returns early. Thus the usage of
27# backtrace() should be disabled in perf explicitly: at build time
28# backtrace() appears to be available, but it fails at runtime: the
29# backtrace will contain only several functions from the top of stack,
30# instead of the complete backtrace.
31ifeq ($(BR2_arc),y)
Jerzy Grzegorekbd8c7332015-03-31 09:21:57 +020032PERF_MAKE_FLAGS += NO_BACKTRACE=1
Mischa Jonkerfc093d62014-01-28 14:10:58 +010033endif
34
Steven Noonan15f2cc52015-07-14 19:35:08 +020035ifeq ($(BR2_PACKAGE_SLANG),y)
36PERF_DEPENDENCIES += slang
37endif
38
Thomas Petazzoni69030ca2013-01-06 05:22:46 +000039ifeq ($(BR2_PACKAGE_ELFUTILS),y)
Jerzy Grzegorekbd8c7332015-03-31 09:21:57 +020040PERF_DEPENDENCIES += elfutils
Thomas Petazzoni69030ca2013-01-06 05:22:46 +000041else
Jerzy Grzegorekbd8c7332015-03-31 09:21:57 +020042PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
Thomas Petazzoni69030ca2013-01-06 05:22:46 +000043endif
44
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000045define PERF_BUILD_CMDS
Thomas Petazzoni1727e892013-01-06 05:22:47 +000046 $(Q)if test ! -f $(LINUX_DIR)/tools/perf/Makefile ; then \
47 echo "Your kernel version is too old and does not have the perf tool." ; \
48 echo "At least kernel 2.6.31 must be used." ; \
49 exit 1 ; \
50 fi
51 $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
Anton Kolesovc0755292014-07-21 18:02:12 +040052 if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
Peter Meerwald220490c2014-04-05 14:51:02 +020053 if ! test -r $(LINUX_DIR)/tools/perf/config/Makefile ; then \
54 echo "The perf tool in your kernel cannot be built without libelf." ; \
55 echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
56 exit 1 ; \
57 fi \
Thomas Petazzoni1727e892013-01-06 05:22:47 +000058 fi \
59 fi
Steven Noonan08e78652015-03-19 00:19:25 -070060 $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000061 $(PERF_MAKE_FLAGS) O=$(@D)
62endef
63
64# After installation, we remove the Perl and Python scripts from the
65# target.
66define PERF_INSTALL_TARGET_CMDS
Steven Noonan08e78652015-03-19 00:19:25 -070067 $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000068 $(PERF_MAKE_FLAGS) O=$(@D) install
69 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
70endef
71
72$(eval $(generic-package))