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