1 ################################################################################
5 ################################################################################
7 # Source taken from the Linux kernel tree
9 PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
11 PERF_DEPENDENCIES = linux host-flex host-bison
20 DESTDIR=$(TARGET_DIR) \
25 # 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.
32 PERF_MAKE_FLAGS += NO_BACKTRACE=1
35 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
36 PERF_DEPENDENCIES += elfutils
38 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
41 define PERF_BUILD_CMDS
42 $(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." ; \
47 $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
48 if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
49 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." ; \
56 $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
57 $(PERF_MAKE_FLAGS) O=$(@D)
60 # After installation, we remove the Perl and Python scripts from the
62 define PERF_INSTALL_TARGET_CMDS
63 $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
64 $(PERF_MAKE_FLAGS) O=$(@D) install
65 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
68 $(eval $(generic-package))