perf: make cleaning non-fatal if $(PKG_BUILD_DIR) does not exist
[packages.git] / 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 include $(INCLUDE_DIR)/package.mk
16
17 define Package/perf
18   SECTION:=devel
19   CATEGORY:=Development
20   DEPENDS:= +libelf1 +libdw +libpthread +librt +binutils
21   TITLE:=Linux performance monitoring tool
22   VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
23   URL:=http://www.kernel.org
24 endef
25
26 define Package/perf/description
27   perf is the Linux performance monitoring tool
28 endef
29
30 # Perf's makefile and headers are not relocatable and must be built from the
31 # Linux sources directory
32 define Build/Prepare
33         $(RM) -r $(PKG_BUILD_DIR)
34         ln -s $(LINUX_DIR)/tools/perf $(PKG_BUILD_DIR)
35 endef
36
37 # MAKE_FLAGS should be passed again upon cleaning because Perf's makefile
38 # always performs checks before processing any rule
39 define Build/Clean
40         -$(MAKE) -C $(PKG_BUILD_DIR) \
41                 NO_DWARF=1 \
42                 $(MAKE_FLAGS) \
43                 clean
44 endef
45
46 MAKE_FLAGS = \
47         ARCH="$(LINUX_KARCH)" \
48         NO_LIBPERL=1 \
49         NO_LIBPYTHON=1 \
50         NO_NEWT=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         V=1 \
57         prefix=/usr
58
59 define Package/perf/install
60         $(INSTALL_DIR) $(1)/usr/bin
61         $(INSTALL_BIN) $(LINUX_DIR)/tools/perf/perf $(1)/usr/bin/
62 endef
63
64 $(eval $(call BuildPackage,perf))