Merge pull request #282 from ecsv/batadv-2017.0
[feed/routing.git] / batctl / Makefile
1 #
2 # Copyright (C) 2014 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:=batctl
11
12 PKG_VERSION:=2017.0
13 PKG_RELEASE:=0
14 PKG_MD5SUM:=17c0ac0746f1994ddacc88ebf48e5aec
15 PKG_HASH:=c0bb1127d6070b46abeb8d6a63d1150d71fa85f87f9a846873b649a21934c686
16
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
19 PKG_LICENSE:=GPL-2.0
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/batctl
26 URL:=https://www.open-mesh.org/
27 SECTION:=net
28 CATEGORY:=Network
29 DEPENDS:=+kmod-batman-adv +libnl-tiny +libc +librt
30 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool batctl
31 MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
32 endef
33
34 define Package/batctl/description
35 batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
36 It is an easier method for configuring batman-adv and provides some
37 additional tools for debugging as well. This package builds
38 version $(PKG_VERSION) of the user space utility.
39 endef
40
41 # The linker can identify unused sections of a binary when each symbol is stored
42 # in a separate section. This mostly removes unused linker sections and reduces
43 # the size by ~3% on mipsel.
44
45 TARGET_CFLAGS += -ffunction-sections -fdata-sections
46 TARGET_LDFLAGS += -Wl,--gc-sections
47
48 # Link-time optimization allows to move parts of the optimization from the single
49 # source file to the global source view. This is done by emitting the GIMPLE
50 # representation in each object file and analyzing it again during the link step.
51
52 TARGET_CFLAGS += -flto
53 TARGET_LDFLAGS += -fuse-linker-plugin
54
55 MAKE_BATCTL_ENV += \
56 CPPFLAGS="$(TARGET_CPPFLAGS)" \
57 CFLAGS="$(TARGET_CFLAGS)" \
58 LDFLAGS="$(TARGET_LDFLAGS)" \
59 LIBNL_NAME="libnl-tiny" \
60 LIBNL_GENL_NAME="libnl-tiny"
61
62 MAKE_BATCTL_ARGS += \
63 REVISION="$(PKG_BATCTL_SHORTREV)" \
64 CC="$(TARGET_CC)" \
65 DESTDIR="$(PKG_INSTALL_DIR)" \
66 batctl install
67
68
69 define Build/Compile
70 $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS)
71 endef
72
73 define Build/Clean
74 rm -rf $(BUILD_DIR)/$(PKG_NAME)/
75 endef
76
77 define Package/batctl/install
78 $(INSTALL_DIR) $(1)/usr/sbin
79 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/sbin/
80 endef
81
82 $(eval $(call BuildPackage,batctl))