package/perf: if libunwind is enabled, depend on it
[buildroot.git] / package / perf / perf.mk
1 ################################################################################
2 #
3 # perf
4 #
5 ################################################################################
6
7 # Source taken from the Linux kernel tree
8 PERF_SOURCE =
9 PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
10
11 PERF_DEPENDENCIES = linux host-flex host-bison
12
13 PERF_MAKE_FLAGS = \
14 $(LINUX_MAKE_FLAGS) \
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 \
22 WERROR=0 \
23 ASCIIDOC=
24
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
35 ifeq ($(BR2_PACKAGE_SLANG),y)
36 PERF_DEPENDENCIES += slang
37 endif
38
39 ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
40 PERF_DEPENDENCIES += libunwind
41 endif
42
43 ifeq ($(BR2_PACKAGE_NUMACTL),y)
44 PERF_DEPENDENCIES += numactl
45 endif
46
47 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
48 PERF_DEPENDENCIES += elfutils
49 else
50 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
51 endif
52
53 define PERF_BUILD_CMDS
54 $(Q)if test ! -f $(LINUX_DIR)/tools/perf/Makefile ; then \
55 echo "Your kernel version is too old and does not have the perf tool." ; \
56 echo "At least kernel 2.6.31 must be used." ; \
57 exit 1 ; \
58 fi
59 $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
60 if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
61 if ! test -r $(LINUX_DIR)/tools/perf/config/Makefile ; then \
62 echo "The perf tool in your kernel cannot be built without libelf." ; \
63 echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
64 exit 1 ; \
65 fi \
66 fi \
67 fi
68 $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
69 $(PERF_MAKE_FLAGS) O=$(@D)
70 endef
71
72 # After installation, we remove the Perl and Python scripts from the
73 # target.
74 define PERF_INSTALL_TARGET_CMDS
75 $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
76 $(PERF_MAKE_FLAGS) O=$(@D) install
77 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
78 endef
79
80 $(eval $(generic-package))