Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. -D_GNU_SOURCE \
  52. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  53. $(TARGET_CPPFLAGS)
  54. ifdef CONFIG_PACKAGE_kmod-wprobe
  55. define Build/Compile/kmod
  56. $(MAKE) -C $(LINUX_DIR) \
  57. CROSS_COMPILE="$(KERNEL_CROSS)" \
  58. ARCH="$(LINUX_KARCH)" \
  59. SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
  60. KERNELDIR=$(LINUX_DIR) \
  61. CC="$(TARGET_CC)" \
  62. EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
  63. modules
  64. endef
  65. endif
  66. define Build/Compile/lib
  67. $(MAKE) -C $(PKG_BUILD_DIR)/user \
  68. $(TARGET_CONFIGURE_OPTS) \
  69. CFLAGS="$(TARGET_CFLAGS)" \
  70. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
  71. LDFLAGS="$(TARGET_LDFLAGS)" \
  72. HOST_OS=Linux \
  73. LIBNL="-lnl-tiny"
  74. endef
  75. ifdef CONFIG_PACKAGE_wprobe-export
  76. define Build/Compile/exporter
  77. $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
  78. $(TARGET_CONFIGURE_OPTS) \
  79. CFLAGS="$(TARGET_CFLAGS)" \
  80. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
  81. LDFLAGS="$(TARGET_LDFLAGS)" \
  82. LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a -lnl-tiny -lm"
  83. endef
  84. endif
  85. define Build/Compile
  86. $(Build/Compile/kmod)
  87. $(Build/Compile/lib)
  88. $(Build/Compile/exporter)
  89. endef
  90. define Build/InstallDev
  91. $(INSTALL_DIR) $(1)/usr/include/wprobe
  92. $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
  93. endef
  94. define Package/wprobe-util/install
  95. $(INSTALL_DIR) $(1)/sbin
  96. $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
  97. endef
  98. define Package/wprobe-export/install
  99. $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
  100. $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
  101. $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
  103. endef
  104. $(eval $(call KernelPackage,wprobe))
  105. $(eval $(call BuildPackage,wprobe-util))
  106. $(eval $(call BuildPackage,wprobe-export))