olsrd: version bump to 0.6.6
[feed/routing.git] / batman-adv / Makefile
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=batman-adv
12
13 PKG_VERSION:=2013.3.0
14 BATCTL_VERSION:=2013.3.0
15 PKG_RELEASE:=5
16 PKG_MD5SUM:=d070c0879cd8fe8125315a4566fabd2d
17 BATCTL_MD5SUM:=747535b0296f0013a6f99373a51d41fc
18
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
20 PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_BATCTL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION)
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/kernel.mk
27
28 define KernelPackage/batman-adv
29 URL:=http://www.open-mesh.org/
30 MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
31 SUBMENU:=Network Support
32 DEPENDS:=+kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +libc
33 TITLE:=B.A.T.M.A.N. Adv
34 FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
35 AUTOLOAD:=$(call AutoLoad,50,batman-adv)
36 endef
37
38 define KernelPackage/batman-adv/description
39 B.A.T.M.A.N. advanced is a kernel module which allows to
40 build layer 2 mesh networks. This package contains the
41 version $(PKG_VERSION) of the kernel module plus its user space
42 configuration & managerment tool batctl.
43 endef
44
45 define KernelPackage/batman-adv/config
46 source "$(SOURCE)/Config.in"
47 endef
48
49 MAKE_BATMAN_ADV_ARGS += \
50 CROSS_COMPILE="$(TARGET_CROSS)" \
51 KERNELPATH="$(LINUX_DIR)" \
52 ARCH="$(LINUX_KARCH)" \
53 PATH="$(TARGET_PATH)" \
54 SUBDIRS="$(PKG_BUILD_DIR)" \
55 PWD="$(PKG_BUILD_DIR)" \
56 LINUX_VERSION="$(LINUX_VERSION)" \
57 CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \
58 CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \
59 CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
60 CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \
61 REVISION="" all
62
63 # The linker can identify unused sections of a binary when each symbol is stored
64 # in a separate section. This mostly removes unused linker sections and reduces
65 # the size by ~3% on mipsel.
66
67 TARGET_CFLAGS += -ffunction-sections -fdata-sections
68 TARGET_LDFLAGS += -Wl,--gc-sections
69
70 # Link-time optimization allows to move parts of the optimization from the single
71 # source file to the global source view. This is done by emitting the GIMPLE
72 # representation in each object file and analyzing it again during the link step.
73
74 TARGET_CFLAGS += -flto
75 TARGET_LDFLAGS += -fuse-linker-plugin
76
77 MAKE_BATCTL_ENV += \
78 CPPFLAGS="$(TARGET_CPPFLAGS)" \
79 CFLAGS="$(TARGET_CFLAGS)" \
80 LDFLAGS="$(TARGET_LDFLAGS)"
81
82 MAKE_BATCTL_ARGS += \
83 REVISION="" \
84 CC="$(TARGET_CC)" \
85 DESTDIR="$(PKG_INSTALL_DIR)" \
86 batctl install
87
88 ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
89 define Download/batctl
90 FILE:=batctl-$(BATCTL_VERSION).tar.gz
91 URL:=$(PKG_SOURCE_URL)
92 MD5SUM:=$(BATCTL_MD5SUM)
93 endef
94 $(eval $(call Download,batctl))
95
96 BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
97 BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*")
98 BATCTL_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
99 BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
100 endif
101
102 KPATCH ?= $(PATCH)
103 define Build/DoPatch
104 @if [ -d "$(2)" ]; then \
105 if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \
106 $(KPATCH) "$(1)" "$(2)" "$(3)"; \
107 fi; \
108 fi
109 endef
110
111 define Build/Patch
112 $(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*")
113 $(BATCTL_EXTRACT)
114 $(BATCTL_PATCH)
115 endef
116
117 define Build/Compile
118 $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
119 $(BATCTL_BUILD)
120 endef
121
122 define Build/Clean
123 rm -rf $(BUILD_DIR)/$(PKG_NAME)/
124 endef
125
126 define KernelPackage/batman-adv/install
127 $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto
128 $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
129 $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
130 $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
131 $(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
132 $(BATCTL_INSTALL)
133 endef
134
135 $(eval $(call KernelPackage,batman-adv))