cb6e29e04d39e172282f4596fc9eb061b4a71596
[openwrt.git] / package / libnet / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=libnet
6 PKG_VERSION:=1.0.2a
7 PKG_RELEASE:=7
8 PKG_MD5SUM:=ddf53f0f484184390e8c2a1bd0853667
9
10 PKG_SOURCE_URL:=http://www.packetfactory.net/libnet/dist/deprecated/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/Libnet-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 include $(TOPDIR)/package/rules.mk
18
19 ENDIAN:=lil
20 ifeq ($(ARCH),mips)
21 ENDIAN:=big
22 endif
23
24 $(eval $(call PKG_template,LIBNET,libnet,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
25
26 $(PKG_BUILD_DIR)/.configured:
27         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
28                 touch configure.in; \
29                 touch include.m4; \
30                 touch aclocal.m4; \
31                 touch Makefile.in; \
32                 touch configure; \
33                 $(TARGET_CONFIGURE_OPTS) \
34                 CFLAGS="$(TARGET_CFLAGS)" \
35                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
36                 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
37                 ac_libnet_have_pf_packet=yes \
38                 ac_cv_lbl_unaligned_fail=no \
39                 ac_cv_libnet_endianess=$(ENDIAN) \
40                 ./configure \
41                 --target=$(GNU_TARGET_NAME) \
42                 --host=$(GNU_TARGET_NAME) \
43                 --build=$(GNU_HOST_NAME) \
44                 --program-prefix="" \
45                 --program-suffix="" \
46                 --prefix=/usr \
47                 --exec-prefix=/usr \
48                 --bindir=/usr/bin \
49                 --datadir=/usr/share \
50                 --includedir=/usr/include \
51                 --infodir=/usr/share/info \
52                 --libdir=/usr/lib \
53                 --libexecdir=/usr/lib \
54                 --localstatedir=/var \
55                 --mandir=/usr/share/man \
56                 --sbindir=/usr/sbin \
57                 --sysconfdir=/etc \
58                 $(DISABLE_NLS) \
59                 $(DISABLE_LARGEFILE) \
60                 --enable-shared \
61                 --enable-static \
62                 --with-pf_packet=yes \
63         );
64         touch $@
65
66 $(PKG_BUILD_DIR)/.built:
67         rm -rf $(PKG_INSTALL_DIR)
68         mkdir -p $(PKG_INSTALL_DIR)
69         $(MAKE) -C $(PKG_BUILD_DIR) \
70                 $(TARGET_CONFIGURE_OPTS) \
71                 CFLAGS="$(TARGET_CFLAGS)" \
72                 DESTDIR="$(PKG_INSTALL_DIR)" \
73                 all install
74         touch $@
75
76 $(IPKG_LIBNET):
77         install -m0755 -d $(IDIR_LIBNET)/usr/lib
78         cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(IDIR_LIBNET)/usr/lib/
79         $(RSTRIP) $(IDIR_LIBNET)
80         $(IPKG_BUILD) $(IDIR_LIBNET) $(PACKAGE_DIR)
81
82 $(STAGING_DIR)/usr/lib/libnet.so: $(PKG_BUILD_DIR)/.built
83         mkdir -p $(STAGING_DIR)/usr/bin
84         cp -fpR $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(STAGING_DIR)/usr/bin/
85         mkdir -p $(STAGING_DIR)/usr/include
86         cp -fpR $(PKG_INSTALL_DIR)/usr/include/libnet* $(STAGING_DIR)/usr/include/
87         mkdir -p $(STAGING_DIR)/usr/lib
88         cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(STAGING_DIR)/usr/lib/
89         touch $@
90
91 install-dev: $(STAGING_DIR)/usr/lib/libnet.so
92
93 uninstall-dev:
94         rm -rf \
95                 $(STAGING_DIR)/usr/bin/libnet-config \
96                 $(STAGING_DIR)/usr/include/libnet*  \
97                 $(STAGING_DIR)/usr/lib/libnet.{a,so*} \
98
99 compile-targets: install-dev
100 clean-targets: uninstall-dev