Uniformize package Makefile
[openwrt.git] / package / libpcap / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=libpcap
6 PKG_VERSION:=0.8.3
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=56a9d4615d8354fcfe8cff8c8443c77b
9
10 PKG_SOURCE_URL:= \
11 http://www.tcpdump.org/release \
12 http://nthill.free.fr/openwrt/sources/$(PKG_NAME)/
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
14 PKG_CAT:=zcat
15
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
17
18 IPKG_LIBPCAP:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
19 IDIR_LIBPCAP:=$(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)
20 INFO_LIBPCAP:=$(IPKG_STATE_DIR)/info/$(PKG_NAME).list
21
22 $(DL_DIR)/$(PKG_SOURCE):
23 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
24
25 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
26 mkdir -p $(BUILD_DIR)/$(PKG_NAME)
27 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR)/$(PKG_NAME) $(TAR_OPTIONS) -
28 $(PATCH) $(PKG_BUILD_DIR) ./patches
29 touch $(PKG_BUILD_DIR)/.prepared
30
31 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
32 (cd $(PKG_BUILD_DIR); rm -rf config.cache config.status; \
33 $(TARGET_CONFIGURE_OPTS) \
34 CFLAGS="$(TARGET_CFLAGS)" \
35 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
36 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
37 ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \
38 ./configure \
39 --target=$(GNU_TARGET_NAME) \
40 --host=$(GNU_TARGET_NAME) \
41 --build=$(GNU_HOST_NAME) \
42 --program-prefix="" \
43 --program-suffix="" \
44 --prefix=/usr \
45 --exec-prefix=/usr \
46 --bindir=/usr/bin \
47 --datadir=/usr/share \
48 --includedir=/usr/include \
49 --infodir=/usr/share/info \
50 --libdir=/usr/lib \
51 --libexecdir=/usr/lib \
52 --localstatedir=/var \
53 --mandir=/usr/share/man \
54 --sbindir=/usr/sbin \
55 --sysconfdir=/etc \
56 $(DISABLE_NLS) \
57 $(DISABLE_LARGEFILE) \
58 --enable-shared \
59 --enable-static \
60 --disable-yydebug \
61 --with-build-cc=$(HOSTCC) \
62 --with-pcap=linux \
63 );
64 touch $(PKG_BUILD_DIR)/.configured
65
66 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
67 $(MAKE) -C $(PKG_BUILD_DIR) \
68 CCOPT="$(TARGET_CFLAGS)"
69 touch $(PKG_BUILD_DIR)/.built
70
71 $(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built
72 $(MAKE) -C $(PKG_BUILD_DIR) \
73 DESTDIR="$(STAGING_DIR)" \
74 install
75
76 $(IPKG_LIBPCAP): $(STAGING_DIR)/usr/lib/libpcap.so
77 $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_LIBPCAP) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
78 mkdir -p $(IDIR_LIBPCAP)/usr/lib
79 cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/
80 $(STRIP) $(IDIR_LIBPCAP)/usr/lib/lib*.so*
81 mkdir -p $(PACKAGE_DIR)
82 $(IPKG_BUILD) $(IDIR_LIBPCAP) $(PACKAGE_DIR)
83
84 $(INFO_LIBPCAP): $(IPKG_LIBPCAP)
85 $(IPKG) install $(IPKG_LIBPCAP)
86
87 source: $(DL_DIR)/$(PKG_SOURCE)
88 prepare: $(PKG_BUILD_DIR)/.prepared
89 compile: $(IPKG_LIBPCAP)
90 install: $(INFO_LIBPCAP)
91
92 clean:
93 -$(MAKE) -C $(PKG_BUILD_DIR) \
94 DESTDIR="$(STAGING_DIR)" \
95 uninstall
96 rm -rf $(PKG_BUILD_DIR) $(IPKG_LIBPCAP)
This page took 0.04069 seconds and 5 git commands to generate.