linux-tool-perf.mk 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ################################################################################
  2. #
  3. # perf
  4. #
  5. ################################################################################
  6. LINUX_TOOLS += perf
  7. PERF_DEPENDENCIES = host-flex host-bison
  8. ifeq ($(KERNEL_ARCH),x86_64)
  9. PERF_ARCH=x86
  10. else
  11. PERF_ARCH=$(KERNEL_ARCH)
  12. endif
  13. PERF_MAKE_FLAGS = \
  14. $(LINUX_MAKE_FLAGS) \
  15. ARCH=$(PERF_ARCH) \
  16. NO_LIBAUDIT=1 \
  17. NO_NEWT=1 \
  18. NO_GTK2=1 \
  19. NO_LIBPERL=1 \
  20. NO_LIBPYTHON=1 \
  21. DESTDIR=$(TARGET_DIR) \
  22. prefix=/usr \
  23. WERROR=0 \
  24. ASCIIDOC=
  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)
  32. PERF_MAKE_FLAGS += NO_BACKTRACE=1
  33. endif
  34. ifeq ($(BR2_PACKAGE_SLANG),y)
  35. PERF_DEPENDENCIES += slang
  36. endif
  37. ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
  38. PERF_DEPENDENCIES += libunwind
  39. endif
  40. ifeq ($(BR2_PACKAGE_NUMACTL),y)
  41. PERF_DEPENDENCIES += numactl
  42. endif
  43. ifeq ($(BR2_PACKAGE_ELFUTILS),y)
  44. PERF_DEPENDENCIES += elfutils
  45. else
  46. PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
  47. endif
  48. # O must be redefined here to overwrite the one used by Buildroot for
  49. # out of tree build. We build perf in $(@D)/tools/perf/ and not just
  50. # $(@D) so that it isn't built in the root directory of the kernel
  51. # sources.
  52. define PERF_BUILD_CMDS
  53. $(Q)if test ! -f $(@D)/tools/perf/Makefile ; then \
  54. echo "Your kernel version is too old and does not have the perf tool." ; \
  55. echo "At least kernel 2.6.31 must be used." ; \
  56. exit 1 ; \
  57. fi
  58. $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
  59. if ! grep -q NO_LIBELF $(@D)/tools/perf/Makefile* ; then \
  60. if ! test -r $(@D)/tools/perf/config/Makefile ; then \
  61. echo "The perf tool in your kernel cannot be built without libelf." ; \
  62. echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
  63. exit 1 ; \
  64. fi \
  65. fi \
  66. fi
  67. $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
  68. -C $(@D)/tools/perf O=$(@D)/tools/perf/
  69. endef
  70. # After installation, we remove the Perl and Python scripts from the
  71. # target.
  72. define PERF_INSTALL_TARGET_CMDS
  73. $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
  74. -C $(@D)/tools/perf O=$(@D)/tools/perf/ install
  75. $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
  76. endef