Merge "Add atom optimization flags"
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 0d17c83..2b95a5c 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -65,7 +65,7 @@
 # Only the tags mentioned in this test are expected to be set by module
 # makefiles. Anything else is either a typo or a source of unexpected
 # behaviors.
-ifneq ($(filter-out user debug eng tests optional samples,$(LOCAL_MODULE_TAGS)),)
+ifneq ($(filter-out user debug eng tests optional samples shell_ash shell_mksh,$(LOCAL_MODULE_TAGS)),)
 $(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH))
 endif
 
diff --git a/core/build-system.html b/core/build-system.html
index ce5e869..e547185 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -247,6 +247,7 @@
         for <code>eng</code>.
         <ul>
         <li>Installs modules tagged with: <code>eng</code>, <code>debug</code>,
+            <code>shell_</code>$(TARGET_SHELL),
             <code>user</code>, and/or <code>development</code>.
         <li>Installs non-APK modules that have no tags specified.
         <li>Installs APKs according to the product definition files, in
@@ -266,7 +267,7 @@
         <p>
         This is the flavor intended to be the final release bits.
         <ul>
-        <li>Installs modules tagged with <code>user</code>.
+        <li>Installs modules tagged with <code>shell_</code>$(TARGET_SHELL) and <code>user</code>.
         <li>Installs non-APK modules that have no tags specified.
         <li>Installs APKs according to the product definition files; tags
             are ignored for APK modules.
@@ -681,7 +682,8 @@
 <h4>LOCAL_MODULE_TAGS</h4>
 <p>Set <code>LOCAL_MODULE_TAGS</code> to any number of whitespace-separated
 tags.  If the tag list is empty or contains <code>droid</code>, the module
-will get installed as part of a <code>make droid</code>.  Otherwise, it will
+will get installed as part of a <code>make droid</code>.  Modules with the tag
+<code>shell_</code>$(TARGET_SHELL) will also be installed. Otherwise, it will
 only get installed by running <code>make &lt;your-module&gt;</code>
 or with the <code>make all</code> pseudotarget.</p>
 
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 1a28af9..121f89b 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -23,6 +23,22 @@
 HOST_GLOBAL_CFLAGS += -m32
 HOST_GLOBAL_LDFLAGS += -m32
 
+# Use the Mac OSX SDK 10.5 if the build host is 10.6
+build_mac_version := $(shell sw_vers -productVersion)
+ifneq ($(filter 10.6.%, $(build_mac_version)),)
+sdk_105_root := /Developer/SDKs/MacOSX10.5.sdk
+ifeq ($(wildcard $(sdk_105_root)),)
+$(warning *****************************************************)
+$(warning * You are building on Mac OSX 10.6.)
+$(warning * Can not find SDK 10.5 at $(sdk_105_root))
+$(warning *****************************************************)
+$(error Stop.)
+endif
+
+HOST_GLOBAL_CFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
+HOST_GLOBAL_LDFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
+endif # build_mac_version is 10.6
+
 HOST_GLOBAL_CFLAGS += -fPIC
 HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
 
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 26052d6..fa2dfe3 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -37,4 +37,7 @@
 HOST_GLOBAL_CFLAGS += \
 	-include $(call select-android-config-h,linux-x86)
 
+# Disable new longjmp in glibc 2.11 and later. See bug 2967937.
+HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+
 HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/config.mk b/core/config.mk
index 337152c..0a306e1 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -105,6 +105,9 @@
 # Default is to prelink modules.
 TARGET_PRELINK_MODULE := true
 
+# Default shell is ash. Other possible value is mksh.
+TARGET_SHELL := ash
+
 # ###############################################################
 # Include sub-configuration files
 # ###############################################################
diff --git a/core/main.mk b/core/main.mk
index 8c87c74..b51b3c4 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -373,17 +373,18 @@
 	dalvik/libdex \
 	dalvik/tools/dmtracedump \
 	dalvik/tools/hprof-conv \
-	development/tools/line_endings \
-	development/tools/etc1tool \
-	sdk/emulator/mksdcard \
-	sdk/sdklauncher \
 	development/host \
+	development/tools/etc1tool \
+	development/tools/line_endings \
+	external/easymock \
 	external/expat \
 	external/libpng \
 	external/qemu \
 	external/sqlite/dist \
 	external/zlib \
 	frameworks/base \
+	sdk/emulator/mksdcard \
+	sdk/sdklauncher \
 	system/core/adb \
 	system/core/fastboot \
 	system/core/libcutils \
@@ -400,14 +401,15 @@
 	sdk/archquery \
 	sdk/androidprefs \
 	sdk/apkbuilder \
+	sdk/ddms \
+	sdk/hierarchyviewer2 \
 	sdk/jarutils \
 	sdk/layoutlib_api \
 	sdk/layoutlib_utils \
+	sdk/layoutopt \
 	sdk/ninepatch \
 	sdk/sdkstats \
 	sdk/sdkmanager \
-	sdk/layoutopt \
-	sdk/ddms \
 	development/apps \
 	development/tools/mkstubs \
 	packages
@@ -560,7 +562,7 @@
 endif
 # Use tags to get the non-APPS user modules.  Use the product
 # definition files to get the APPS user modules.
-user_MODULES := $(sort $(call get-tagged-modules,user))
+user_MODULES := $(sort $(call get-tagged-modules,user shell_$(TARGET_SHELL)))
 user_MODULES := $(user_MODULES) $(user_PACKAGES)
 
 eng_MODULES := $(sort $(call get-tagged-modules,eng))
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 25de0ea..f204c76 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -83,6 +83,7 @@
 	    graphics \
 	    location \
 	    media \
+	    drm \
 	    opengl \
 	    sax \
 	    telephony \
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index 917c5dc..a1276f4 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -25,6 +25,7 @@
 endif
 CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar
 
+DDMLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/ddmlib-prebuilt.jar
 junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar
 HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar
 
@@ -117,6 +118,8 @@
 # Copy executable to CTS directory
 	$(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools
 	$(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools
+# Copy ddmlib prebuilt jar
+	$(hide) $(ACP) -fp $(DDMLIB_JAR) $(PRIVATE_DIR)/tools
 # Copy junit jar
 	$(hide) $(ACP) -fp $(PRIVATE_JUNIT_HOST_JAR) $(PRIVATE_DIR)/tools
 # Copy hosttestlib jar
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 2b72d01..f630dac 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -9,3 +9,6 @@
 TARGET_CPU_ABI := armeabi
 HAVE_HTC_AUDIO_DRIVER := true
 BOARD_USES_GENERIC_AUDIO := true
+
+# Set /system/bin/sh to mksh, not ash, to test the transition.
+TARGET_SHELL := mksh