Merge "Build libstagefright_soft_h264enc by default"
diff --git a/core/binary.mk b/core/binary.mk
index 70af9b9..04ac90b 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -692,7 +692,7 @@
 ###########################################################
 export_includes := $(intermediates)/export_includes
 $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
-$(export_includes) :
+$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
 	@echo Export includes file: $< -- $@
 	$(hide) mkdir -p $(dir $@) && rm -f $@
 ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 6cee6ea..a4da5ce 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -32,7 +32,6 @@
 # which is loaded by the 64-bit JVM through JNI), will have to use
 # LOCAL_CC and LOCAL_CXX to override this.
 #
-ifeq ($(TARGET_PRODUCT),sdk)
 HOST_SDK_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk
 # Don't do anything if the toolchain is not there
 ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc)))
@@ -40,7 +39,6 @@
 HOST_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)/g++
 HOST_AR  := $(HOST_SDK_TOOLCHAIN_PREFIX)/ar
 endif # $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc exists
-endif # TARGET_PRODUCT == sdk
 
 ifneq ($(strip $(BUILD_HOST_64bit)),)
 # By default we build everything in 32-bit, because it gives us
diff --git a/core/definitions.mk b/core/definitions.mk
index 6bf3daa..9943d5f 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -113,11 +113,11 @@
 # Figure out where we are.
 define my-dir
 $(strip \
-  $(eval md_file_ := $$(lastword $$(MAKEFILE_LIST))) \
-  $(if $(filter $(CLEAR_VARS),$(md_file_)), \
+  $(eval LOCAL_MODULE_MAKEFILE := $$(lastword $$(MAKEFILE_LIST))) \
+  $(if $(filter $(CLEAR_VARS),$(LOCAL_MODULE_MAKEFILE)), \
     $(error LOCAL_PATH must be set before including $$(CLEAR_VARS)) \
    , \
-    $(patsubst %/,%,$(dir $(md_file_))) \
+    $(patsubst %/,%,$(dir $(LOCAL_MODULE_MAKEFILE))) \
    ) \
  )
 endef
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index c0f80fd..f3dbe55 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -46,7 +46,7 @@
 	@echo "Unzip $(dir $@) <- $<"
 	$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
 	$(hide) unzip -qo $< -d $(dir $@)
-	$(hide) touch $@
+	$(hide) touch $@ $(_pdk_fusion_files)
 
 _pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) '*[^/]' 2>/dev/null)
 _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/, $(_pdk_fusion_file_list))
@@ -57,7 +57,7 @@
 # the pattern rule will be just ignored by make.
 # That's desired by us: we want only absent files from the platform zip package.
 # Copy with the last-modified time preserved, never follow symbolic links.
-$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/%
+$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp)
 	@mkdir -p $(dir $@)
 	$(hide) cp -fpPR $< $@
 
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index 45f4a1e..65c4258 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -16,6 +16,7 @@
 
 # Restrict the vendor module owners here.
 _vendor_owner_whitelist := \
+	audience \
 	broadcom \
 	csr \
 	imgtec \
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index 3a1d2f0..7533a61 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -26,4 +26,7 @@
     development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     development/data/etc/vold.conf:system/etc/vold.conf \
     development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
-    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
+    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml
+
+PRODUCT_PACKAGES := \
+    audio.primary.goldfish
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index d0b970b..8f29b8c 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -64,71 +64,9 @@
 	SmokeTestApp
 
 
-
-# Host tools that are parts of the SDK.
-# See development/build/sdk.atree
-PRODUCT_PACKAGES += \
-	adb \
-	dmtracedump \
-	etc1tool \
-	hprof-conv \
-	mksdcard \
-	emulator \
-	bios.bin \
-	vgabios-cirrus.bin \
-	ddms \
-	hierarchyviewer \
-	draw9patch \
-	traceview \
-	android \
-	dexdump \
-	lint \
-	monkeyrunner
-
-# Native host Java libraries that are parts of the SDK.
-# See development/build/sdk.atree
-PRODUCT_PACKAGES += \
-	androidprefs \
-	annotations \
-	sdkstats \
-	archquery \
-	ddms \
-	ddmlib \
-	ddmuilib \
-	draw9patch \
-	hierarchyviewer \
-	traceview \
-	anttasks \
-	ide_common \
-	sdklib \
-	sdkuilib \
-	sdkmanager \
-	swtmenubar \
-	rule_api \
-	assetstudio \
-	swing-worker-1.1 \
-	groovy-all-1.7.0 \
-	commons-compress-1.0 \
-	emmalib \
-	jcommon-1.0.12 \
-	jfreechart-1.0.9 \
-	jfreechart-1.0.9-swt \
-	org.eclipse.core.commands_3.4.0.I20080509-2000 \
-	org.eclipse.equinox.common_3.4.0.v20080421-2006 \
-	org.eclipse.jface_3.4.2.M20090107-0800 \
-	osgi \
-	layoutlib \
-	lint \
-	monkeyrunner \
-	guavalib \
-	jsr305lib \
-	jython \
-	ddmlib-tests \
-	ninepatch-tests \
-	common-tests \
-	sdklib-tests \
-	sdkuilib-tests \
-	layoutlib-tests
+# Define the host tools and libs that are parts of the SDK.
+-include sdk/build/product_sdk.mk
+-include development/build/product_sdk.mk
 
 # audio libraries.
 PRODUCT_PACKAGES += \