blob: 1fcc25863ffad6a685ba80f80c9cfc6bc2bb0ed8 [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)
32 PERF_MAKE_FLAGS += NO_BACKTRACE=1
33endif
34
Thomas Petazzoni69030ca2013-01-06 05:22:46 +000035ifeq ($(BR2_PACKAGE_ELFUTILS),y)
36 PERF_DEPENDENCIES += elfutils
37else
38 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
39endif
40
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000041define PERF_BUILD_CMDS
Thomas Petazzoni1727e892013-01-06 05:22:47 +000042 $(Q)if test ! -f $(LINUX_DIR)/tools/perf/Makefile ; then \
43 echo "Your kernel version is too old and does not have the perf tool." ; \
44 echo "At least kernel 2.6.31 must be used." ; \
45 exit 1 ; \
46 fi
47 $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
Anton Kolesovc0755292014-07-21 18:02:12 +040048 if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
Peter Meerwald220490c2014-04-05 14:51:02 +020049 if ! test -r $(LINUX_DIR)/tools/perf/config/Makefile ; then \
50 echo "The perf tool in your kernel cannot be built without libelf." ; \
51 echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
52 exit 1 ; \
53 fi \
Thomas Petazzoni1727e892013-01-06 05:22:47 +000054 fi \
55 fi
Mischa Jonkere2fa8eb2013-09-04 21:02:10 +020056 $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/perf \
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000057 $(PERF_MAKE_FLAGS) O=$(@D)
58endef
59
60# After installation, we remove the Perl and Python scripts from the
61# target.
62define PERF_INSTALL_TARGET_CMDS
Mischa Jonkere2fa8eb2013-09-04 21:02:10 +020063 $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/perf \
Thomas Petazzonid82f5cb2013-01-06 05:22:45 +000064 $(PERF_MAKE_FLAGS) O=$(@D) install
65 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
66endef
67
68$(eval $(generic-package))