Root/package/wprobe/Makefile

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

Archive Download this file



interactive