cea23d2a3b7d56cbea02cbcab35c6a0e612553f9
[openwrt/svn-archive/archive.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:=libnl 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 define KernelPackage/wprobe
22 SUBMENU:=Network Support
23 TITLE:=Wireless driver probe infrastructure
24 FILES:= \
25 $(PKG_BUILD_DIR)/kernel/wprobe.$(LINUX_KMOD_SUFFIX)
26 AUTOLOAD:=$(call AutoLoad,01,wprobe)
27 endef
28
29 define KernelPackage/wprobe/description
30 A module that exports measurement data from wireless driver to user space
31 endef
32
33 define Package/wprobe-info
34 SECTION:=net
35 CATEGORY:=Network
36 DEPENDS:=+kmod-wprobe
37 TITLE:=Wireless measurement utility
38 endef
39
40 define Package/wprobe-info/description
41 wprobe-info uses the wprobe kernel module to query
42 wireless driver measurement data from an interface
43 endef
44
45 define Package/wprobe-export
46 SECTION:=net
47 CATEGORY:=Network
48 DEPENDS:=+kmod-wprobe
49 TITLE:=Wireless measurement data exporter
50 endef
51
52 define Package/wprobe-export/description
53 wprobe-export uses the wprobe kernel module to export
54 wireless driver measurement data via the IPFIX protocol
55 endef
56
57 define Build/Prepare
58 mkdir -p $(PKG_BUILD_DIR)
59 $(CP) src/* $(PKG_BUILD_DIR)/
60 endef
61
62 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
63
64 ifdef CONFIG_PACKAGE_kmod-wprobe
65 define Build/Compile/kmod
66 $(MAKE) -C $(LINUX_DIR) \
67 CROSS_COMPILE="$(TARGET_CROSS)" \
68 ARCH="$(LINUX_KARCH)" \
69 SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
70 KERNELDIR=$(LINUX_DIR) \
71 CC="$(TARGET_CC)" \
72 EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
73 modules
74 endef
75 endif
76
77 define Build/Compile/lib
78 $(MAKE) -C $(PKG_BUILD_DIR)/user \
79 $(TARGET_CONFIGURE_OPTS) \
80 CFLAGS="$(TARGET_CFLAGS)" \
81 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
82 LDFLAGS="$(TARGET_LDFLAGS)" \
83 LIBNL="$(STAGING_DIR)/usr/lib/libnl.a"
84 endef
85
86 ifdef CONFIG_PACKAGE_wprobe-export
87 define Build/Compile/exporter
88 $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
89 $(TARGET_CONFIGURE_OPTS) \
90 CFLAGS="$(TARGET_CFLAGS)" \
91 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
92 LDFLAGS="$(TARGET_LDFLAGS)" \
93 LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a $(STAGING_DIR)/usr/lib/libnl.a -lm"
94 endef
95 endif
96
97 define Build/Compile
98 $(Build/Compile/kmod)
99 $(Build/Compile/lib)
100 $(Build/Compile/exporter)
101 endef
102
103 define Build/InstallDev
104 $(INSTALL_DIR) $(1)/usr/include/wprobe
105 $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
106 endef
107
108 define Package/wprobe-info/install
109 $(INSTALL_DIR) $(1)/sbin
110 $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-info $(1)/sbin/
111 endef
112
113 define Package/wprobe-export/install
114 $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d
115 $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/
116 $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
117 endef
118
119 $(eval $(call KernelPackage,wprobe))
120 $(eval $(call BuildPackage,wprobe-info))
121 $(eval $(call BuildPackage,wprobe-export))