fix uclibc_target with devel headers
[buildroot.git] / package / busybox / busybox.mk
bloba931beddf434f75adf96cc294d1f83204ef890bc
1 #############################################################
3 # busybox
5 #############################################################
8 ifeq ($(BR2_PACKAGE_BUSYBOX_SNAPSHOT),y)
9 # Be aware that this changes daily....
10 BUSYBOX_DIR:=$(PROJECT_BUILD_DIR)/busybox
11 BUSYBOX_SOURCE:=busybox-snapshot.tar.bz2
12 BUSYBOX_SITE:=http://www.busybox.net/downloads/snapshots
13 else
14 BUSYBOX_VERSION=$(strip $(subst ",, $(BR2_BUSYBOX_VERSION)))
15 #"))
16 BUSYBOX_DIR:=$(PROJECT_BUILD_DIR)/busybox-$(BUSYBOX_VERSION)
17 BUSYBOX_SOURCE:=busybox-$(BUSYBOX_VERSION).tar.bz2
18 BUSYBOX_SITE:=http://www.busybox.net/downloads
19 endif
21 BUSYBOX_UNZIP=$(BZCAT)
23 ifndef BUSYBOX_CONFIG_FILE
24 BUSYBOX_CONFIG_FILE=$(subst ",, $(strip $(BR2_PACKAGE_BUSYBOX_CONFIG)))
25 #")
26 endif
28 $(DL_DIR)/$(BUSYBOX_SOURCE):
29 $(WGET) -P $(DL_DIR) $(BUSYBOX_SITE)/$(BUSYBOX_SOURCE)
31 $(BUSYBOX_DIR)/.unpacked: $(DL_DIR)/$(BUSYBOX_SOURCE)
32 $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(PROJECT_BUILD_DIR) $(TAR_OPTIONS) -
33 ifeq ($(BR2_PACKAGE_SYSKLOGD),y)
34 # if we have external syslogd, force busybox to use it
35 $(SED) "/#include.*busybox\.h/a#define CONFIG_SYSLOGD" $(BUSYBOX_DIR)/init/init.c
36 endif
37 # Allow busybox patches.
38 ifeq ($(BR2_PACKAGE_BUSYBOX_SNAPSHOT),y)
39 toolchain/patch-kernel.sh $(BUSYBOX_DIR) package/busybox busybox.\*.patch
40 else
41 toolchain/patch-kernel.sh $(BUSYBOX_DIR) package/busybox busybox-$(BUSYBOX_VERSION)-\*.patch
42 endif
43 touch $@
45 $(BUSYBOX_DIR)/.configured: $(BUSYBOX_DIR)/.unpacked $(BUSYBOX_CONFIG_FILE)
46 ifeq ($(BR2_USE_UPDATES),y)
47 (cd $(@D) && $(SVN_UP))
48 endif
49 cp -f $(BUSYBOX_CONFIG_FILE) $(BUSYBOX_DIR)/.config
50 $(SED) s,^CONFIG_PREFIX=.*,CONFIG_PREFIX=\"$(TARGET_DIR)\", \
51 $(BUSYBOX_DIR)/.config
52 ifeq ($(BR2_BUSYBOX_VERSION_1_0_1),y)
53 $(SED) "s,^CROSS.*,CROSS=$(TARGET_CROSS)\n\PREFIX=$(TARGET_DIR),;" \
54 $(BUSYBOX_DIR)/Rules.mak
55 endif
56 ifeq ($(BR2_BUSYBOX_VERSION_1_1_3),y)
57 $(SED) s,^PREFIX=.*,CONFIG_PREFIX=\"$(TARGET_DIR)\", \
58 $(BUSYBOX_DIR)/.config
59 endif
60 ifeq ($(BR2_BUSYBOX_VERSION_1_2_2_1),y)
61 $(SED) s,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX=\"$(TARGET_CROSS)\", \
62 $(BUSYBOX_DIR)/.config
63 $(SED) s,^PREFIX=.*,CROSS_COMPILER_PREFIX=\"$(TARGET_CROSS)\", \
64 $(BUSYBOX_DIR)/.config
65 endif
66 ifeq ($(BR2_PACKAGE_BUSYBOX_SNAPSHOT),y)
67 $(SED) s,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX=\"$(TARGET_CROSS)\", \
68 $(BUSYBOX_DIR)/.config
69 $(SED) s,^PREFIX=.*,CROSS_COMPILER_PREFIX=\"$(TARGET_CROSS)\", \
70 $(BUSYBOX_DIR)/.config
71 endif
72 ifeq ($(BR2_LARGEFILE),y)
73 $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=y/;" $(BUSYBOX_DIR)/.config
74 $(SED) "s/^.*CONFIG_FDISK_SUPPORT_LARGE_DISKS.*/CONFIG_FDISK_SUPPORT_LARGE_DISKS=y/;" $(BUSYBOX_DIR)/.config
75 else
76 $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=n/;" $(BUSYBOX_DIR)/.config
77 $(SED) "s/^.*FDISK_SUPPORT_LARGE_DISKS.*/CONFIG_FDISK_SUPPORT_LARGE_DISKS=n/;" $(BUSYBOX_DIR)/.config
78 endif
79 ifeq ($(BR2_INET_IPV6),y)
80 $(SED) "s/^.*CONFIG_FEATURE_IPV6.*/CONFIG_FEATURE_IPV6=y/;" $(BUSYBOX_DIR)/.config
81 else
82 $(SED) "s/^.*CONFIG_FEATURE_IPV6.*/CONFIG_FEATURE_IPV6=n/;" $(BUSYBOX_DIR)/.config
83 endif
84 ifeq ($(BR2_PACKAGE_BUSYBOX_SKELETON),y)
85 # force mdev on
86 $(SED) "s/^.*CONFIG_MDEV.*/CONFIG_MDEV=y/" $(BUSYBOX_DIR)/.config
87 endif
88 ifeq ($(BR2_PACKAGE_NETKITBASE),y)
89 # disable usage of inetd if netkit-base package is selected
90 $(SED) "s/^.*CONFIG_INETD.*/CONFIG_INETD=n/;" $(BUSYBOX_DIR)/.config
91 @echo "WARNING!! CONFIG_INETD option disabled!"
92 endif
93 ifeq ($(BR2_PACKAGE_NETKITTELNET),y)
94 # disable usage of telnetd if netkit-telnetd package is selected
95 $(SED) "s/^.*CONFIG_TELNETD.*/CONFIG_TELNETD=n/;" $(BUSYBOX_DIR)/.config
96 @echo "WARNING!! CONFIG_TELNETD option disabled!"
97 endif
98 yes "" | $(MAKE) CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
99 HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
100 CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_DIR) oldconfig
101 touch $@
104 $(BUSYBOX_DIR)/busybox: $(BUSYBOX_DIR)/.configured
105 $(MAKE) HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
106 CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
107 CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \
108 ARCH=$(KERNEL_ARCH) \
109 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_DIR)
110 ifeq ($(BR2_PREFER_IMA)$(BR2_PACKAGE_BUSYBOX_SNAPSHOT),yy)
111 rm -f $@
112 $(MAKE) HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
113 CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
114 CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \
115 ARCH=$(KERNEL_ARCH) STRIP="$(STRIPCMD)" \
116 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_DIR) \
117 -f scripts/Makefile.IMA
118 endif
120 $(TARGET_DIR)/bin/busybox: $(BUSYBOX_DIR)/busybox
121 ifeq ($(BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS),y)
122 $(MAKE) HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
123 CC=$(TARGET_CC) CROSS_COMPILE="$(TARGET_CROSS)" \
124 CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \
125 ARCH=$(KERNEL_ARCH) \
126 EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_DIR) install
127 else
128 install -D -m 0755 $(BUSYBOX_DIR)/busybox $(TARGET_DIR)/bin/busybox
129 endif
130 # Just in case
131 $(Q)if test -r $(TARGET_DIR)/usr/share/udhcpc/default.script; then \
132 chmod a+x $(TARGET_DIR)/usr/share/udhcpc/default.script; \
135 busybox: uclibc $(TARGET_DIR)/bin/busybox
137 busybox-source: $(DL_DIR)/$(BUSYBOX_SOURCE) $(BUSYBOX_CONFIG_FILE)
139 busybox-unpacked: $(BUSYBOX_DIR)/.unpacked
141 busybox-config: $(BUSYBOX_DIR)/.configured
143 busybox-menuconfig: host-sed $(PROJECT_BUILD_DIR) busybox-source $(BUSYBOX_DIR)/.configured
144 $(MAKE) __TARGET_ARCH=$(ARCH) HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
145 -C $(BUSYBOX_DIR) menuconfig
147 busybox-update:
148 cp -f $(BUSYBOX_DIR)/.config $(BUSYBOX_CONFIG_FILE)
150 busybox-clean:
151 -$(MAKE) -C $(BUSYBOX_DIR) clean
152 rm -f $(TARGET_DIR)/bin/busybox
154 busybox-dirclean:
155 rm -rf $(BUSYBOX_DIR)
156 #############################################################
158 # Toplevel Makefile options
160 #############################################################
161 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
162 TARGETS+=busybox
163 endif