libpcap.mk 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #############################################################
  2. #
  3. # libpcap
  4. #
  5. #############################################################
  6. # Copyright (C) 2001-2003 by Erik Andersen <andersen@codepoet.org>
  7. # Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU Library General Public License as
  11. # published by the Free Software Foundation; either version 2 of the
  12. # License, or (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful, but
  15. # WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. # Library General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Library General Public
  20. # License along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  22. # USA
  23. LIBPCAP_VER:=0.8.3
  24. LIBPCAP_DIR:=$(BUILD_DIR)/libpcap-$(LIBPCAP_VER)
  25. LIBPCAP_SITE:=http://www.tcpdump.org/release
  26. LIBPCAP_SOURCE:=libpcap-$(LIBPCAP_VER).tar.gz
  27. LIBPCAP_CAT:=zcat
  28. $(DL_DIR)/$(LIBPCAP_SOURCE):
  29. $(WGET) -P $(DL_DIR) $(LIBPCAP_SITE)/$(LIBPCAP_SOURCE)
  30. libpcap-source: $(DL_DIR)/$(LIBPCAP_SOURCE)
  31. $(LIBPCAP_DIR)/.unpacked: $(DL_DIR)/$(LIBPCAP_SOURCE)
  32. $(LIBPCAP_CAT) $(DL_DIR)/$(LIBPCAP_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
  33. toolchain/patch-kernel.sh $(LIBPCAP_DIR) package/libpcap/ *.patch
  34. touch $(LIBPCAP_DIR)/.unpacked
  35. $(LIBPCAP_DIR)/.configured: $(LIBPCAP_DIR)/.unpacked
  36. ( \
  37. cd $(LIBPCAP_DIR) ; \
  38. ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \
  39. BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \
  40. $(TARGET_CONFIGURE_OPTS) \
  41. CFLAGS="$(TARGET_CFLAGS)" \
  42. ./configure \
  43. --target=$(GNU_TARGET_NAME) \
  44. --host=$(GNU_TARGET_NAME) \
  45. --build=$(GNU_HOST_NAME) \
  46. --with-build-cc=$(HOSTCC) \
  47. --disable-yydebug \
  48. --prefix=/usr \
  49. --with-pcap=linux \
  50. )
  51. touch $(LIBPCAP_DIR)/.configured
  52. $(LIBPCAP_DIR)/libpcap.a: $(LIBPCAP_DIR)/.configured
  53. $(MAKE) \
  54. AR="$(TARGET_CROSS)ar" \
  55. -C $(LIBPCAP_DIR)
  56. $(STAGING_DIR)/lib/libpcap.a: $(LIBPCAP_DIR)/libpcap.a
  57. $(MAKE) \
  58. -C $(LIBPCAP_DIR) \
  59. prefix=$(STAGING_DIR) \
  60. exec_prefix=$(STAGING_DIR) \
  61. bindir=$(STAGING_DIR)/bin \
  62. datadir=$(STAGING_DIR)/share \
  63. install
  64. libpcap: uclibc zlib $(STAGING_DIR)/lib/libpcap.a
  65. libpcap-clean:
  66. rm -f $(STAGING_DIR)/include/pcap*.h $(STAGING_DIR)/lib/libpcap.a
  67. -$(MAKE) -C $(LIBPCAP_DIR) clean
  68. libpcap-dirclean:
  69. rm -rf $(LIBPCAP_DIR)
  70. #############################################################
  71. #
  72. # Toplevel Makefile options
  73. #
  74. #############################################################
  75. ifeq ($(strip $(BR2_PACKAGE_LIBPCAP)),y)
  76. TARGETS+=libpcap
  77. endif