Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. include $(TOPDIR)/rules.mk
  7. include $(INCLUDE_DIR)/kernel.mk
  8. PKG_NAME:=wprobe
  9. PKG_VERSION:=1
  10. PKG_RELEASE:=1
  11. PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
  12. PKG_CONFIG_DEPENDS = \
  13. CONFIG_PACKAGE_kmod-wprobe \
  14. CONFIG_PACKAGE_wprobe-export \
  15. include $(INCLUDE_DIR)/package.mk
  16. # XXX: build failure on cris
  17. # wprobe-lib.c:145: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
  18. # wprobe-lib.c:149: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
  19. define Package/wprobe/Default
  20. DEPENDS:=@(!(TARGET_ps3||TARGET_pxcab||cris)||BROKEN)
  21. endef
  22. define KernelPackage/wprobe
  23. $(call Package/wprobe/Default)
  24. SUBMENU:=Network Support
  25. TITLE:=Wireless driver probe infrastructure
  26. MAINTAINER:=Felix Fietkau <[email protected]>
  27. FILES:= \
  28. $(PKG_BUILD_DIR)/kernel/wprobe.ko
  29. AUTOLOAD:=$(call AutoLoad,01,wprobe)
  30. endef
  31. define KernelPackage/wprobe/description
  32. A module that exports measurement data from wireless driver to user space
  33. endef
  34. define Package/wprobe-util
  35. $(call Package/wprobe/Default)
  36. SECTION:=net
  37. CATEGORY:=Network
  38. DEPENDS+=+kmod-wprobe +libnl-tiny
  39. TITLE:=Wireless measurement utility
  40. endef
  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. define Package/wprobe-export
  46. $(call Package/wprobe/Default)
  47. SECTION:=net
  48. CATEGORY:=Network
  49. DEPENDS+=+wprobe-util
  50. TITLE:=Wireless measurement data exporter
  51. endef
  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. define Package/wprobe-export/conffiles
  57. /etc/config/wprobe
  58. endef
  59. define Build/Prepare
  60. mkdir -p $(PKG_BUILD_DIR)
  61. $(CP) src/* $(PKG_BUILD_DIR)/
  62. endef
  63. TARGET_CPPFLAGS := \
  64. -D_GNU_SOURCE \
  65. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  66. $(TARGET_CPPFLAGS)
  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. define Build/Compile/lib
  80. $(MAKE) -C $(PKG_BUILD_DIR)/user \
  81. $(TARGET_CONFIGURE_OPTS) \
  82. CFLAGS="$(TARGET_CFLAGS)" \
  83. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
  84. LDFLAGS="$(TARGET_LDFLAGS)" \
  85. HOST_OS=Linux \
  86. LIBNL="-lnl-tiny"
  87. endef
  88. ifdef CONFIG_PACKAGE_wprobe-export
  89. define Build/Compile/exporter
  90. $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
  91. $(TARGET_CONFIGURE_OPTS) \
  92. CFLAGS="$(TARGET_CFLAGS)" \
  93. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
  94. LDFLAGS="$(TARGET_LDFLAGS)" \
  95. LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libipfixmisc.a -lnl-tiny -lm"
  96. endef
  97. endif
  98. define Build/Compile
  99. $(Build/Compile/kmod)
  100. $(Build/Compile/lib)
  101. $(Build/Compile/exporter)
  102. endef
  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. define Package/wprobe-util/install
  108. $(INSTALL_DIR) $(1)/sbin
  109. $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
  110. endef
  111. define Package/wprobe-export/install
  112. $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
  113. $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
  114. $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
  115. $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
  116. endef
  117. $(eval $(call KernelPackage,wprobe))
  118. $(eval $(call BuildPackage,wprobe-util))
  119. $(eval $(call BuildPackage,wprobe-export))