perf: fix musl compatibility
[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
18 # Perf's makefile and headers are not relocatable and must be built from the
19 # Linux sources directory
20 PKG_BUILD_DIR:=$(LINUX_DIR)/tools/perf-$(TARGET_DIR_NAME)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/perf
25 SECTION:=devel
26 CATEGORY:=Development
27 DEPENDS:= @!USE_UCLIBC +libelf1 +libdw +libpthread +librt +binutils
28 TITLE:=Linux performance monitoring tool
29 VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
30 URL:=http://www.kernel.org
31 endef
32
33 define Package/perf/description
34 perf is the Linux performance monitoring tool
35 endef
36
37 define Build/Prepare
38 $(CP) $(LINUX_DIR)/tools/perf/* $(PKG_BUILD_DIR)/
39 endef
40
41 MAKE_FLAGS = \
42 ARCH="$(LINUX_KARCH)" \
43 NO_LIBPERL=1 \
44 NO_LIBPYTHON=1 \
45 NO_NEWT=1 \
46 NO_LZMA=1 \
47 NO_BACKTRACE=1 \
48 NO_LIBNUMA=1 \
49 NO_GTK2=1 \
50 NO_LIBAUDIT=1 \
51 CROSS_COMPILE="$(TARGET_CROSS)" \
52 CC="$(TARGET_CC)" \
53 LD="$(TARGET_CROSS)ld" \
54 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
55 LDFLAGS="$(TARGET_LDFLAGS)" \
56 $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
57 WERROR=0 \
58 prefix=/usr
59
60 ifdef CONFIG_USE_MUSL
61 MAKE_FLAGS += EXTRA_CFLAGS="-include $(CURDIR)/musl-compat.h -D__UCLIBC__"
62 endif
63
64 define Build/Compile
65 +$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \
66 -C $(PKG_BUILD_DIR) \
67 -f Makefile.perf \
68 --no-print-directory
69 endef
70
71 define Package/perf/install
72 $(INSTALL_DIR) $(1)/usr/bin
73 $(INSTALL_BIN) $(PKG_BUILD_DIR)/perf $(1)/usr/bin/
74 endef
75
76 $(eval $(call BuildPackage,perf))