Makefile 3.7 KB

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