package/redis: Add redis system user
[buildroot-gz.git] / linux / linux-tool-perf.mk
blob0bd0ed1a13ebb9b36ad125751a32176fe42e8574
1 ################################################################################
3 # perf
5 ################################################################################
7 LINUX_TOOLS += perf
9 PERF_DEPENDENCIES = host-flex host-bison
11 ifeq ($(KERNEL_ARCH),x86_64)
12 PERF_ARCH=x86
13 else
14 PERF_ARCH=$(KERNEL_ARCH)
15 endif
17 PERF_MAKE_FLAGS = \
18 $(LINUX_MAKE_FLAGS) \
19 ARCH=$(PERF_ARCH) \
20 NO_LIBAUDIT=1 \
21 NO_NEWT=1 \
22 NO_GTK2=1 \
23 NO_LIBPERL=1 \
24 NO_LIBPYTHON=1 \
25 DESTDIR=$(TARGET_DIR) \
26 prefix=/usr \
27 WERROR=0 \
28 ASCIIDOC=
30 # The call to backtrace() function fails for ARC, because for some
31 # reason the unwinder from libgcc returns early. Thus the usage of
32 # backtrace() should be disabled in perf explicitly: at build time
33 # backtrace() appears to be available, but it fails at runtime: the
34 # backtrace will contain only several functions from the top of stack,
35 # instead of the complete backtrace.
36 ifeq ($(BR2_arc),y)
37 PERF_MAKE_FLAGS += NO_BACKTRACE=1
38 endif
40 ifeq ($(BR2_PACKAGE_SLANG),y)
41 PERF_DEPENDENCIES += slang
42 endif
44 ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
45 PERF_DEPENDENCIES += libunwind
46 endif
48 ifeq ($(BR2_PACKAGE_NUMACTL),y)
49 PERF_DEPENDENCIES += numactl
50 endif
52 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
53 PERF_DEPENDENCIES += elfutils
54 else
55 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
56 endif
58 # O must be redefined here to overwrite the one used by Buildroot for
59 # out of tree build. We build perf in $(@D)/tools/perf/ and not just
60 # $(@D) so that it isn't built in the root directory of the kernel
61 # sources.
62 define PERF_BUILD_CMDS
63 $(Q)if test ! -f $(@D)/tools/perf/Makefile ; then \
64 echo "Your kernel version is too old and does not have the perf tool." ; \
65 echo "At least kernel 2.6.31 must be used." ; \
66 exit 1 ; \
68 $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
69 if ! grep -q NO_LIBELF $(@D)/tools/perf/Makefile* ; then \
70 if ! test -r $(@D)/tools/perf/config/Makefile ; then \
71 echo "The perf tool in your kernel cannot be built without libelf." ; \
72 echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
73 exit 1 ; \
74 fi \
75 fi \
77 $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
78 -C $(@D)/tools/perf O=$(@D)/tools/perf/
79 endef
81 # After installation, we remove the Perl and Python scripts from the
82 # target.
83 define PERF_INSTALL_TARGET_CMDS
84 $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
85 -C $(@D)/tools/perf O=$(@D)/tools/perf/ install
86 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
87 endef