build openwrt tools
[openwrt.git] / openwrt / package / busybox / busybox.mk
1 #############################################################
2 #
3 # busybox
4 #
5 #############################################################
6
7 ifeq ($(strip $(BR2_PACKAGE_BUSYBOX_SNAPSHOT)),y)
8 # Be aware that this changes daily....
9 BUSYBOX_DIR:=$(BUILD_DIR)/busybox
10 BUSYBOX_SOURCE:=busybox-snapshot.tar.bz2
11 BUSYBOX_SITE:=http://www.busybox.net/downloads/snapshots
12 else
13 BUSYBOX_VER:=1.00
14 BUSYBOX_DIR:=$(BUILD_DIR)/busybox-$(BUSYBOX_VER)
15 BUSYBOX_SOURCE:=busybox-$(BUSYBOX_VER).tar.bz2
16 BUSYBOX_SITE:=http://www.busybox.net/downloads
17 endif
18 BUSYBOX_UNZIP=bzcat
19 BUSYBOX_CONFIG:=package/busybox/busybox.config
20
21 $(DL_DIR)/$(BUSYBOX_SOURCE):
22 $(WGET) -P $(DL_DIR) $(BUSYBOX_SITE)/$(BUSYBOX_SOURCE)
23
24 busybox-source: $(DL_DIR)/$(BUSYBOX_SOURCE) $(BUSYBOX_CONFIG)
25
26 $(BUSYBOX_DIR)/.unpacked: $(DL_DIR)/$(BUSYBOX_SOURCE)
27 $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
28 # Allow busybox patches.
29 toolchain/patch-kernel.sh $(BUSYBOX_DIR) package/busybox/patches
30 touch $(BUSYBOX_DIR)/.unpacked
31
32 $(BUSYBOX_DIR)/.configured: $(BUSYBOX_DIR)/.unpacked $(BUSYBOX_CONFIG)
33 cp $(BUSYBOX_CONFIG) $(BUSYBOX_DIR)/.config
34 $(SED) "s,^CROSS.*,CROSS=$(TARGET_CROSS)\n\
35 PREFIX=$(TARGET_DIR),;" $(BUSYBOX_DIR)/Rules.mak
36 ifeq ($(BR2_LARGEFILE),y)
37 $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=y/;" $(BUSYBOX_DIR)/.config
38 else
39 $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=n/;" $(BUSYBOX_DIR)/.config
40 $(SED) "s/^.*FDISK_SUPPORT_LARGE_DISKS.*/FDISK_SUPPORT_LARGE_DISKS=n/;" $(BUSYBOX_DIR)/.config
41 endif
42 $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_DIR) oldconfig
43 touch $(BUSYBOX_DIR)/.configured
44
45 $(BUSYBOX_DIR)/busybox: $(BUSYBOX_DIR)/.configured
46 $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \
47 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_DIR)
48
49 $(TARGET_DIR)/bin/busybox: $(BUSYBOX_DIR)/busybox
50 $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \
51 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_DIR) install
52 # Just in case
53 -chmod a+x $(TARGET_DIR)/usr/share/udhcpc/default.script
54
55 busybox: uclibc $(TARGET_DIR)/bin/busybox
56
57 busybox-clean:
58 rm -f $(TARGET_DIR)/bin/busybox
59 -$(MAKE) -C $(BUSYBOX_DIR) clean
60
61 busybox-dirclean:
62 rm -rf $(BUSYBOX_DIR)
63
64 #############################################################
65 #
66 # Toplevel Makefile options
67 #
68 #############################################################
69 ifeq ($(strip $(BR2_PACKAGE_BUSYBOX)),y)
70 TARGETS+=busybox
71 endif
This page took 0.046712 seconds and 5 git commands to generate.