tcpdump.mk 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #############################################################
  2. #
  3. # tcpdump
  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. TCPDUMP_VER:=3.8.3
  24. TCPDUMP_DIR:=$(BUILD_DIR)/tcpdump-$(TCPDUMP_VER)
  25. TCPDUMP_SITE:=http://www.tcpdump.org/release
  26. TCPDUMP_SOURCE:=tcpdump-$(TCPDUMP_VER).tar.gz
  27. TCPDUMP_CAT:=zcat
  28. $(DL_DIR)/$(TCPDUMP_SOURCE):
  29. $(WGET) -P $(DL_DIR) $(TCPDUMP_SITE)/$(TCPDUMP_SOURCE)
  30. tcpdump-source: $(DL_DIR)/$(TCPDUMP_SOURCE)
  31. $(TCPDUMP_DIR)/.unpacked: $(DL_DIR)/$(TCPDUMP_SOURCE)
  32. $(TCPDUMP_CAT) $(DL_DIR)/$(TCPDUMP_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
  33. touch $(TCPDUMP_DIR)/.unpacked
  34. $(TCPDUMP_DIR)/.configured: $(TCPDUMP_DIR)/.unpacked
  35. ( \
  36. cd $(TCPDUMP_DIR) ; \
  37. ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \
  38. BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \
  39. $(TARGET_CONFIGURE_OPTS) \
  40. CFLAGS="$(TARGET_CFLAGS)" \
  41. ./configure \
  42. --target=$(GNU_TARGET_NAME) \
  43. --host=$(GNU_TARGET_NAME) \
  44. --build=$(GNU_HOST_NAME) \
  45. --with-build-cc=$(HOSTCC) \
  46. --prefix=$(STAGING_DIR) \
  47. --libdir=$(STAGING_DIR)/lib \
  48. --includedir=$(STAGING_DIR)/include \
  49. )
  50. $(SED) '/HAVE_PCAP_DEBUG/d' $(TCPDUMP_DIR)/config.h
  51. touch $(TCPDUMP_DIR)/.configured
  52. $(TCPDUMP_DIR)/tcpdump: $(TCPDUMP_DIR)/.configured
  53. $(MAKE) \
  54. LDFLAGS="-L$(STAGING_DIR)/lib" \
  55. LIBS="-lpcap" \
  56. INCLS="-I. -I$(STAGING_DIR)/include" \
  57. -C $(TCPDUMP_DIR)
  58. $(TARGET_DIR)/sbin/tcpdump: $(TCPDUMP_DIR)/tcpdump
  59. cp -af $< $@
  60. tcpdump: uclibc zlib libpcap $(TARGET_DIR)/sbin/tcpdump
  61. tcpdump-clean:
  62. rm -f $(TARGET_DIR)/sbin/tcpdump
  63. -$(MAKE) -C $(TCPDUMP_DIR) clean
  64. tcpdump-dirclean:
  65. rm -rf $(TCPDUMP_DIR)
  66. #############################################################
  67. #
  68. # Toplevel Makefile options
  69. #
  70. #############################################################
  71. ifeq ($(strip $(BR2_PACKAGE_TCPDUMP)),y)
  72. TARGETS+=tcpdump
  73. endif