nbd's makefile/menuconfig rewrite
[openwrt/openwrt.git] / openwrt / package / zlib / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME := zlib
4 PKG_VERSION := 1.2.2
5 PKG_RELEASE := 1
6
7 PKG_SOURCE_SITE := http://www.zlib.net/
8 PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz
9 PKG_SOURCE_CAT := zcat
10 PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
11 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
12 PKG_IPK := zlib_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
13
14
15 $(DL_DIR)/$(PKG_SOURCE_FILE):
16 mkdir -p $(DL_DIR)
17 $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE)
18
19 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
20 mkdir -p $(TOOL_BUILD_DIR)
21 $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
22 $(PATCH) $(PKG_BUILD_DIR) . $(PKG_NAME).patch
23 touch $(PKG_BUILD_DIR)/.patched
24
25 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
26 (cd $(PKG_BUILD_DIR); \
27 $(TARGET_CONFIGURE_OPTS) \
28 ./configure \
29 --prefix=/ \
30 --shared)
31 touch $(PKG_BUILD_DIR)/.configured
32
33 $(PKG_BUILD_DIR)/libz.so: $(PKG_BUILD_DIR)/.configured
34 $(MAKE) -C $(PKG_BUILD_DIR) \
35 $(TARGET_CONFIGURE_OPTS) \
36 CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_LARGEFILE)" \
37 libz.a libz.so
38
39 $(STAGING_DIR)/lib/libz.so: $(PKG_BUILD_DIR)/libz.so
40 $(MAKE) -C $(PKG_BUILD_DIR) \
41 DESTDIR="$(STAGING_DIR)" \
42 install
43
44 $(PACKAGE_DIR)/$(PKG_IPK): $(STAGING_DIR)/lib/libz.so
45 mkdir -p $(PACKAGE_DIR)
46 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BUILD_DIR)/ipkg/zlib zlib.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
47 mkdir -p $(PKG_BUILD_DIR)/ipkg/zlib/usr/lib
48 cp -a $(PKG_BUILD_DIR)/libz.so* $(PKG_BUILD_DIR)/ipkg/zlib/usr/lib
49 $(STRIP) $(PKG_BUILD_DIR)/ipkg/zlib/usr/lib/*
50 $(IPKG_BUILD) $(PKG_BUILD_DIR)/ipkg/zlib $(PACKAGE_DIR)
51
52
53 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
54 prepare: $(PKG_BUILD_DIR)/.patched
55 compile: $(STAGING_DIR)/lib/libz.so $(PACKAGE_DIR)/$(PKG_IPK)
56 install: $(PKG_ZLIB)
57 $(IPKG) install $(PACKAGE_DIR)/$(PKG_IPK)
58 clean:
59 rm -rf $(PKG_BUILD_DIR)
60 rm -f $(STAGING_DIR)/lib/libz* $(STAGING_DIR)/include/zlib*
61 rm -f $(PACKAGE_DIR)/zlib\*.ipk
62