From 19e0320ccbf31979fe48db7817898ff2150ae40d Mon Sep 17 00:00:00 2001 From: Alexey Polyudov Date: Mon, 31 Jul 2017 17:42:42 -0700 Subject: [PATCH] build: aux: Fix link type checking for AUX builds AUX build environent is volatile and is only instantiated in a context of AUX-aware module. link-type checking is happening outside such context, and is not able to correctly determine AUX build dependencies. 1. Save enough of context in LINK_TYPE variable; Use AUX- instead of AUX 2. Load correct set of AUX meta build vars before building link_type rules Bug: 62060489 Test: make auxiliary build no longer tries to access "/STATIC_LIBRARIES" path Change-Id: I9764d4a0740da1c55a6f8429398872fc4362942c (cherry picked from commit 55ebe631b4a50f940850323354241baab9d9be24) --- core/link_type.mk | 2 +- core/main.mk | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/link_type.mk b/core/link_type.mk index ff525cb040..f7604ff4af 100644 --- a/core/link_type.mk +++ b/core/link_type.mk @@ -10,7 +10,7 @@ # my_link_deps: the dependencies, in the form of : # -my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_)) +my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross))$(if $(filter AUX,$(my_kind)),-$(AUX_OS_VARIANT)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_)) link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE) ALL_LINK_TYPES := $(ALL_LINK_TYPES) $(link_type) $(link_type).TYPE := $(my_link_type) diff --git a/core/main.mk b/core/main.mk index 0aab4f46b0..81ab0becca 100644 --- a/core/main.mk +++ b/core/main.mk @@ -610,7 +610,7 @@ add-required-deps := # - TARGET # - HOST # - HOST_CROSS -# - AUX +# - AUX- # 3: Whether to use the common intermediates directory or not # - _ # - COMMON @@ -637,9 +637,15 @@ add-required-deps := link_type_error := -define link-type-prefix +define link-type-prefix-base $(word 2,$(subst :,$(space),$(1))) endef +define link-type-prefix +$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,AUX,$(link-type-prefix-base)),$(link-type-prefix-base)) +endef +define link-type-aux-variant +$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,%,$(link-type-prefix-base))) +endef define link-type-common $(patsubst _,,$(word 3,$(subst :,$(space),$(1)))) endef @@ -729,7 +735,11 @@ endif # 2. The jni_link_type rule for embedded native code # 3. The 2ND_jni_link_type for the second architecture native code define link-type-file -$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type +$(eval _ltf_aux_variant:=$(link-type-aux-variant))\ +$(if $(_ltf_aux_variant),$(call aux-variant-load-env,$(_ltf_aux_variant)))\ +$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type\ +$(if $(_ltf_aux_variant),$(call aux-variant-load-env,none))\ +$(eval _ltf_aux_variant:=) endef # Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES