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