Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. # XXX: build failure on cris
  16. # wprobe-lib.c:145: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
  17. # wprobe-lib.c:149: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
  18. define Package/wprobe/Default
  19. DEPENDS:=@LINUX_2_6 @(!(TARGET_ps3||TARGET_pxcab||cris)||BROKEN)
  20. endef
  21. define KernelPackage/wprobe
  22. $(call Package/wprobe/Default)
  23. SUBMENU:=Network Support
  24. TITLE:=Wireless driver probe infrastructure
  25. MAINTAINER:=Felix Fietkau <[email protected]>
  26. FILES:= \
  27. $(PKG_BUILD_DIR)/kernel/wprobe.$(LINUX_KMOD_SUFFIX)
  28. AUTOLOAD:=$(call AutoLoad,01,wprobe)
  29. endef
  30. define KernelPackage/wprobe/description
  31. A module that exports measurement data from wireless driver to user space
  32. endef
  33. define Package/wprobe-util
  34. $(call Package/wprobe/Default)
  35. SECTION:=net
  36. CATEGORY:=Network
  37. DEPENDS+=+kmod-wprobe +libnl-tiny
  38. TITLE:=Wireless measurement utility
  39. endef
  40. define Package/wprobe-util/description
  41. wprobe-util uses the wprobe kernel module to query
  42. wireless driver measurement data from an interface
  43. endef
  44. define Package/wprobe-export
  45. $(call Package/wprobe/Default)
  46. SECTION:=net
  47. CATEGORY:=Network
  48. DEPENDS+=+wprobe-util
  49. TITLE:=Wireless measurement data exporter
  50. endef
  51. define Package/wprobe-export/description
  52. wprobe-export uses the wprobe kernel module to export
  53. wireless driver measurement data via the IPFIX protocol
  54. endef
  55. define Build/Prepare
  56. mkdir -p $(PKG_BUILD_DIR)
  57. $(CP) src/* $(PKG_BUILD_DIR)/
  58. endef
  59. TARGET_CPPFLAGS := \
  60. -D_GNU_SOURCE \
  61. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  62. $(TARGET_CPPFLAGS)
  63. ifdef CONFIG_PACKAGE_kmod-wprobe
  64. define Build/Compile/kmod
  65. $(MAKE) -C $(LINUX_DIR) \
  66. CROSS_COMPILE="$(KERNEL_CROSS)" \
  67. ARCH="$(LINUX_KARCH)" \
  68. SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
  69. KERNELDIR=$(LINUX_DIR) \
  70. CC="$(TARGET_CC)" \
  71. EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
  72. modules
  73. endef
  74. endif
  75. define Build/Compile/lib
  76. $(MAKE) -C $(PKG_BUILD_DIR)/user \
  77. $(TARGET_CONFIGURE_OPTS) \
  78. CFLAGS="$(TARGET_CFLAGS)" \
  79. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
  80. LDFLAGS="$(TARGET_LDFLAGS)" \
  81. HOST_OS=Linux \
  82. LIBNL="-lnl-tiny"
  83. endef
  84. ifdef CONFIG_PACKAGE_wprobe-export
  85. define Build/Compile/exporter
  86. $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
  87. $(TARGET_CONFIGURE_OPTS) \
  88. CFLAGS="$(TARGET_CFLAGS)" \
  89. CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
  90. LDFLAGS="$(TARGET_LDFLAGS)" \
  91. LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libmisc.a -lnl-tiny -lm"
  92. endef
  93. endif
  94. define Build/Compile
  95. $(Build/Compile/kmod)
  96. $(Build/Compile/lib)
  97. $(Build/Compile/exporter)
  98. endef
  99. define Build/InstallDev
  100. $(INSTALL_DIR) $(1)/usr/include/wprobe
  101. $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
  102. endef
  103. define Package/wprobe-util/install
  104. $(INSTALL_DIR) $(1)/sbin
  105. $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
  106. endef
  107. define Package/wprobe-export/install
  108. $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
  109. $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
  110. $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
  111. $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
  112. endef
  113. $(eval $(call KernelPackage,wprobe))
  114. $(eval $(call BuildPackage,wprobe-util))
  115. $(eval $(call BuildPackage,wprobe-export))