Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 2 | BB_PATH := $(LOCAL_PATH) |
Koushik Dutta | 129a798 | 2011-11-16 18:27:02 -0800 | [diff] [blame] | 3 | |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 4 | # Bionic Branches Switches (CM7/AOSP/ICS) |
| 5 | BIONIC_ICS := true |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 6 | |
Tanguy Pruvot | 29d8ebe | 2011-10-29 15:15:34 +0200 | [diff] [blame] | 7 | |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 8 | # Make a static library for regex. |
| 9 | include $(CLEAR_VARS) |
| 10 | LOCAL_SRC_FILES := android/regex/regex.c |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 11 | LOCAL_C_INCLUDES := $(BB_PATH)/android/regex |
Tanguy Pruvot | 6fef6a3 | 2012-05-05 15:26:43 +0200 | [diff] [blame] | 12 | LOCAL_CFLAGS := -Wno-sign-compare |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 13 | LOCAL_MODULE := libclearsilverregex |
| 14 | include $(BUILD_STATIC_LIBRARY) |
| 15 | |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 16 | # Make a static library for RPC library (coming from uClibc). |
| 17 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 18 | LOCAL_SRC_FILES := $(shell cat $(BB_PATH)/android/librpc.sources) |
| 19 | LOCAL_C_INCLUDES := $(BB_PATH)/android/librpc |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 20 | LOCAL_MODULE := libuclibcrpc |
Evan McClain | 6e205db | 2012-11-15 22:26:23 -0500 | [diff] [blame] | 21 | LOCAL_CFLAGS += -fno-strict-aliasing |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 22 | include $(BUILD_STATIC_LIBRARY) |
| 23 | |
Tanguy Pruvot | 29d8ebe | 2011-10-29 15:15:34 +0200 | [diff] [blame] | 24 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 25 | LOCAL_PATH := $(BB_PATH) |
| 26 | include $(CLEAR_VARS) |
| 27 | |
| 28 | # Each profile require a compressed usage/config, outside the source tree for git history |
| 29 | # We keep the uncompressed headers in local include-<profile> to track config changes. |
Tanguy Pruvot | 5ebcd53 | 2012-05-09 15:37:25 +0200 | [diff] [blame] | 30 | # TODO: generate includes in out/ |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 31 | |
Tanguy Pruvot | 5ebcd53 | 2012-05-09 15:37:25 +0200 | [diff] [blame] | 32 | # BB_INCLUDES_OUT := $(TARGET_OUT_INTERMEDIATES)/include |
| 33 | # $(BB_INCLUDES_OUT): |
| 34 | # mkdir -p $(ANDROID_BUILD_TOP)/$(BB_INCLUDES_OUT) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 35 | |
Tanguy Pruvot | 5ebcd53 | 2012-05-09 15:37:25 +0200 | [diff] [blame] | 36 | # Execute make clean, make prepare and copy profiles required for normal & static lib (recovery) |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 37 | |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 38 | KERNEL_MODULES_DIR ?= /system/lib/modules |
| 39 | BUSYBOX_CONFIG := minimal full |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 40 | $(BUSYBOX_CONFIG): |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 41 | @echo -e ${CL_PFX}"prepare config for busybox $@ profile"${CL_RST} |
| 42 | @cd $(BB_PATH) && make clean |
| 43 | @cd $(BB_PATH) && git clean -f -- ./include-$@/ |
| 44 | cp $(BB_PATH)/.config-$@ $(BB_PATH)/.config |
| 45 | cd $(BB_PATH) && make prepare |
| 46 | @#cp $(BB_PATH)/.config $(BB_PATH)/.config-$@ |
| 47 | @mkdir -p $(BB_PATH)/include-$@ |
| 48 | cp $(BB_PATH)/include/*.h $(BB_PATH)/include-$@/ |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 49 | @rm $(BB_PATH)/include/usage_compressed.h |
| 50 | @rm $(BB_PATH)/include/autoconf.h |
| 51 | @rm -f $(BB_PATH)/.config-old |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 52 | |
| 53 | busybox_prepare: $(BUSYBOX_CONFIG) |
| 54 | LOCAL_MODULE := busybox_prepare |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 55 | LOCAL_MODULE_TAGS := eng debug |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 56 | include $(BUILD_STATIC_LIBRARY) |
| 57 | |
| 58 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 59 | LOCAL_PATH := $(BB_PATH) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 60 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 61 | |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 62 | KERNEL_MODULES_DIR ?= /system/lib/modules |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 63 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 64 | SUBMAKE := make -s -C $(BB_PATH) CC=$(CC) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 65 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 66 | BUSYBOX_SRC_FILES = $(shell cat $(BB_PATH)/busybox-$(BUSYBOX_CONFIG).sources) \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 67 | libbb/android.c |
| 68 | |
| 69 | ifeq ($(TARGET_ARCH),arm) |
| 70 | BUSYBOX_SRC_FILES += \ |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 71 | android/libc/arch-arm/syscalls/adjtimex.S \ |
| 72 | android/libc/arch-arm/syscalls/getsid.S \ |
| 73 | android/libc/arch-arm/syscalls/stime.S \ |
| 74 | android/libc/arch-arm/syscalls/swapon.S \ |
| 75 | android/libc/arch-arm/syscalls/swapoff.S \ |
| 76 | android/libc/arch-arm/syscalls/sysinfo.S |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 77 | endif |
| 78 | |
Rocky Zhang | 8f997da | 2011-10-03 21:11:37 +0800 | [diff] [blame] | 79 | ifeq ($(TARGET_ARCH),mips) |
| 80 | BUSYBOX_SRC_FILES += \ |
| 81 | android/libc/arch-mips/syscalls/adjtimex.S \ |
| 82 | android/libc/arch-mips/syscalls/getsid.S \ |
| 83 | android/libc/arch-mips/syscalls/stime.S \ |
| 84 | android/libc/arch-mips/syscalls/swapon.S \ |
| 85 | android/libc/arch-mips/syscalls/swapoff.S \ |
| 86 | android/libc/arch-mips/syscalls/sysinfo.S |
| 87 | endif |
| 88 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 89 | BUSYBOX_C_INCLUDES = \ |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 90 | $(BB_PATH)/include-$(BUSYBOX_CONFIG) \ |
| 91 | $(BB_PATH)/include $(BB_PATH)/libbb \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 92 | bionic/libc/private \ |
| 93 | bionic/libm/include \ |
| 94 | bionic/libm \ |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 95 | libc/kernel/common \ |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 96 | $(BB_PATH)/android/regex \ |
| 97 | $(BB_PATH)/android/librpc |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 98 | |
| 99 | BUSYBOX_CFLAGS = \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 100 | -Werror=implicit \ |
| 101 | -DNDEBUG \ |
Tanguy Pruvot | c81b2cf | 2011-07-04 10:18:25 +0200 | [diff] [blame] | 102 | -DANDROID \ |
Evan McClain | 6e205db | 2012-11-15 22:26:23 -0500 | [diff] [blame] | 103 | -fno-strict-aliasing \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 104 | -include include-$(BUSYBOX_CONFIG)/autoconf.h \ |
| 105 | -D'CONFIG_DEFAULT_MODULES_DIR="$(KERNEL_MODULES_DIR)"' \ |
| 106 | -D'BB_VER="$(strip $(shell $(SUBMAKE) kernelversion)) $(BUSYBOX_SUFFIX)"' -DBB_BT=AUTOCONF_TIMESTAMP |
| 107 | |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 108 | # to handle differences in ICS (ipv6) |
| 109 | ifeq ($(BIONIC_ICS),true) |
| 110 | BUSYBOX_CFLAGS += -DBIONIC_ICS |
| 111 | endif |
Tanguy Pruvot | 64baaf5 | 2011-07-04 09:41:45 +0200 | [diff] [blame] | 112 | |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 113 | |
| 114 | # Build the static lib for the recovery tool |
| 115 | |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 116 | BUSYBOX_CONFIG:=minimal |
| 117 | BUSYBOX_SUFFIX:=static |
| 118 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 119 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 120 | LOCAL_CFLAGS := -Dmain=busybox_driver $(BUSYBOX_CFLAGS) |
| 121 | LOCAL_CFLAGS += \ |
| 122 | -Dgetusershell=busybox_getusershell \ |
| 123 | -Dsetusershell=busybox_setusershell \ |
| 124 | -Dendusershell=busybox_endusershell \ |
| 125 | -Dttyname_r=busybox_ttyname_r \ |
| 126 | -Dgetmntent=busybox_getmntent \ |
| 127 | -Dgetmntent_r=busybox_getmntent_r \ |
| 128 | -Dgenerate_uuid=busybox_generate_uuid |
| 129 | LOCAL_MODULE := libbusybox |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 130 | LOCAL_MODULE_TAGS := eng debug |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 131 | LOCAL_STATIC_LIBRARIES := libcutils libc libm |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 132 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 133 | include $(BUILD_STATIC_LIBRARY) |
| 134 | |
| 135 | |
| 136 | # Bionic Busybox /system/xbin |
| 137 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 138 | LOCAL_PATH := $(BB_PATH) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 139 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 140 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 141 | BUSYBOX_CONFIG:=full |
| 142 | BUSYBOX_SUFFIX:=bionic |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 143 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 144 | ifeq ($(BIONIC_ICS),true) |
| 145 | LOCAL_SRC_FILES += android/libc/__set_errno.c |
| 146 | endif |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 147 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 148 | LOCAL_CFLAGS := $(BUSYBOX_CFLAGS) |
Steven Luo | ececd8c | 2013-07-31 13:16:07 -0700 | [diff] [blame^] | 149 | LOCAL_LDFLAGS += -Wl,--no-fatal-warnings |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 150 | LOCAL_MODULE := busybox |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 151 | LOCAL_MODULE_TAGS := eng debug |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 152 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 153 | LOCAL_SHARED_LIBRARIES := libc libcutils libm |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 154 | LOCAL_STATIC_LIBRARIES := libclearsilverregex libuclibcrpc |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 155 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 156 | include $(BUILD_EXECUTABLE) |
| 157 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 158 | BUSYBOX_LINKS := $(shell cat $(BB_PATH)/busybox-$(BUSYBOX_CONFIG).links) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 159 | # nc is provided by external/netcat |
| 160 | exclude := nc |
| 161 | SYMLINKS := $(addprefix $(TARGET_OUT_OPTIONAL_EXECUTABLES)/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS)))) |
| 162 | $(SYMLINKS): BUSYBOX_BINARY := $(LOCAL_MODULE) |
| 163 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) |
| 164 | @echo "Symlink: $@ -> $(BUSYBOX_BINARY)" |
| 165 | @mkdir -p $(dir $@) |
| 166 | @rm -rf $@ |
| 167 | $(hide) ln -sf $(BUSYBOX_BINARY) $@ |
| 168 | |
| 169 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 170 | |
| 171 | # We need this so that the installed files could be picked up based on the |
| 172 | # local module name |
| 173 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 174 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |
| 175 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 176 | |
codeworkx | 258ba0c | 2011-09-08 21:25:43 +0200 | [diff] [blame] | 177 | # Static Busybox |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 178 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 179 | LOCAL_PATH := $(BB_PATH) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 180 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 181 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 182 | BUSYBOX_CONFIG:=full |
| 183 | BUSYBOX_SUFFIX:=static |
| 184 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 185 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 186 | LOCAL_CFLAGS := $(BUSYBOX_CFLAGS) |
| 187 | LOCAL_CFLAGS += \ |
| 188 | -Dgetusershell=busybox_getusershell \ |
| 189 | -Dsetusershell=busybox_setusershell \ |
| 190 | -Dendusershell=busybox_endusershell \ |
| 191 | -Dttyname_r=busybox_ttyname_r \ |
| 192 | -Dgetmntent=busybox_getmntent \ |
| 193 | -Dgetmntent_r=busybox_getmntent_r \ |
| 194 | -Dgenerate_uuid=busybox_generate_uuid |
Steven Luo | ececd8c | 2013-07-31 13:16:07 -0700 | [diff] [blame^] | 195 | LOCAL_LDFLAGS += -Wl,--no-fatal-warnings |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 196 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 197 | LOCAL_MODULE := static_busybox |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 198 | LOCAL_MODULE_STEM := busybox |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 199 | LOCAL_MODULE_TAGS := optional |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 200 | LOCAL_STATIC_LIBRARIES := libclearsilverregex libc libcutils libm libuclibcrpc |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 201 | LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES |
codeworkx | 258ba0c | 2011-09-08 21:25:43 +0200 | [diff] [blame] | 202 | LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 203 | LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 204 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 205 | include $(BUILD_EXECUTABLE) |