Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. include $(TOPDIR)/rules.mk
  7. include $(INCLUDE_DIR)/kernel.mk
  8. PKG_NAME:=wprobe
  9. PKG_VERSION:=1
  10. PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
  11. PKG_CONFIG_DEPENDS = \
  12. CONFIG_PACKAGE_kmod-wprobe \
  13. CONFIG_PACKAGE_wprobe-export \
  14. include $(INCLUDE_DIR)/package.mk
  15. define KernelPackage/wprobe
  16. SUBMENU:=Network Support
  17. DEPENDS:=@LINUX_2_6
  18. TITLE:=Wireless driver probe infrastructure
  19. FILES:= \
  20. $(PKG_BUILD_DIR)/kernel/wprobe.$(LINUX_KMOD_SUFFIX)
  21. AUTOLOAD:=$(call AutoLoad,01,wprobe)
  22. endef
  23. define KernelPackage/wprobe/description
  24. A module that exports measurement data from wireless driver to user space
  25. endef
  26. define Package/wprobe-util
  27. SECTION:=net
  28. CATEGORY:=Network
  29. DEPENDS:=+kmod-wprobe +libnl-tiny
  30. TITLE:=Wireless measurement utility
  31. endef
  32. define Package/wprobe-util/description
  33. wprobe-util uses the wprobe kernel module to query
  34. wireless driver measurement data from an interface
  35. endef
  36. define Package/wprobe-export
  37. SECTION:=net
  38. CATEGORY:=Network
  39. DEPENDS:=+wprobe-util
  40. TITLE:=Wireless measurement data exporter
  41. endef
  42. define Package/wprobe-export/description
  43. wprobe-export uses the wprobe kernel module to export
  44. wireless driver measurement data via the IPFIX protocol
  45. endef
  46. define Build/Prepare
  47. mkdir -p $(PKG_BUILD_DIR)
  48. $(CP) src/* $(PKG_BUILD_DIR)/
  49. endef
  50. TARGET_CPPFLAGS := \
  51. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  52. $(TARGET_CPPFLAGS)
  53. ifdef CONFIG_PACKAGE_kmod-wprobe
  54. define Build/Compile/kmod
  55. $(MAKE) -C $(LINUX_DIR) \
  56. CROSS_COMPILE="$(KERNEL_CROSS)" \
  57. ARCH="$(LINUX_KARCH)" \
  58. SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
  59. KERNELDIR=$(LINUX_DIR) \
  60. CC="$(TARGET_CC)" \
  61. EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
  62. modules
  63. endef
  64. endif
  65. define Build/Compile/lib
  66. $(MAKE) -C $(PKG_BUILD_DIR)/user \
  67. $(TARGET_CONFIGURE_OPTS) \
  68. CFLAGS="$(TARGET_CFLAGS)" \
  69. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
  70. LDFLAGS="$(TARGET_LDFLAGS)" \
  71. HOST_OS=Linux \
  72. LIBNL="-lnl-tiny"
  73. endef
  74. ifdef CONFIG_PACKAGE_wprobe-export
  75. define Build/Compile/exporter
  76. $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
  77. $(TARGET_CONFIGURE_OPTS) \
  78. CFLAGS="$(TARGET_CFLAGS)" \
  79. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
  80. LDFLAGS="$(TARGET_LDFLAGS)" \
  81. LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a -lnl-tiny -lm"
  82. endef
  83. endif
  84. define Build/Compile
  85. $(Build/Compile/kmod)
  86. $(Build/Compile/lib)
  87. $(Build/Compile/exporter)
  88. endef
  89. define Build/InstallDev
  90. $(INSTALL_DIR) $(1)/usr/include/wprobe
  91. $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
  92. endef
  93. define Package/wprobe-util/install
  94. $(INSTALL_DIR) $(1)/sbin
  95. $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
  96. endef
  97. define Package/wprobe-export/install
  98. $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
  99. $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
  100. $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
  101. $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
  102. endef
  103. $(eval $(call KernelPackage,wprobe))
  104. $(eval $(call BuildPackage,wprobe-util))
  105. $(eval $(call BuildPackage,wprobe-export))