Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
| 2 | |
Koushik Dutta | 129a798 | 2011-11-16 18:27:02 -0800 | [diff] [blame] | 3 | |
| 4 | # Make a static library for clearsilver's regex. |
| 5 | # This prevents multiple symbol definition error.... |
| 6 | include $(CLEAR_VARS) |
| 7 | LOCAL_SRC_FILES := ../clearsilver/util/regex/regex.c |
| 8 | LOCAL_MODULE := libclearsilverregex |
| 9 | LOCAL_C_INCLUDES := \ |
| 10 | external/clearsilver \ |
| 11 | external/clearsilver/util/regex |
| 12 | include $(BUILD_STATIC_LIBRARY) |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 13 | |
Tanguy Pruvot | 29d8ebe | 2011-10-29 15:15:34 +0200 | [diff] [blame] | 14 | |
| 15 | |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 16 | # Execute make clean, make prepare and copy profiles required for normal & static busybox (recovery) |
| 17 | |
| 18 | include $(CLEAR_VARS) |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 19 | KERNEL_MODULES_DIR ?= /system/lib/modules |
| 20 | BUSYBOX_CONFIG := minimal full |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 21 | $(BUSYBOX_CONFIG): |
| 22 | @echo GENERATE INCLUDES FOR BUSYBOX $@ |
| 23 | @cd $(LOCAL_PATH) && make clean |
| 24 | cp $(LOCAL_PATH)/.config-$@ $(LOCAL_PATH)/.config |
| 25 | cd $(LOCAL_PATH) && make prepare |
| 26 | @#cp $(LOCAL_PATH)/.config $(LOCAL_PATH)/.config-$@ |
| 27 | @mkdir -p $(LOCAL_PATH)/include-$@ |
| 28 | cp $(LOCAL_PATH)/include/*.h $(LOCAL_PATH)/include-$@/ |
| 29 | @rm $(LOCAL_PATH)/include/usage_compressed.h |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 30 | @rm -f $(LOCAL_PATH)/.config-old |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 31 | |
| 32 | busybox_prepare: $(BUSYBOX_CONFIG) |
| 33 | LOCAL_MODULE := busybox_prepare |
| 34 | LOCAL_MODULE_TAGS := eng |
| 35 | include $(BUILD_STATIC_LIBRARY) |
| 36 | |
| 37 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 38 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 39 | |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 40 | KERNEL_MODULES_DIR ?= /system/lib/modules |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 41 | |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 42 | SUBMAKE := make -s -C $(LOCAL_PATH) CC=$(CC) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 43 | |
| 44 | BUSYBOX_SRC_FILES = $(shell cat $(LOCAL_PATH)/busybox-$(BUSYBOX_CONFIG).sources) \ |
| 45 | libbb/android.c |
| 46 | |
| 47 | ifeq ($(TARGET_ARCH),arm) |
| 48 | BUSYBOX_SRC_FILES += \ |
| 49 | android/libc/arch-arm/syscalls/adjtimex.S \ |
| 50 | android/libc/arch-arm/syscalls/getsid.S \ |
| 51 | android/libc/arch-arm/syscalls/stime.S \ |
| 52 | android/libc/arch-arm/syscalls/swapon.S \ |
| 53 | android/libc/arch-arm/syscalls/swapoff.S \ |
| 54 | android/libc/arch-arm/syscalls/sysinfo.S |
| 55 | endif |
| 56 | |
Rocky Zhang | 8f997da | 2011-10-03 21:11:37 +0800 | [diff] [blame] | 57 | ifeq ($(TARGET_ARCH),mips) |
| 58 | BUSYBOX_SRC_FILES += \ |
| 59 | android/libc/arch-mips/syscalls/adjtimex.S \ |
| 60 | android/libc/arch-mips/syscalls/getsid.S \ |
| 61 | android/libc/arch-mips/syscalls/stime.S \ |
| 62 | android/libc/arch-mips/syscalls/swapon.S \ |
| 63 | android/libc/arch-mips/syscalls/swapoff.S \ |
| 64 | android/libc/arch-mips/syscalls/sysinfo.S |
| 65 | endif |
| 66 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 67 | BUSYBOX_C_INCLUDES = \ |
| 68 | $(LOCAL_PATH)/include-$(BUSYBOX_CONFIG) \ |
| 69 | $(LOCAL_PATH)/include $(LOCAL_PATH)/libbb \ |
| 70 | external/clearsilver \ |
| 71 | external/clearsilver/util/regex \ |
| 72 | bionic/libc/private \ |
| 73 | bionic/libm/include \ |
| 74 | bionic/libm \ |
| 75 | libc/kernel/common |
| 76 | |
| 77 | BUSYBOX_CFLAGS = \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 78 | -Werror=implicit \ |
| 79 | -DNDEBUG \ |
Tanguy Pruvot | c81b2cf | 2011-07-04 10:18:25 +0200 | [diff] [blame] | 80 | -DANDROID \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 81 | -include include-$(BUSYBOX_CONFIG)/autoconf.h \ |
| 82 | -D'CONFIG_DEFAULT_MODULES_DIR="$(KERNEL_MODULES_DIR)"' \ |
| 83 | -D'BB_VER="$(strip $(shell $(SUBMAKE) kernelversion)) $(BUSYBOX_SUFFIX)"' -DBB_BT=AUTOCONF_TIMESTAMP |
| 84 | |
Tanguy Pruvot | 64baaf5 | 2011-07-04 09:41:45 +0200 | [diff] [blame] | 85 | |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 86 | |
| 87 | # Build the static lib for the recovery tool |
| 88 | |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 89 | BUSYBOX_CONFIG:=minimal |
| 90 | BUSYBOX_SUFFIX:=static |
| 91 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 92 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 93 | LOCAL_CFLAGS := -Dmain=busybox_driver $(BUSYBOX_CFLAGS) |
| 94 | LOCAL_CFLAGS += \ |
| 95 | -Dgetusershell=busybox_getusershell \ |
| 96 | -Dsetusershell=busybox_setusershell \ |
| 97 | -Dendusershell=busybox_endusershell \ |
| 98 | -Dttyname_r=busybox_ttyname_r \ |
| 99 | -Dgetmntent=busybox_getmntent \ |
| 100 | -Dgetmntent_r=busybox_getmntent_r \ |
| 101 | -Dgenerate_uuid=busybox_generate_uuid |
| 102 | LOCAL_MODULE := libbusybox |
| 103 | LOCAL_MODULE_TAGS := eng |
Koushik Dutta | 129a798 | 2011-11-16 18:27:02 -0800 | [diff] [blame] | 104 | LOCAL_STATIC_LIBRARIES := libclearsilverregex libcutils libc libm |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 105 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 106 | include $(BUILD_STATIC_LIBRARY) |
| 107 | |
| 108 | |
| 109 | # Bionic Busybox /system/xbin |
| 110 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 111 | include $(CLEAR_VARS) |
| 112 | BUSYBOX_CONFIG:=full |
| 113 | BUSYBOX_SUFFIX:=bionic |
Tanguy Pruvot | 57d4479 | 2011-11-16 20:01:59 +0100 | [diff] [blame^] | 114 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) android/libc/__set_errno.c |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 115 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 116 | LOCAL_CFLAGS := $(BUSYBOX_CFLAGS) |
| 117 | LOCAL_MODULE := busybox |
| 118 | LOCAL_MODULE_TAGS := eng |
| 119 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) |
Tanguy Pruvot | 57d4479 | 2011-11-16 20:01:59 +0100 | [diff] [blame^] | 120 | LOCAL_REQUIRED_MODULES := libm |
Koushik Dutta | 129a798 | 2011-11-16 18:27:02 -0800 | [diff] [blame] | 121 | LOCAL_STATIC_LIBRARIES := libclearsilverregex |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 122 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 123 | include $(BUILD_EXECUTABLE) |
| 124 | |
| 125 | BUSYBOX_LINKS := $(shell cat $(LOCAL_PATH)/busybox-$(BUSYBOX_CONFIG).links) |
| 126 | # nc is provided by external/netcat |
| 127 | exclude := nc |
| 128 | SYMLINKS := $(addprefix $(TARGET_OUT_OPTIONAL_EXECUTABLES)/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS)))) |
| 129 | $(SYMLINKS): BUSYBOX_BINARY := $(LOCAL_MODULE) |
| 130 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) |
| 131 | @echo "Symlink: $@ -> $(BUSYBOX_BINARY)" |
| 132 | @mkdir -p $(dir $@) |
| 133 | @rm -rf $@ |
| 134 | $(hide) ln -sf $(BUSYBOX_BINARY) $@ |
| 135 | |
| 136 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 137 | |
| 138 | # We need this so that the installed files could be picked up based on the |
| 139 | # local module name |
| 140 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 141 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |
| 142 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 143 | |
codeworkx | 258ba0c | 2011-09-08 21:25:43 +0200 | [diff] [blame] | 144 | # Static Busybox |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 145 | |
| 146 | include $(CLEAR_VARS) |
| 147 | BUSYBOX_CONFIG:=full |
| 148 | BUSYBOX_SUFFIX:=static |
| 149 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 150 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 151 | LOCAL_CFLAGS := $(BUSYBOX_CFLAGS) |
| 152 | LOCAL_CFLAGS += \ |
| 153 | -Dgetusershell=busybox_getusershell \ |
| 154 | -Dsetusershell=busybox_setusershell \ |
| 155 | -Dendusershell=busybox_endusershell \ |
| 156 | -Dttyname_r=busybox_ttyname_r \ |
| 157 | -Dgetmntent=busybox_getmntent \ |
| 158 | -Dgetmntent_r=busybox_getmntent_r \ |
| 159 | -Dgenerate_uuid=busybox_generate_uuid |
| 160 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 161 | LOCAL_MODULE := static_busybox |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 162 | LOCAL_MODULE_TAGS := optional |
Tanguy Pruvot | 57d4479 | 2011-11-16 20:01:59 +0100 | [diff] [blame^] | 163 | LOCAL_REQUIRED_MODULES := libm |
Koushik Dutta | 129a798 | 2011-11-16 18:27:02 -0800 | [diff] [blame] | 164 | LOCAL_STATIC_LIBRARIES := libclearsilverregex libcutils libc libm |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 165 | LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES |
codeworkx | 258ba0c | 2011-09-08 21:25:43 +0200 | [diff] [blame] | 166 | LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 167 | LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities |
| 168 | LOCAL_MODULE_STEM := busybox |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 169 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 170 | include $(BUILD_EXECUTABLE) |