Merge changes I47d523e4,Ib2f4b548 am: f9d1eee9b9
am: ee709b28ed
Original change: https://android-review.googlesource.com/c/platform/build/+/1323335 Change-Id: I911d66ee6dc8c0b127b419ce7dc44f871155fd25
This commit is contained in:
175
core/main.mk
175
core/main.mk
@@ -553,6 +553,13 @@ ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
|
|||||||
$(call generate_all_enforce_rro_packages)
|
$(call generate_all_enforce_rro_packages)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
# Sort ALL_MODULES to remove duplicate entries.
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
ALL_MODULES := $(sort $(ALL_MODULES))
|
||||||
|
# Cannot set to readonly because Makefile extends ALL_MODULES
|
||||||
|
# .KATI_READONLY := ALL_MODULES
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# Fix up CUSTOM_MODULES to refer to installed files rather than
|
# Fix up CUSTOM_MODULES to refer to installed files rather than
|
||||||
# just bare module names. Leave unknown modules alone in case
|
# just bare module names. Leave unknown modules alone in case
|
||||||
@@ -620,65 +627,85 @@ $(sort $(foreach m,$(1),\
|
|||||||
$(m))))
|
$(m))))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# If a module is for a cross host os, the required modules must be for
|
# Resolves module bitness for PRODUCT_PACKAGES and PRODUCT_HOST_PACKAGES.
|
||||||
# that OS too.
|
# The returned list of module names can be used to access
|
||||||
# If a module is built for 32-bit, the required modules must be 32-bit too;
|
# ALL_MODULES.<module>.<*> variables.
|
||||||
# Otherwise if the module is an executable or shared library,
|
# Name resolution for PRODUCT_PACKAGES / PRODUCT_HOST_PACKAGES:
|
||||||
# the required modules must be 64-bit;
|
# foo:32 resolves to foo_32;
|
||||||
# otherwise we require both 64-bit and 32-bit variant, if one exists.
|
# foo:64 resolves to foo;
|
||||||
define target-select-bitness-of-required-modules
|
# foo resolves to both foo and foo_32 (if foo_32 is defined).
|
||||||
$(foreach m,$(ALL_MODULES),\
|
#
|
||||||
$(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))\
|
# Name resolution for HOST_CROSS modules:
|
||||||
$(if $(r),\
|
# foo:32 resolves to foo;
|
||||||
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
|
# foo:64 resolves to foo_64;
|
||||||
$(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\
|
# foo resolves to both foo and foo_64 (if foo_64 is defined).
|
||||||
$(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
|
#
|
||||||
$(eval r_r := $(r)),\
|
# $(1): TARGET, HOST or HOST_CROSS
|
||||||
$(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\
|
# $(2): A list of simple module names with :32 and :64 suffix
|
||||||
)\
|
define resolve-bitness-for-modules
|
||||||
)\
|
$(strip \
|
||||||
$(eval ALL_MODULES.$(m).REQUIRED_FROM_TARGET := $(strip $(r_r)))\
|
$(eval modules_32 := $(patsubst %:32,%,$(filter %:32,$(2)))) \
|
||||||
)\
|
$(eval modules_64 := $(patsubst %:64,%,$(filter %:64,$(2)))) \
|
||||||
|
$(eval modules_both := $(filter-out %:32 %:64,$(2))) \
|
||||||
|
$(eval ### For host cross modules, the primary arch is windows x86 and secondary is x86_64) \
|
||||||
|
$(if $(filter HOST_CROSS,$(1)), \
|
||||||
|
$(eval modules_1st_arch := $(modules_32)) \
|
||||||
|
$(eval modules_2nd_arch := $(modules_64)), \
|
||||||
|
$(eval modules_1st_arch := $(modules_64)) \
|
||||||
|
$(eval modules_2nd_arch := $(modules_32))) \
|
||||||
|
$(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
|
||||||
|
$(eval modules := $(modules_1st_arch)) \
|
||||||
|
$(if $($(1)_2ND_ARCH), \
|
||||||
|
$(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_2nd_arch))), \
|
||||||
|
$(eval modules += $(modules_2nd_arch))) \
|
||||||
|
$(eval ### For the rest we add both) \
|
||||||
|
$(eval modules += $(modules_both)) \
|
||||||
|
$(if $($(1)_2ND_ARCH), \
|
||||||
|
$(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_both)))) \
|
||||||
|
$(modules) \
|
||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
$(call target-select-bitness-of-required-modules)
|
|
||||||
|
|
||||||
define host-select-bitness-of-required-modules
|
# TODO(b/7456955): error if a required module doesn't exist.
|
||||||
$(foreach m,$(ALL_MODULES),\
|
# Resolve the required module names in ALL_MODULES.*.REQUIRED_FROM_TARGET,
|
||||||
$(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST))\
|
# ALL_MODULES.*.REQUIRED_FROM_HOST and ALL_MODULES.*.REQUIRED_FROM_HOST_CROSS
|
||||||
$(if $(r),\
|
# to 32-bit or 64-bit variant.
|
||||||
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
|
# If a module is for cross host OS, the required modules are also for that OS.
|
||||||
$(eval r_r := $(call get-host-32-bit-modules-if-we-can,$(r))),\
|
# Required modules explicitly suffixed with :32 or :64 resolve to that bitness.
|
||||||
$(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
|
# Otherwise if the requiring module is native and the required module is shared
|
||||||
$(eval r_r := $(r)),\
|
# library or native test, then the required module resolves to the same bitness.
|
||||||
$(eval r_r := $(r) $(call get-host-32-bit-modules,$(r)))\
|
# Otherwise the required module resolves to both variants, if they exist.
|
||||||
)\
|
# $(1): TARGET, HOST or HOST_CROSS
|
||||||
)\
|
define select-bitness-of-required-modules
|
||||||
$(eval ALL_MODULES.$(m).REQUIRED_FROM_HOST := $(strip $(r_r)))\
|
$(foreach m,$(ALL_MODULES), \
|
||||||
)\
|
$(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_$(1))) \
|
||||||
|
$(if $(r), \
|
||||||
|
$(if $(filter HOST_CROSS,$(1)), \
|
||||||
|
$(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m))) \
|
||||||
|
$(eval r := $(addprefix host_cross_,$(r)))) \
|
||||||
|
$(eval module_is_native := \
|
||||||
|
$(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS))) \
|
||||||
|
$(eval r_r := $(foreach r_i,$(r), \
|
||||||
|
$(if $(filter %:32 %:64,$(r_i)), \
|
||||||
|
$(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))), \
|
||||||
|
$(eval r_m := \
|
||||||
|
$(eval r_i_2nd := $(call get-modules-for-2nd-arch,$(1),$(r_i))) \
|
||||||
|
$(eval required_is_shared_library_or_native_test := \
|
||||||
|
$(filter SHARED_LIBRARIES NATIVE_TESTS, \
|
||||||
|
$(ALL_MODULES.$(r_i).CLASS) $(ALL_MODULES.$(r_i_2nd).CLASS))) \
|
||||||
|
$(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \
|
||||||
|
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \
|
||||||
|
$(r_i) $(r_i_2nd)))) \
|
||||||
|
$(eval ### TODO(b/7456955): error if r_m is empty / does not exist) \
|
||||||
|
$(r_m))) \
|
||||||
|
$(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \
|
||||||
|
) \
|
||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
$(call host-select-bitness-of-required-modules)
|
|
||||||
|
|
||||||
define host-cross-select-bitness-of-required-modules
|
$(call select-bitness-of-required-modules,TARGET)
|
||||||
$(foreach m,$(ALL_MODULES),\
|
$(call select-bitness-of-required-modules,HOST)
|
||||||
$(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS))\
|
$(call select-bitness-of-required-modules,HOST_CROSS)
|
||||||
$(if $(r),\
|
|
||||||
$(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m)))\
|
|
||||||
$(eval r := $(addprefix host_cross_,$(r)))\
|
|
||||||
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
|
|
||||||
$(eval r_r := $(call get-host-32-bit-modules-if-we-can,$(r))),\
|
|
||||||
$(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
|
|
||||||
$(eval r_r := $(r)),\
|
|
||||||
$(eval r_r := $(r) $(call get-host-32-bit-modules,$(r)))\
|
|
||||||
)\
|
|
||||||
)\
|
|
||||||
$(eval ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS := $(strip $(r_r)))\
|
|
||||||
)\
|
|
||||||
)
|
|
||||||
endef
|
|
||||||
$(call host-cross-select-bitness-of-required-modules)
|
|
||||||
r_r :=
|
|
||||||
|
|
||||||
define add-required-deps
|
define add-required-deps
|
||||||
$(1): | $(2)
|
$(1): | $(2)
|
||||||
@@ -1128,45 +1155,6 @@ define auto-included-modules
|
|||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Resolves module bitness for PRODUCT_PACKAGES and PRODUCT_HOST_PACKAGES.
|
|
||||||
# The returned list of module names can be used to access
|
|
||||||
# ALL_MODULES.<module>.<*> variables.
|
|
||||||
# Name resolution for PRODUCT_PACKAGES / PRODUCT_HOST_PACKAGES:
|
|
||||||
# foo:32 resolves to foo_32;
|
|
||||||
# foo:64 resolves to foo;
|
|
||||||
# foo resolves to both foo and foo_32 (if foo_32 is defined).
|
|
||||||
#
|
|
||||||
# Name resolution for HOST_CROSS modules:
|
|
||||||
# foo:32 resolves to foo;
|
|
||||||
# foo:64 resolves to foo_64;
|
|
||||||
# foo resolves to both foo and foo_64 (if foo_64 is defined).
|
|
||||||
#
|
|
||||||
# $(1): TARGET, HOST or HOST_CROSS
|
|
||||||
# $(2): A list of simple module names with :32 and :64 suffix
|
|
||||||
define resolve-bitness-for-modules
|
|
||||||
$(strip \
|
|
||||||
$(eval modules_32 := $(patsubst %:32,%,$(filter %:32,$(2)))) \
|
|
||||||
$(eval modules_64 := $(patsubst %:64,%,$(filter %:64,$(2)))) \
|
|
||||||
$(eval modules_both := $(filter-out %:32 %:64,$(2))) \
|
|
||||||
$(eval ### For host cross modules, the primary arch is windows x86 and secondary is x86_64) \
|
|
||||||
$(if $(filter HOST_CROSS,$(1)), \
|
|
||||||
$(eval modules_1st_arch := $(modules_32)) \
|
|
||||||
$(eval modules_2nd_arch := $(modules_64)), \
|
|
||||||
$(eval modules_1st_arch := $(modules_64)) \
|
|
||||||
$(eval modules_2nd_arch := $(modules_32))) \
|
|
||||||
$(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
|
|
||||||
$(eval modules := $(modules_1st_arch)) \
|
|
||||||
$(if $($(1)_2ND_ARCH), \
|
|
||||||
$(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_2nd_arch))), \
|
|
||||||
$(eval modules += $(modules_2nd_arch))) \
|
|
||||||
$(eval ### For the rest we add both) \
|
|
||||||
$(eval modules += $(modules_both)) \
|
|
||||||
$(if $($(1)_2ND_ARCH), \
|
|
||||||
$(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_both)))) \
|
|
||||||
$(modules) \
|
|
||||||
)
|
|
||||||
endef
|
|
||||||
|
|
||||||
# Lists most of the files a particular product installs, including:
|
# Lists most of the files a particular product installs, including:
|
||||||
# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES
|
# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES
|
||||||
# - PRODUCT_COPY_FILES
|
# - PRODUCT_COPY_FILES
|
||||||
@@ -1179,8 +1167,7 @@ endef
|
|||||||
# foo resolves to both foo and foo_32 (if foo_32 is defined).
|
# foo resolves to both foo and foo_32 (if foo_32 is defined).
|
||||||
#
|
#
|
||||||
# Name resolution for LOCAL_REQUIRED_MODULES:
|
# Name resolution for LOCAL_REQUIRED_MODULES:
|
||||||
# If a module is built for 2nd arch, its required module resolves to
|
# See the select-bitness-of-required-modules definition.
|
||||||
# 32-bit variant, if it exits. See the select-bitness-of-required-modules definition.
|
|
||||||
# $(1): product makefile
|
# $(1): product makefile
|
||||||
define product-installed-files
|
define product-installed-files
|
||||||
$(eval _pif_modules := \
|
$(eval _pif_modules := \
|
||||||
|
Reference in New Issue
Block a user