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-<variant-name> 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
This commit is contained in:
Alexey Polyudov 2017-07-31 17:42:42 -07:00
parent 6ce5a428ae
commit 55ebe631b4
2 changed files with 14 additions and 4 deletions

View file

@ -10,7 +10,7 @@
# my_link_deps: the dependencies, in the form of <MODULE_CLASS>:<name>
#
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)

View file

@ -597,7 +597,7 @@ add-required-deps :=
# - TARGET
# - HOST
# - HOST_CROSS
# - AUX
# - AUX-<variant-name>
# 3: Whether to use the common intermediates directory or not
# - _
# - COMMON
@ -624,9 +624,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
@ -717,7 +723,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