iw: compile with LTO enabled
[openwrt/openwrt.git] / package / network / utils / iw / Makefile
1 #
2 # Copyright (C) 2007-2011 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
10 PKG_NAME:=iw
11 PKG_VERSION:=4.14
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/software/network/iw
16 PKG_HASH:=f01671c0074bfdec082a884057edba1b9efd35c89eda554638496f03b769ad89
17
18 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
19 PKG_LICENSE:=GPL-2.0
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/iw
24 SECTION:=net
25 CATEGORY:=Network
26 TITLE:=cfg80211 interface configuration utility
27 URL:=http://wireless.kernel.org/en/users/Documentation/iw
28 DEPENDS:= +libnl-tiny
29 endef
30
31 define Build/Configure
32 echo "const char iw_version[] = \"$(PKG_VERSION)\";" > $(PKG_BUILD_DIR)/version.c
33 echo "#!/bin/sh" > $(PKG_BUILD_DIR)/version.sh
34 chmod +x $(PKG_BUILD_DIR)/version.sh
35 endef
36
37 TARGET_CPPFLAGS:= \
38 -I$(STAGING_DIR)/usr/include/libnl-tiny \
39 $(TARGET_CPPFLAGS) \
40 -DCONFIG_LIBNL20 \
41 -D_GNU_SOURCE \
42 -flto
43
44 MAKE_FLAGS += \
45 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \
46 LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections -flto" \
47 NL1FOUND="" NL2FOUND=Y \
48 NLLIBNAME="libnl-tiny" \
49 LIBS="-lm -lnl-tiny" \
50 V=1
51
52 define Package/iw/install
53 $(INSTALL_DIR) $(1)/usr/sbin
54 $(INSTALL_BIN) $(PKG_BUILD_DIR)/iw $(1)/usr/sbin/
55 endef
56
57 $(eval $(call BuildPackage,iw))