Alexandre Belloni | 8dfd59d | 2013-06-05 23:53:30 +0000 | [diff] [blame] | 1 | ################################################################################ |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 2 | # |
| 3 | # perf |
| 4 | # |
Alexandre Belloni | 8dfd59d | 2013-06-05 23:53:30 +0000 | [diff] [blame] | 5 | ################################################################################ |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 6 | |
| 7 | # Source taken from the Linux kernel tree |
| 8 | PERF_SOURCE = |
| 9 | PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION)) |
| 10 | |
Mischa Jonker | e2fa8eb | 2013-09-04 21:02:10 +0200 | [diff] [blame] | 11 | PERF_DEPENDENCIES = linux host-flex host-bison |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 12 | |
| 13 | PERF_MAKE_FLAGS = \ |
| 14 | $(LINUX_MAKE_FLAGS) \ |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 15 | 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 Vandecappelle | ba0d862 | 2013-10-24 01:28:01 +0200 | [diff] [blame] | 22 | WERROR=0 \ |
| 23 | ASCIIDOC= |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 24 | |
Mischa Jonker | fc093d6 | 2014-01-28 14:10:58 +0100 | [diff] [blame] | 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. |
| 31 | ifeq ($(BR2_arc),y) |
Jerzy Grzegorek | bd8c733 | 2015-03-31 09:21:57 +0200 | [diff] [blame] | 32 | PERF_MAKE_FLAGS += NO_BACKTRACE=1 |
Mischa Jonker | fc093d6 | 2014-01-28 14:10:58 +0100 | [diff] [blame] | 33 | endif |
| 34 | |
Steven Noonan | 15f2cc5 | 2015-07-14 19:35:08 +0200 | [diff] [blame^] | 35 | ifeq ($(BR2_PACKAGE_SLANG),y) |
| 36 | PERF_DEPENDENCIES += slang |
| 37 | endif |
| 38 | |
Thomas Petazzoni | 69030ca | 2013-01-06 05:22:46 +0000 | [diff] [blame] | 39 | ifeq ($(BR2_PACKAGE_ELFUTILS),y) |
Jerzy Grzegorek | bd8c733 | 2015-03-31 09:21:57 +0200 | [diff] [blame] | 40 | PERF_DEPENDENCIES += elfutils |
Thomas Petazzoni | 69030ca | 2013-01-06 05:22:46 +0000 | [diff] [blame] | 41 | else |
Jerzy Grzegorek | bd8c733 | 2015-03-31 09:21:57 +0200 | [diff] [blame] | 42 | PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1 |
Thomas Petazzoni | 69030ca | 2013-01-06 05:22:46 +0000 | [diff] [blame] | 43 | endif |
| 44 | |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 45 | define PERF_BUILD_CMDS |
Thomas Petazzoni | 1727e89 | 2013-01-06 05:22:47 +0000 | [diff] [blame] | 46 | $(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 Kolesov | c075529 | 2014-07-21 18:02:12 +0400 | [diff] [blame] | 52 | if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \ |
Peter Meerwald | 220490c | 2014-04-05 14:51:02 +0200 | [diff] [blame] | 53 | 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 Petazzoni | 1727e89 | 2013-01-06 05:22:47 +0000 | [diff] [blame] | 58 | fi \ |
| 59 | fi |
Steven Noonan | 08e7865 | 2015-03-19 00:19:25 -0700 | [diff] [blame] | 60 | $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \ |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 61 | $(PERF_MAKE_FLAGS) O=$(@D) |
| 62 | endef |
| 63 | |
| 64 | # After installation, we remove the Perl and Python scripts from the |
| 65 | # target. |
| 66 | define PERF_INSTALL_TARGET_CMDS |
Steven Noonan | 08e7865 | 2015-03-19 00:19:25 -0700 | [diff] [blame] | 67 | $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \ |
Thomas Petazzoni | d82f5cb | 2013-01-06 05:22:45 +0000 | [diff] [blame] | 68 | $(PERF_MAKE_FLAGS) O=$(@D) install |
| 69 | $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/ |
| 70 | endef |
| 71 | |
| 72 | $(eval $(generic-package)) |