diff --git a/core/Makefile b/core/Makefile index a79d7b4a8f..d4f9e18390 100644 --- a/core/Makefile +++ b/core/Makefile @@ -919,6 +919,7 @@ $(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE) .PHONY: installed-file-list installed-file-list: $(INSTALLED_FILES_FILE) $(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE)) +$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE)) # ----------------------------------------------------------------- # A zip of the tests that are built when running "make tests". @@ -1075,14 +1076,14 @@ sdk_dir := $(HOST_OUT)/sdk # sdk_name := android-sdk_$(FILE_NAME_TAG) ifeq ($(HOST_OS),darwin) - sdk_host_os := mac + INTERNAL_SDK_HOST_OS_NAME := mac else - sdk_host_os := $(HOST_OS) + INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS) endif ifneq ($(HOST_OS),windows) - sdk_host_os := $(sdk_host_os)-$(HOST_ARCH) + INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH) endif -sdk_name := $(sdk_name)_$(sdk_host_os) +sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME) sdk_dep_file := $(sdk_dir)/sdk_deps.mk diff --git a/core/main.mk b/core/main.mk index 41f0193e2d..a1ef8be561 100644 --- a/core/main.mk +++ b/core/main.mk @@ -125,6 +125,15 @@ endif ### between the build variants ### +is_sdk_build := +ifneq ($(filter sdk,$(MAKECMDGOALS)),) +is_sdk_build := true +endif +ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) +is_sdk_build := true +endif + + ## user/userdebug ## user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT)) @@ -187,7 +196,7 @@ endif ## sdk ## -ifneq ($(filter sdk,$(MAKECMDGOALS)),) +ifdef is_sdk_build ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1) $(error The 'sdk' target may not be specified with any other targets) endif @@ -222,7 +231,7 @@ endif # If we're on an eng or tests build, but not on the sdk, and we have # a better one, use that instead. ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),) - ifeq ($(filter sdk,$(MAKECMDGOALS)),) + ifdef is_sdk_build apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml) ifneq ($(strip $(apns_to_use)),) PRODUCT_COPY_FILES := \ @@ -249,7 +258,7 @@ define should-install-to-system $(if $(filter tests,$(1)),,true) endef -ifneq (,$(filter sdk,$(MAKECMDGOALS))) +ifdef is_sdk_build # For the sdk goal, anything with the "samples" tag should be # installed in /data even if that module also has "eng"/"debug"/"user". define should-install-to-system @@ -544,7 +553,7 @@ endif # Don't include any GNU targets in the SDK. It's ok (and necessary) # to build the host tools, but nothing that's going to be installed # on the target (including static libraries). -ifneq ($(filter sdk,$(MAKECMDGOALS)),) +ifdef is_sdk_build target_gnu_MODULES := \ $(filter \ $(TARGET_OUT_INTERMEDIATES)/% \ diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk index e0b4c7012e..62adeeed09 100644 --- a/core/tasks/sdk-addon.mk +++ b/core/tasks/sdk-addon.mk @@ -18,9 +18,11 @@ addon_name := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_NAME)) ifneq ($(addon_name),) +addon_dir_leaf := $(addon_name)-$(FILE_NAME_TAG)-$(INTERNAL_SDK_HOST_OS_NAME) + intermediates := $(HOST_OUT_INTERMEDIATES)/SDK_ADDON/$(addon_name)_intermediates -full_target := $(HOST_OUT_SDK_ADDON)/$(addon_name).zip -staging := $(intermediates)/$(addon_name) +full_target := $(HOST_OUT_SDK_ADDON)/$(addon_dir_leaf).zip +staging := $(intermediates)/$(addon_dir_leaf) sdk_addon_deps := files_to_copy := @@ -74,11 +76,13 @@ $(full_target): $(sdk_addon_deps) | $(ACP) $(ACP) -r $(PRIVATE_DOCS_DIR)/* $(PRIVATE_STAGING_DIR)/docs/reference ;\ fi $(hide) mkdir -p $(dir $@) - $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR) && zip -rq $$F * ) + $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rq $$F * ) .PHONY: sdk_addon sdk_addon: $(full_target) +$(call dist-for-goals, sdk_addon, $(full_target)) + else # addon_name ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) $(error Trying to build sdk_addon, but product '$(INTERNAL_PRODUCT)' does not define one)