package busybox
[openwrt.git] / package / busybox / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=busybox
6 PKG_RELEASE:=1
7
8 ifeq ($(strip $(BR2_PACKAGE_BUSYBOX_SNAPSHOT)),y)
9 # Be aware that this changes daily....
10 PKG_VERSION:=0.${shell date +"%G%m%d"}
11 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
12 PKG_SOURCE:=$(PKG_NAME)-.tar.bz2
13 PKG_SOURCE_URL:=http://www.busybox.net/downloads/snapshots
14 PKG_MD5SUM:=5c7ea9b5d3b3677dfcdcec38b281a756
15 else
16 PKG_VERSION:=1.00
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
19 PKG_SOURCE_URL:=http://www.busybox.net/downloads
20 PKG_MD5SUM:=5c7ea9b5d3b3677dfcdcec38b281a756
21 endif
22
23 PKG_CAT:=bzcat
24 PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
25 PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
26
27 $(DL_DIR)/$(PKG_SOURCE):
28         $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
29
30 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE)
31         $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
32         $(PATCH) $(PKG_BUILD_DIR) ./patches
33         touch $(PKG_BUILD_DIR)/.patched
34
35 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
36         $(SCRIPT_DIR)/gen_busybox_config.pl $(TOPDIR)/.config > $(PKG_BUILD_DIR)/.config
37         $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" -C $(PKG_BUILD_DIR) oldconfig
38         touch $(PKG_BUILD_DIR)/.configured
39
40 $(PKG_BUILD_DIR)/$(PKG_NAME): $(PKG_BUILD_DIR)/.configured
41         $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" PREFIX="$(PKG_IPK_DIR)" \
42                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(PKG_BUILD_DIR)
43
44 $(PKG_IPK): $(PKG_BUILD_DIR)/$(PKG_NAME)
45         $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
46         $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" PREFIX="$(PKG_IPK_DIR)" \
47                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(PKG_BUILD_DIR) install
48         $(STRIP) $(PKG_IPK_DIR)/bin/busybox
49         -chmod a+x $(PKG_IPK_DIR)/usr/share/udhcpc/default.script
50         mkdir -p $(PACKAGE_DIR)
51         $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
52
53 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
54         $(IPKG) install $(PKG_IPK)
55
56 source: $(DL_DIR)/$(PKG_SOURCE)
57 prepare: $(PKG_BUILD_DIR)/.patched
58 compile: $(PKG_IPK)
59 install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list
60
61 clean:
62         rm -rf $(PKG_BUILD_DIR)
63         rm -f $(PKG_IPK)