package/qt5webkit: needs host-python
[buildroot-gz.git] / linux / linux-tool-perf.mk
blob8143474b0a590ae3ca8839b57df99a15952ca1da
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 JOBS=$(PARALLEL_JOBS) \
20 ARCH=$(PERF_ARCH) \
21 DESTDIR=$(TARGET_DIR) \
22 prefix=/usr \
23 WERROR=0 \
24 NO_LIBAUDIT=1 \
25 NO_NEWT=1 \
26 NO_GTK2=1 \
27 NO_LIBPERL=1 \
28 NO_LIBPYTHON=1 \
29 NO_LIBBIONIC=1
31 # We need to pass an argument to ld for setting the endianness when
32 # building it for MIPS architecture, otherwise the default one will
33 # always be used (which is big endian) and the compilation for little
34 # endian will always fail showing an error like this one:
35 # LD foo.o
36 # mips-linux-gnu-ld: foo.o: compiled for a little endian system and
37 # target is big endian
38 ifeq ($(BR2_mips)$(BR2_mips64),y)
39 PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EB"
40 else ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
41 PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EL"
42 endif
44 # The call to backtrace() function fails for ARC, because for some
45 # reason the unwinder from libgcc returns early. Thus the usage of
46 # backtrace() should be disabled in perf explicitly: at build time
47 # backtrace() appears to be available, but it fails at runtime: the
48 # backtrace will contain only several functions from the top of stack,
49 # instead of the complete backtrace.
50 ifeq ($(BR2_arc),y)
51 PERF_MAKE_FLAGS += NO_BACKTRACE=1
52 endif
54 ifeq ($(BR2_PACKAGE_SLANG),y)
55 PERF_DEPENDENCIES += slang
56 else
57 PERF_MAKE_FLAGS += NO_SLANG=1
58 endif
60 ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
61 PERF_DEPENDENCIES += libunwind
62 else
63 PERF_MAKE_FLAGS += NO_LIBUNWIND=1
64 endif
66 ifeq ($(BR2_PACKAGE_NUMACTL),y)
67 PERF_DEPENDENCIES += numactl
68 else
69 PERF_MAKE_FLAGS += NO_LIBNUMA=1
70 endif
72 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
73 PERF_DEPENDENCIES += elfutils
74 else
75 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
76 endif
78 ifeq ($(BR2_PACKAGE_ZLIB),y)
79 PERF_DEPENDENCIES += zlib
80 else
81 PERF_MAKE_FLAGS += NO_ZLIB=1
82 endif
84 # lzma is provided by xz
85 ifeq ($(BR2_PACKAGE_XZ),y)
86 PERF_DEPENDENCIES += xz
87 else
88 PERF_MAKE_FLAGS += NO_LZMA=1
89 endif
91 # We really do not want to build the perf documentation, because it
92 # has stringent requirement on the documentation generation tools,
93 # like xmlto and asciidoc), which may be lagging behind on some
94 # distributions.
95 # We name it 'GNUmakefile' so that GNU make will use it instead of
96 # the existing 'Makefile'.
97 define PERF_DISABLE_DOCUMENTATION
98 if [ -f $(@D)/tools/perf/Documentation/Makefile ]; then \
99 printf "%%:\n\t@:\n" >$(@D)/tools/perf/Documentation/GNUmakefile; \
101 endef
102 LINUX_POST_PATCH_HOOKS += PERF_DISABLE_DOCUMENTATION
104 # O must be redefined here to overwrite the one used by Buildroot for
105 # out of tree build. We build perf in $(@D)/tools/perf/ and not just
106 # $(@D) so that it isn't built in the root directory of the kernel
107 # sources.
108 define PERF_BUILD_CMDS
109 $(Q)if test ! -f $(@D)/tools/perf/Makefile ; then \
110 echo "Your kernel version is too old and does not have the perf tool." ; \
111 echo "At least kernel 2.6.31 must be used." ; \
112 exit 1 ; \
114 $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
115 if ! grep -q NO_LIBELF $(@D)/tools/perf/Makefile* ; then \
116 if ! test -r $(@D)/tools/perf/config/Makefile ; then \
117 echo "The perf tool in your kernel cannot be built without libelf." ; \
118 echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
119 exit 1 ; \
120 fi \
121 fi \
123 $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
124 -C $(@D)/tools/perf O=$(@D)/tools/perf/
125 endef
127 # After installation, we remove the Perl and Python scripts from the
128 # target.
129 define PERF_INSTALL_TARGET_CMDS
130 $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
131 -C $(@D)/tools/perf O=$(@D)/tools/perf/ install
132 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
133 $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/tests/
134 endef