| 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 | |
|---|
| 24 | LIBPCAP_VER:=0.9.4 |
|---|
| 25 | LIBPCAP_DIR:=$(BUILD_DIR)/libpcap-$(LIBPCAP_VER) |
|---|
| 26 | LIBPCAP_SITE:=http://www.tcpdump.org/release |
|---|
| 27 | LIBPCAP_SOURCE:=libpcap-$(LIBPCAP_VER).tar.gz |
|---|
| 28 | LIBPCAP_CAT:=zcat |
|---|
| 29 | |
|---|
| 30 | $(DL_DIR)/$(LIBPCAP_SOURCE): |
|---|
| 31 | $(WGET) -P $(DL_DIR) $(LIBPCAP_SITE)/$(LIBPCAP_SOURCE) |
|---|
| 32 | |
|---|
| 33 | # We don't need any destdir for this. |
|---|
| 34 | # I'll keep it for now anyway. |
|---|
| 35 | LIBPCAP_DESTDIR=$(PACKAGES_DIR)/tcpdump |
|---|
| 36 | |
|---|
| 37 | libpcap-source: $(DL_DIR)/$(LIBPCAP_SOURCE) |
|---|
| 38 | |
|---|
| 39 | $(LIBPCAP_DIR)/.unpacked: $(DL_DIR)/$(LIBPCAP_SOURCE) |
|---|
| 40 | $(LIBPCAP_CAT) $(DL_DIR)/$(LIBPCAP_SOURCE) | tar -C $(BUILD_DIR) -xf - |
|---|
| 41 | # toolchain/patch-kernel.sh $(LIBPCAP_DIR) package/libpcap/ *.patch |
|---|
| 42 | touch $(LIBPCAP_DIR)/.unpacked |
|---|
| 43 | |
|---|
| 44 | $(LIBPCAP_DIR)/.configured: $(LIBPCAP_DIR)/.unpacked |
|---|
| 45 | ( \ |
|---|
| 46 | cd $(LIBPCAP_DIR) ; \ |
|---|
| 47 | ac_cv_linux_vers=$(LINUX_VERSION) \ |
|---|
| 48 | BUILD_CC=$(TARGET_CC) HOSTCC="$(HOSTCC)" \ |
|---|
| 49 | $(TARGET_CONFIGURE_OPTS) \ |
|---|
| 50 | CFLAGS="$(TARGET_CFLAGS)" \ |
|---|
| 51 | ./configure \ |
|---|
| 52 | --build=$(GNU_HOST_NAME) \ |
|---|
| 53 | --with-build-cc="$(HOSTCC)" \ |
|---|
| 54 | --disable-yydebug \ |
|---|
| 55 | --prefix=/usr \ |
|---|
| 56 | --with-pcap=linux \ |
|---|
| 57 | ) |
|---|
| 58 | $(SED) "s/sed -e/perl -p -e/" $(LIBPCAP_DIR)/Makefile |
|---|
| 59 | $(SED) "s/-O2//" $(LIBPCAP_DIR)/Makefile |
|---|
| 60 | touch $(LIBPCAP_DIR)/.configured |
|---|
| 61 | |
|---|
| 62 | $(LIBPCAP_DIR)/libpcap.a: $(LIBPCAP_DIR)/.configured |
|---|
| 63 | $(MAKE) \ |
|---|
| 64 | CC="$(TARGET_CC)" \ |
|---|
| 65 | AR="$(TARGET_CROSS)ar" \ |
|---|
| 66 | -C $(LIBPCAP_DIR) |
|---|
| 67 | |
|---|
| 68 | # The observant reader will find this not in use. |
|---|
| 69 | $(LIBPCAP_DESTDIR)/usr/lib/libpcap.a: $(LIBPCAP_DIR)/libpcap.a |
|---|
| 70 | mkdir -p $(LIBPCAP_DESTDIR) |
|---|
| 71 | $(MAKE) \ |
|---|
| 72 | -C $(LIBPCAP_DIR) \ |
|---|
| 73 | DESTDIR=$(LIBPCAP_DESTDIR) \ |
|---|
| 74 | install |
|---|
| 75 | rm -rf $(LIBPCAP_DESTDIR)/usr/man |
|---|
| 76 | |
|---|
| 77 | libpcap: uclibc $(LIBPCAP_DIR)/libpcap.a |
|---|
| 78 | |
|---|
| 79 | libpcap-clean: |
|---|
| 80 | rm -f $(LIBPCAP_DESTDIR)/include/pcap*.h $(LIBPCAP_DESTDIR)/lib/libpcap.a |
|---|
| 81 | -$(MAKE) -C $(LIBPCAP_DIR) clean |
|---|
| 82 | |
|---|
| 83 | libpcap-dirclean: |
|---|
| 84 | rm -rf $(LIBPCAP_DIR) |
|---|
| 85 | ############################################################# |
|---|
| 86 | # |
|---|
| 87 | # Toplevel Makefile options |
|---|
| 88 | # |
|---|
| 89 | ############################################################# |
|---|
| 90 | ifeq ($(strip $(BR2_PACKAGE_LIBPCAP)),y) |
|---|
| 91 | TARGETS+=libpcap |
|---|
| 92 | endif |
|---|