add _GNU_SOURCE to CPPFLAGS required to include <bits/socket.h> on recent eglibc...
[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 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 -D_GNU_SOURCE \
65 -I$(STAGING_DIR)/usr/include/libnl-tiny \
66 $(TARGET_CPPFLAGS)
67
68 ifdef CONFIG_PACKAGE_kmod-wprobe
69 define Build/Compile/kmod
70 $(MAKE) -C $(LINUX_DIR) \
71 CROSS_COMPILE="$(KERNEL_CROSS)" \
72 ARCH="$(LINUX_KARCH)" \
73 SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
74 KERNELDIR=$(LINUX_DIR) \
75 CC="$(TARGET_CC)" \
76 EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
77 modules
78 endef
79 endif
80
81 define Build/Compile/lib
82 $(MAKE) -C $(PKG_BUILD_DIR)/user \
83 $(TARGET_CONFIGURE_OPTS) \
84 CFLAGS="$(TARGET_CFLAGS)" \
85 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
86 LDFLAGS="$(TARGET_LDFLAGS)" \
87 HOST_OS=Linux \
88 LIBNL="-lnl-tiny"
89 endef
90
91 ifdef CONFIG_PACKAGE_wprobe-export
92 define Build/Compile/exporter
93 $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
94 $(TARGET_CONFIGURE_OPTS) \
95 CFLAGS="$(TARGET_CFLAGS)" \
96 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
97 LDFLAGS="$(TARGET_LDFLAGS)" \
98 LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a -lnl-tiny -lm"
99 endef
100 endif
101
102 define Build/Compile
103 $(Build/Compile/kmod)
104 $(Build/Compile/lib)
105 $(Build/Compile/exporter)
106 endef
107
108 define Build/InstallDev
109 $(INSTALL_DIR) $(1)/usr/include/wprobe
110 $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
111 endef
112
113 define Package/wprobe-util/install
114 $(INSTALL_DIR) $(1)/sbin
115 $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
116 endef
117
118 define Package/wprobe-export/install
119 $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
120 $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
121 $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
122 $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
123 endef
124
125 $(eval $(call KernelPackage,wprobe))
126 $(eval $(call BuildPackage,wprobe-util))
127 $(eval $(call BuildPackage,wprobe-export))
This page took 0.047608 seconds and 5 git commands to generate.