db6838787c947522fb950e1422d159cd0a34abe6
[openwrt/staging/wigyori.git] / package / devel / perf / Makefile
1 #
2 # Copyright (C) 2011-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=perf
12 PKG_VERSION:=$(LINUX_VERSION)
13 PKG_RELEASE:=2
14
15 PKG_USE_MIPS16:=0
16 PKG_BUILD_PARALLEL:=1
17 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
18
19 # Perf's makefile and headers are not relocatable and must be built from the
20 # Linux sources directory
21 PKG_BUILD_DIR:=$(LINUX_DIR)/tools/perf-$(TARGET_DIR_NAME)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/perf
26 SECTION:=devel
27 CATEGORY:=Development
28 DEPENDS:= +libelf1 +libdw +libpthread +librt +objdump @!LINUX_3_18
29 TITLE:=Linux performance monitoring tool
30 VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
31 URL:=http://www.kernel.org
32 endef
33
34 define Package/perf/description
35 perf is the Linux performance monitoring tool
36 endef
37
38 define Build/Prepare
39 $(CP) $(LINUX_DIR)/tools/perf/* $(PKG_BUILD_DIR)/
40 endef
41
42 MAKE_FLAGS = \
43 ARCH="$(LINUX_KARCH)" \
44 NO_LIBPERL=1 \
45 NO_LIBPYTHON=1 \
46 NO_NEWT=1 \
47 NO_LZMA=1 \
48 NO_BACKTRACE=1 \
49 NO_LIBNUMA=1 \
50 NO_GTK2=1 \
51 NO_LIBAUDIT=1 \
52 CROSS_COMPILE="$(TARGET_CROSS)" \
53 CC="$(TARGET_CC)" \
54 LD="$(TARGET_CROSS)ld" \
55 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
56 LDFLAGS="$(TARGET_LDFLAGS)" \
57 $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
58 WERROR=0 \
59 prefix=/usr
60
61 ifdef CONFIG_USE_MUSL
62 MAKE_FLAGS += EXTRA_CFLAGS="-I$(CURDIR)/musl-include -include $(CURDIR)/musl-compat.h -D__UCLIBC__"
63 endif
64
65 define Build/Compile
66 +$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \
67 -C $(PKG_BUILD_DIR) \
68 -f Makefile.perf \
69 --no-print-directory
70 endef
71
72 define Package/perf/install
73 $(INSTALL_DIR) $(1)/usr/bin
74 $(INSTALL_BIN) $(PKG_BUILD_DIR)/perf $(1)/usr/bin/
75 endef
76
77 $(eval $(call BuildPackage,perf))