package/button-hotplug: handle KEY_RESTART and KEY_WPS_BUTTON codes as well
[openwrt.git] / package / wprobe / Makefile
1
2 # Copyright (C) 2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/kernel.mk
9
10 PKG_NAME:=wprobe
11 PKG_VERSION:=1
12
13 PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
14
15 PKG_CONFIG_DEPENDS = \
16         CONFIG_PACKAGE_kmod-wprobe \
17         CONFIG_PACKAGE_wprobe-export \
18
19 include $(INCLUDE_DIR)/package.mk
20
21 # XXX: build failure on cris
22 # wprobe-lib.c:145: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
23 # wprobe-lib.c:149: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
24
25 define Package/wprobe/Default
26   DEPENDS:=@LINUX_2_6 @(!(TARGET_ps3||TARGET_pxcab||cris)||BROKEN)
27 endef
28
29 define KernelPackage/wprobe
30 $(call Package/wprobe/Default)
31   SUBMENU:=Network Support
32   TITLE:=Wireless driver probe infrastructure
33   MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
34   FILES:= \
35         $(PKG_BUILD_DIR)/kernel/wprobe.$(LINUX_KMOD_SUFFIX)
36   AUTOLOAD:=$(call AutoLoad,01,wprobe)
37 endef
38
39 define KernelPackage/wprobe/description
40   A module that exports measurement data from wireless driver to user space
41 endef
42
43 define Package/wprobe-util
44 $(call Package/wprobe/Default)
45   SECTION:=net
46   CATEGORY:=Network
47   DEPENDS+=+kmod-wprobe +libnl-tiny
48   TITLE:=Wireless measurement utility
49 endef
50
51 define Package/wprobe-util/description
52   wprobe-util uses the wprobe kernel module to query
53   wireless driver measurement data from an interface
54 endef
55
56 define Package/wprobe-export
57 $(call Package/wprobe/Default)
58   SECTION:=net
59   CATEGORY:=Network
60   DEPENDS+=+wprobe-util
61   TITLE:=Wireless measurement data exporter
62 endef
63
64 define Package/wprobe-export/description
65   wprobe-export uses the wprobe kernel module to export
66   wireless driver measurement data via the IPFIX protocol
67 endef
68
69 define Build/Prepare
70         mkdir -p $(PKG_BUILD_DIR)
71         $(CP) src/* $(PKG_BUILD_DIR)/
72 endef
73
74 TARGET_CPPFLAGS := \
75         -D_GNU_SOURCE \
76         -I$(STAGING_DIR)/usr/include/libnl-tiny \
77         $(TARGET_CPPFLAGS)
78
79 ifdef CONFIG_PACKAGE_kmod-wprobe
80   define Build/Compile/kmod
81         $(MAKE) -C $(LINUX_DIR) \
82                 CROSS_COMPILE="$(KERNEL_CROSS)" \
83                 ARCH="$(LINUX_KARCH)" \
84                 SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
85                 KERNELDIR=$(LINUX_DIR) \
86                 CC="$(TARGET_CC)" \
87                 EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
88                 modules
89   endef
90 endif
91
92 define Build/Compile/lib
93         $(MAKE) -C $(PKG_BUILD_DIR)/user \
94                 $(TARGET_CONFIGURE_OPTS) \
95                 CFLAGS="$(TARGET_CFLAGS)" \
96                 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
97                 LDFLAGS="$(TARGET_LDFLAGS)" \
98                 HOST_OS=Linux \
99                 LIBNL="-lnl-tiny"
100 endef
101
102 ifdef CONFIG_PACKAGE_wprobe-export
103   define Build/Compile/exporter
104         $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
105                 $(TARGET_CONFIGURE_OPTS) \
106                 CFLAGS="$(TARGET_CFLAGS)" \
107                 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
108                 LDFLAGS="$(TARGET_LDFLAGS)" \
109                 LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a -lnl-tiny -lm"
110   endef
111 endif
112
113 define Build/Compile
114         $(Build/Compile/kmod)
115         $(Build/Compile/lib)
116         $(Build/Compile/exporter)
117 endef
118
119 define Build/InstallDev
120         $(INSTALL_DIR) $(1)/usr/include/wprobe
121         $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
122 endef
123
124 define Package/wprobe-util/install
125         $(INSTALL_DIR) $(1)/sbin
126         $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
127 endef
128
129 define Package/wprobe-export/install
130         $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
131         $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
132         $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
133         $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
134 endef
135
136 $(eval $(call KernelPackage,wprobe))
137 $(eval $(call BuildPackage,wprobe-util))
138 $(eval $(call BuildPackage,wprobe-export))