add tcpdump
[openwrt/svn-archive/archive.git] / openwrt / package / tcpdump / Makefile
1 #############################################################
2 #
3 # ebtables
4 #
5 #############################################################
6 include $(TOPDIR)/rules.mk
7
8 PKG_NAME:=tcpdump
9 PKG_VERSION:=3.8.3
10 PKG_RELEASE:=1
11 PKG_SOURCE_URL:=http://www.tcpdump.org/release
12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
13 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
14 PKG_CAT:=zcat
15 PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
16 PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
17
18 $(DL_DIR)/$(PKG_SOURCE):
19 $(WGET) -P $(DL_DIR) $(PKG_SOURCE_URL)/$(PKG_SOURCE)
20
21 $(PKG_BUILD_DIR)/.unpacked: $(DL_DIR)/$(PKG_SOURCE)
22 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
23 touch $(PKG_BUILD_DIR)/.unpacked
24
25 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.unpacked
26 (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
27 ac_cv_linux_vers=$(LINUX_VERSION) \
28 BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \
29 $(TARGET_CONFIGURE_OPTS) \
30 CFLAGS="$(TARGET_CFLAGS)" \
31 ./configure \
32 --target=$(GNU_TARGET_NAME) \
33 --host=$(GNU_TARGET_NAME) \
34 --build=$(GNU_HOST_NAME) \
35 --with-build-cc=$(HOSTCC) \
36 --prefix=$(STAGING_DIR) \
37 --libdir=$(STAGING_DIR)/lib \
38 --includedir=$(STAGING_DIR)/include \
39 );
40 touch $(PKG_BUILD_DIR)/.configured
41
42 $(PKG_BUILD_DIR)/$(PKG_NAME): $(PKG_BUILD_DIR)/.configured
43 $(MAKE) \
44 LDFLAGS="-L$(STAGING_DIR)/lib" \
45 LIBS="-lpcap" \
46 INCLS="-I. -I$(STAGING_DIR)/include" \
47 -C $(PKG_BUILD_DIR)
48
49 $(PKG_IPK): $(PKG_BUILD_DIR)/$(PKG_NAME)
50 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
51 mkdir -p $(PKG_IPK_DIR)/usr/sbin
52 cp $(PKG_BUILD_DIR)/$(PKG_NAME) $(PKG_IPK_DIR)/usr/sbin/
53 $(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
54 mkdir -p $(PACKAGE_DIR)
55 $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
56
57 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
58 $(IPKG) install $(PKG_IPK)
59
60 source: $(DL_DIR)/$(PKG_SOURCE)
61 prepare: $(PKG_BUILD_DIR)/.unpacked
62 compile: $(PKG_IPK)
63 install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list
64
65 clean:
66 rm -rf $(PKG_BUILD_DIR)
67 rm -f $(PKG_IPK)