diff --git a/core/binary.mk b/core/binary.mk index 775baad3a..be0776e33 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -211,7 +211,7 @@ installed_shared_library_module_names := $(sort $(installed_shared_library_modul ifdef LOCAL_INSTALLED_MODULE ifdef installed_shared_library_module_names $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ - $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) + $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) endif endif diff --git a/core/definitions.mk b/core/definitions.mk index 882c611d6..37a7c70ec 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2135,20 +2135,6 @@ define set-inherited-package-variables-internal ,) endef -########################################################### -## Expand a module name list with REQUIRED modules -########################################################### -# $(1): The variable name that holds the initial module name list. -# the variable will be modified to hold the expanded results. -# $(2): The initial module name list. -# Returns empty string (maybe with some whitespaces). -define expand-required-modules -$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\ - $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\ -$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\ - $(call expand-required-modules,$(1),$(_erm_new_modules))) -endef - ########################################################### ## API Check ########################################################### diff --git a/core/main.mk b/core/main.mk index 6dbc8a6e6..33b3309f5 100644 --- a/core/main.mk +++ b/core/main.mk @@ -626,37 +626,36 @@ h_m := t_r := h_r := -# Resolve the dependencies on shared libraries. -$(foreach m,$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \ - $(eval p := $(subst :,$(space),$(m))) \ - $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\ - $(subst $(comma),$(space),$(lastword $(p)))))) \ - $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) -$(foreach m,$(HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \ - $(eval p := $(subst :,$(space),$(m))) \ - $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\ - $(subst $(comma),$(space),$(lastword $(p)))))) \ - $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) +# Establish the dependecies on the shared libraries. +# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED, +# so they can be expanded to product_MODULES later. +# $(1): TARGET_ or HOST_. +# $(2): non-empty for 2nd arch. +define resolve-shared-libs-depes +$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\ + $(eval p := $(subst :,$(space),$(m)))\ + $(eval mod := $(firstword $(p)))\ + $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\ + $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\ + $(eval r := $(filter $($(1)OUT_ROOT)/%,$(call module-installed-files,\ + $(deps))))\ + $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))\ + $(eval ALL_MODULES.$(mod).REQUIRED += $(deps))) +endef + +$(call resolve-shared-libs-depes,TARGET_) ifdef TARGET_2ND_ARCH -$(foreach m,$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \ - $(eval p := $(subst :,$(space),$(m))) \ - $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\ - $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX), \ - $(subst $(comma),$(space),$(lastword $(p))))))) \ - $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) +$(call resolve-shared-libs-depes,TARGET_,true) endif +$(call resolve-shared-libs-depes,HOST_) ifdef HOST_2ND_ARCH -$(foreach m,$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \ - $(eval p := $(subst :,$(space),$(m))) \ - $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\ - $(addsuffix $(HOST_2ND_ARCH_MODULE_SUFFIX), \ - $(subst $(comma),$(space),$(lastword $(p))))))) \ - $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) +$(call resolve-shared-libs-depes,HOST_,true) endif m := r := p := +deps := add-required-deps := # ------------------------------------------------------------------- @@ -665,6 +664,20 @@ add-required-deps := # Of the modules defined by the component makefiles, # determine what we actually want to build. +########################################################### +## Expand a module name list with REQUIRED modules +########################################################### +# $(1): The variable name that holds the initial module name list. +# the variable will be modified to hold the expanded results. +# $(2): The initial module name list. +# Returns empty string (maybe with some whitespaces). +define expand-required-modules +$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\ + $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\ +$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\ + $(call expand-required-modules,$(1),$(_erm_new_modules))) +endef + ifdef FULL_BUILD # The base list of modules to build for this product is specified # by the appropriate product definition file, which was included @@ -689,6 +702,7 @@ ifdef FULL_BUILD endif $(call expand-required-modules,product_MODULES,$(product_MODULES)) + product_FILES := $(call module-installed-files, $(product_MODULES)) ifeq (0,1) $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):) diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index b248e1fa0..08d33d57f 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -92,7 +92,7 @@ endif # prebuilt_module_is_a_library ifdef LOCAL_INSTALLED_MODULE ifdef LOCAL_SHARED_LIBRARIES $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ - $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES)) + $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES)) # We also need the LOCAL_BUILT_MODULE dependency, # since we use -rpath-link which points to the built module's path. diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk index ceb166c3d..50fe120bc 100644 --- a/core/tasks/vendor_module_check.mk +++ b/core/tasks/vendor_module_check.mk @@ -42,20 +42,7 @@ _vendor_owner_whitelist := \ ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)) -_vendor_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)) -$(call expand-required-modules,_vendor_check_modules,$(_vendor_check_modules)) - -# Expand the target modules installed via LOCAL_SHARED_LIBRARIES -# $(1): the list of modules to expand. -define expand-required-shared-libraries -$(eval _ersl_new_modules := $(filter $(addsuffix :%,$(1)),$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES)))\ -$(eval _ersl_new_modules := $(foreach p,$(_ersl_new_modules),$(word 3,$(subst :,$(space),$(p)))))\ -$(eval _ersl_new_modules := $(sort $(subst $(comma),$(space),$(_ersl_new_modules))))\ -$(eval _ersl_new_modules := $(filter-out $(_vendor_check_modules),$(_ersl_new_modules)))\ -$(if $(_ersl_new_modules),$(eval _vendor_check_modules += $(_ersl_new_modules))\ - $(call expand-required-shared-libraries,$(_ersl_new_modules))) -endef -$(call expand-required-shared-libraries,$(_vendor_check_modules)) +_vendor_check_modules := $(product_MODULES) _vendor_module_owner_info := # Restrict owners