[adm5120] fix support for 2.6.38 kernel
[openwrt.git] / 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
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/kernel.mk
9
10 PKG_NAME:=wprobe
11 PKG_VERSION:=1
12 PKG_RELEASE:=1
13
14 PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
15
16 PKG_CONFIG_DEPENDS = \
17 CONFIG_PACKAGE_kmod-wprobe \
18 CONFIG_PACKAGE_wprobe-export \
19
20 include $(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
26 define Package/wprobe/Default
27 DEPENDS:=@(!(TARGET_ps3||TARGET_pxcab||cris)||BROKEN)
28 endef
29
30 define 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.ko
37 AUTOLOAD:=$(call AutoLoad,01,wprobe)
38 endef
39
40 define KernelPackage/wprobe/description
41 A module that exports measurement data from wireless driver to user space
42 endef
43
44 define 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
50 endef
51
52 define Package/wprobe-util/description
53 wprobe-util uses the wprobe kernel module to query
54 wireless driver measurement data from an interface
55 endef
56
57 define Package/wprobe-export
58 $(call Package/wprobe/Default)
59 SECTION:=net
60 CATEGORY:=Network
61 DEPENDS+=+wprobe-util
62 TITLE:=Wireless measurement data exporter
63 endef
64
65 define Package/wprobe-export/description
66 wprobe-export uses the wprobe kernel module to export
67 wireless driver measurement data via the IPFIX protocol
68 endef
69
70 define Package/wprobe-export/conffiles
71 /etc/config/wprobe
72 endef
73
74 define Build/Prepare
75 mkdir -p $(PKG_BUILD_DIR)
76 $(CP) src/* $(PKG_BUILD_DIR)/
77 endef
78
79 TARGET_CPPFLAGS := \
80 -D_GNU_SOURCE \
81 -I$(STAGING_DIR)/usr/include/libnl-tiny \
82 $(TARGET_CPPFLAGS)
83
84 ifdef CONFIG_PACKAGE_kmod-wprobe
85 define Build/Compile/kmod
86 $(MAKE) -C $(LINUX_DIR) \
87 CROSS_COMPILE="$(KERNEL_CROSS)" \
88 ARCH="$(LINUX_KARCH)" \
89 SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
90 KERNELDIR=$(LINUX_DIR) \
91 CC="$(TARGET_CC)" \
92 EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
93 modules
94 endef
95 endif
96
97 define Build/Compile/lib
98 $(MAKE) -C $(PKG_BUILD_DIR)/user \
99 $(TARGET_CONFIGURE_OPTS) \
100 CFLAGS="$(TARGET_CFLAGS)" \
101 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
102 LDFLAGS="$(TARGET_LDFLAGS)" \
103 HOST_OS=Linux \
104 LIBNL="-lnl-tiny"
105 endef
106
107 ifdef CONFIG_PACKAGE_wprobe-export
108 define Build/Compile/exporter
109 $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
110 $(TARGET_CONFIGURE_OPTS) \
111 CFLAGS="$(TARGET_CFLAGS)" \
112 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
113 LDFLAGS="$(TARGET_LDFLAGS)" \
114 LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a -lnl-tiny -lm"
115 endef
116 endif
117
118 define Build/Compile
119 $(Build/Compile/kmod)
120 $(Build/Compile/lib)
121 $(Build/Compile/exporter)
122 endef
123
124 define Build/InstallDev
125 $(INSTALL_DIR) $(1)/usr/include/wprobe
126 $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
127 endef
128
129 define Package/wprobe-util/install
130 $(INSTALL_DIR) $(1)/sbin
131 $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
132 endef
133
134 define Package/wprobe-export/install
135 $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
136 $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
137 $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
138 $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
139 endef
140
141 $(eval $(call KernelPackage,wprobe))
142 $(eval $(call BuildPackage,wprobe-util))
143 $(eval $(call BuildPackage,wprobe-export))
This page took 0.04869 seconds and 5 git commands to generate.