1 ################################################################################
5 ################################################################################
9 PERF_DEPENDENCIES
= host-flex host-bison
11 ifeq ($(KERNEL_ARCH
),x86_64
)
14 PERF_ARCH
=$(KERNEL_ARCH
)
19 JOBS
=$(PARALLEL_JOBS
) \
21 DESTDIR
=$(TARGET_DIR
) \
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:
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"
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.
51 PERF_MAKE_FLAGS
+= NO_BACKTRACE
=1
54 ifeq ($(BR2_PACKAGE_SLANG
),y
)
55 PERF_DEPENDENCIES
+= slang
57 PERF_MAKE_FLAGS
+= NO_SLANG
=1
60 ifeq ($(BR2_PACKAGE_LIBUNWIND
),y
)
61 PERF_DEPENDENCIES
+= libunwind
63 PERF_MAKE_FLAGS
+= NO_LIBUNWIND
=1
66 ifeq ($(BR2_PACKAGE_NUMACTL
),y
)
67 PERF_DEPENDENCIES
+= numactl
69 PERF_MAKE_FLAGS
+= NO_LIBNUMA
=1
72 ifeq ($(BR2_PACKAGE_ELFUTILS
),y
)
73 PERF_DEPENDENCIES
+= elfutils
75 PERF_MAKE_FLAGS
+= NO_LIBELF
=1 NO_DWARF
=1
78 ifeq ($(BR2_PACKAGE_ZLIB
),y
)
79 PERF_DEPENDENCIES
+= zlib
81 PERF_MAKE_FLAGS
+= NO_ZLIB
=1
84 # lzma is provided by xz
85 ifeq ($(BR2_PACKAGE_XZ
),y
)
86 PERF_DEPENDENCIES
+= xz
88 PERF_MAKE_FLAGS
+= NO_LZMA
=1
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
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
$(LINUX_DIR
)/tools
/perf
/Documentation
/Makefile
]; then \
99 printf
"%%:\n\t@:\n" >$(LINUX_DIR
)/tools
/perf
/Documentation
/GNUmakefile
; \
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 $(LINUX_DIR)/tools/perf/ and not just
106 # $(LINUX_DIR) so that it isn't built in the root directory of the kernel
108 define PERF_BUILD_CMDS
109 $(Q
)if
test ! -f
$(LINUX_DIR
)/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." ; \
114 $(Q
)if
test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
115 if
! grep
-q NO_LIBELF
$(LINUX_DIR
)/tools
/perf
/Makefile
* ; then \
116 if
! test -r
$(LINUX_DIR
)/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." ; \
123 $(TARGET_MAKE_ENV
) $(MAKE1
) $(PERF_MAKE_FLAGS
) \
124 -C
$(LINUX_DIR
)/tools
/perf O
=$(LINUX_DIR
)/tools
/perf
/
127 # After installation, we remove the Perl and Python scripts from the
129 define PERF_INSTALL_TARGET_CMDS
130 $(TARGET_MAKE_ENV
) $(MAKE1
) $(PERF_MAKE_FLAGS
) \
131 -C
$(LINUX_DIR
)/tools
/perf O
=$(LINUX_DIR
)/tools
/perf
/ install
132 $(RM
) -rf
$(TARGET_DIR
)/usr
/libexec
/perf-core
/scripts
/
133 $(RM
) -rf
$(TARGET_DIR
)/usr
/libexec
/perf-core
/tests
/