Merge "Rewrite link type checking" am: e4d92ef568
am: d76aaed983
Change-Id: I04cb85e8062374b9eee87806e3187b49768cf908
This commit is contained in:
@@ -1396,39 +1396,28 @@ endif
|
|||||||
## other NDK-built libraries
|
## other NDK-built libraries
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my_link_type := $(intermediates)/link_type
|
|
||||||
all_link_types: $(my_link_type)
|
|
||||||
ifdef LOCAL_SDK_VERSION
|
ifdef LOCAL_SDK_VERSION
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := native:ndk
|
my_link_type := native:ndk
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES :=
|
my_warn_types :=
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := native:ndk
|
my_allowed_types := native:ndk
|
||||||
else ifdef LOCAL_USE_VNDK
|
else ifdef LOCAL_USE_VNDK
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := native:vendor
|
my_link_type := native:vendor
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES :=
|
my_warn_types :=
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := native:vendor
|
my_allowed_types := native:vendor
|
||||||
else
|
else
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := native:platform
|
my_link_type := native:platform
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES :=
|
my_warn_types :=
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := native:ndk native:platform
|
my_allowed_types := native:ndk native:platform
|
||||||
endif
|
endif
|
||||||
$(eval $(call link-type-partitions,$(my_link_type)))
|
|
||||||
my_link_type_deps := $(strip \
|
|
||||||
$(foreach l,$(my_whole_static_libraries) $(my_static_libraries), \
|
|
||||||
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/link_type))
|
|
||||||
ifneq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
|
|
||||||
ifneq ($(LOCAL_MODULE_CLASS),HEADER_LIBRARIES)
|
|
||||||
my_link_type_deps += $(strip \
|
|
||||||
$(foreach l,$(my_shared_libraries), \
|
|
||||||
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/link_type))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
$(my_link_type): PRIVATE_DEPS := $(my_link_type_deps)
|
|
||||||
$(my_link_type): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
||||||
$(my_link_type): PRIVATE_MAKEFILE := $(LOCAL_MODULE_MAKEFILE)
|
|
||||||
$(my_link_type): $(my_link_type_deps) $(CHECK_LINK_TYPE)
|
|
||||||
@echo Check module type: $@
|
|
||||||
$(check-link-type)
|
|
||||||
|
|
||||||
|
my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
|
||||||
|
ifneq ($(filter-out STATIC_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
||||||
|
my_link_deps += $(addprefix SHARED_LIBRARIES:,$(my_shared_libraries))
|
||||||
|
endif
|
||||||
|
|
||||||
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
||||||
|
my_common :=
|
||||||
|
include $(BUILD_SYSTEM)/link_type.mk
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
## Common object handling.
|
## Common object handling.
|
||||||
@@ -1815,7 +1804,7 @@ export_cflags :=
|
|||||||
.KATI_RESTAT: $(export_includes)
|
.KATI_RESTAT: $(export_includes)
|
||||||
|
|
||||||
# Make sure export_includes gets generated when you are running mm/mmm
|
# Make sure export_includes gets generated when you are running mm/mmm
|
||||||
$(LOCAL_BUILT_MODULE) : | $(export_includes) $(my_link_type)
|
$(LOCAL_BUILT_MODULE) : | $(export_includes)
|
||||||
|
|
||||||
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
||||||
ifneq (,$(filter-out $(LOCAL_PATH)/%,$(my_export_c_include_dirs)))
|
ifneq (,$(filter-out $(LOCAL_PATH)/%,$(my_export_c_include_dirs)))
|
||||||
|
@@ -3134,44 +3134,6 @@ $(strip $(if $(LOCAL_RECORDED_MODULE_TYPE),,
|
|||||||
$(error Invalid module type: $(1))))))
|
$(error Invalid module type: $(1))))))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
###########################################################
|
|
||||||
# Link type checking
|
|
||||||
###########################################################
|
|
||||||
define check-link-type
|
|
||||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
|
||||||
$(hide) $(CHECK_LINK_TYPE) --makefile $(PRIVATE_MAKEFILE) --module $(PRIVATE_MODULE) \
|
|
||||||
--type "$(PRIVATE_LINK_TYPE)" $(addprefix --allowed ,$(PRIVATE_ALLOWED_TYPES)) \
|
|
||||||
$(addprefix --warn ,$(PRIVATE_WARN_TYPES)) $(PRIVATE_DEPS)
|
|
||||||
$(hide) echo "$(PRIVATE_LINK_TYPE)" >$@
|
|
||||||
endef
|
|
||||||
|
|
||||||
define link-type-partitions
|
|
||||||
ifndef LOCAL_IS_HOST_MODULE
|
|
||||||
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
|
||||||
ifneq ($(filter $(TARGET_OUT_VENDOR)/%,$(my_module_path)),)
|
|
||||||
$(1): PRIVATE_LINK_TYPE += partition:vendor
|
|
||||||
$(1): PRIVATE_WARN_TYPES += partition:data
|
|
||||||
$(1): PRIVATE_ALLOWED_TYPES += partition:vendor partition:oem partition:odm
|
|
||||||
else ifneq ($(filter $(TARGET_OUT_OEM)/%,$(my_module_path)),)
|
|
||||||
$(1): PRIVATE_LINK_TYPE += partition:oem
|
|
||||||
$(1): PRIVATE_WARN_TYPES += partition:data
|
|
||||||
$(1): PRIVATE_ALLOWED_TYPES += partition:vendor partition:oem partition:odm
|
|
||||||
else ifneq ($(filter $(TARGET_OUT_ODM)/%,$(my_module_path)),)
|
|
||||||
$(1): PRIVATE_LINK_TYPE += partition:odm
|
|
||||||
$(1): PRIVATE_WARN_TYPES += partition:data
|
|
||||||
$(1): PRIVATE_ALLOWED_TYPES += partition:vendor partition:oem partition:odm
|
|
||||||
else ifneq ($(filter $(TARGET_OUT_DATA)/%,$(my_module_path)),)
|
|
||||||
$(1): PRIVATE_LINK_TYPE += partition:data
|
|
||||||
$(1): PRIVATE_ALLOWED_TYPES += partition:data partition:vendor partition:oem partition:odm
|
|
||||||
else
|
|
||||||
$(1): PRIVATE_WARN_TYPES += partition:vendor partition:oem partition:odm partition:data
|
|
||||||
endif
|
|
||||||
else # uninstallable module
|
|
||||||
$(1): PRIVATE_ALLOWED_TYPES += partition:vendor partition:oem partition:odm partition:data
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# Basic math functions for positive integers <= 100
|
# Basic math functions for positive integers <= 100
|
||||||
#
|
#
|
||||||
|
@@ -78,6 +78,20 @@ $(foreach v,$(ENABLED_VERSIONS), \
|
|||||||
# buildspec.mk.default and envsetup.sh.
|
# buildspec.mk.default and envsetup.sh.
|
||||||
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 13
|
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 13
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Whether we can expect a full build graph
|
||||||
|
ALLOW_MISSING_DEPENDENCIES := $(filter true,$(ALLOW_MISSING_DEPENDENCIES))
|
||||||
|
ifneq ($(TARGET_BUILD_APPS),)
|
||||||
|
ALLOW_MISSING_DEPENDENCIES := true
|
||||||
|
endif
|
||||||
|
ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),)
|
||||||
|
ALLOW_MISSING_DEPENDENCIES := true
|
||||||
|
endif
|
||||||
|
ifneq ($(ONE_SHOT_MAKEFILE),)
|
||||||
|
ALLOW_MISSING_DEPENDENCIES := true
|
||||||
|
endif
|
||||||
|
.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# The product defaults to generic on hardware
|
# The product defaults to generic on hardware
|
||||||
# NOTE: This will be overridden in product_config.mk if make
|
# NOTE: This will be overridden in product_config.mk if make
|
||||||
|
@@ -108,30 +108,18 @@ endif # outer my_prebuilt_jni_libs
|
|||||||
|
|
||||||
# Verify that all included libraries are built against the NDK
|
# Verify that all included libraries are built against the NDK
|
||||||
ifneq ($(strip $(LOCAL_JNI_SHARED_LIBRARIES)),)
|
ifneq ($(strip $(LOCAL_JNI_SHARED_LIBRARIES)),)
|
||||||
my_link_type := $(call intermediates-dir-for,APPS,$(LOCAL_MODULE))/$(my_2nd_arch_prefix)jni_link_type
|
|
||||||
all_link_types: $(my_link_type)
|
|
||||||
my_link_type_deps := $(strip \
|
|
||||||
$(foreach l,$(LOCAL_JNI_SHARED_LIBRARIES),\
|
|
||||||
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),,,$(my_2nd_arch_prefix))/link_type))
|
|
||||||
ifneq ($(LOCAL_SDK_VERSION),)
|
ifneq ($(LOCAL_SDK_VERSION),)
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := app:sdk
|
my_link_type := app:sdk
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES := native:platform
|
my_warn_types := native:platform
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := native:ndk
|
my_allowed_types := native:ndk
|
||||||
else
|
else
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := app:platform
|
my_link_type := app:platform
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES :=
|
my_warn_types :=
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := native:ndk native:platform
|
my_allowed_types := native:ndk native:platform
|
||||||
endif
|
endif
|
||||||
$(eval $(call link-type-partitions,$(my_link_type)))
|
|
||||||
$(my_link_type): PRIVATE_DEPS := $(my_link_type_deps)
|
|
||||||
$(my_link_type): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
||||||
$(my_link_type): PRIVATE_MAKEFILE := $(LOCAL_MODULE_MAKEFILE)
|
|
||||||
$(my_link_type): $(my_link_type_deps) $(CHECK_LINK_TYPE)
|
|
||||||
@echo Check JNI module types: $@
|
|
||||||
$(check-link-type)
|
|
||||||
|
|
||||||
$(LOCAL_BUILT_MODULE): | $(my_link_type)
|
my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
|
||||||
|
|
||||||
my_link_type :=
|
my_common :=
|
||||||
my_link_type_deps :=
|
include $(BUILD_SYSTEM)/link_type.mk
|
||||||
endif
|
endif
|
||||||
|
@@ -396,35 +396,24 @@ endif # LOCAL_JACK_ENABLED
|
|||||||
# Verify that all libraries are safe to use
|
# Verify that all libraries are safe to use
|
||||||
###########################################################
|
###########################################################
|
||||||
ifndef LOCAL_IS_HOST_MODULE
|
ifndef LOCAL_IS_HOST_MODULE
|
||||||
my_link_type := $(intermediates.COMMON)/link_type
|
|
||||||
all_link_types: $(my_link_type)
|
|
||||||
my_link_type_deps := $(strip \
|
|
||||||
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES),\
|
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
JAVA_LIBRARIES,$(lib),,COMMON)/link_type) \
|
|
||||||
$(foreach lib,$(apk_libraries), \
|
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
APPS,$(lib),,COMMON)/link_type))
|
|
||||||
ifeq ($(LOCAL_SDK_VERSION),system_current)
|
ifeq ($(LOCAL_SDK_VERSION),system_current)
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := java:system
|
my_link_type := java:system
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES := java:platform
|
my_warn_types := java:platform
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := java:sdk java:system
|
my_allowed_types := java:sdk java:system
|
||||||
else ifneq ($(LOCAL_SDK_VERSION),)
|
else ifneq ($(LOCAL_SDK_VERSION),)
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := java:sdk
|
my_link_type := java:sdk
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES := java:system java:platform
|
my_warn_types := java:system java:platform
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := java:sdk
|
my_allowed_types := java:sdk
|
||||||
else
|
else
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := java:platform
|
my_link_type := java:platform
|
||||||
$(my_link_type): PRIVATE_WARN_TYPES :=
|
my_warn_types :=
|
||||||
$(my_link_type): PRIVATE_ALLOWED_TYPES := java:sdk java:system java:platform
|
my_allowed_types := java:sdk java:system java:platform
|
||||||
endif
|
endif
|
||||||
$(eval $(call link-type-partitions,$(my_link_type)))
|
|
||||||
$(my_link_type): PRIVATE_DEPS := $(my_link_type_deps)
|
|
||||||
$(my_link_type): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
||||||
$(my_link_type): PRIVATE_MAKEFILE := $(LOCAL_MODULE_MAKEFILE)
|
|
||||||
$(my_link_type): $(my_link_type_deps) $(CHECK_LINK_TYPE)
|
|
||||||
@echo Check Java library module types: $@
|
|
||||||
$(check-link-type)
|
|
||||||
|
|
||||||
$(LOCAL_BUILT_MODULE): $(my_link_type)
|
my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES))
|
||||||
|
my_link_deps += $(addprefix APPS:,$(apk_libraries))
|
||||||
|
|
||||||
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
||||||
|
my_common := COMMON
|
||||||
|
include $(BUILD_SYSTEM)/link_type.mk
|
||||||
endif # !LOCAL_IS_HOST_MODULE
|
endif # !LOCAL_IS_HOST_MODULE
|
||||||
|
27
core/link_type.mk
Normal file
27
core/link_type.mk
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Inputs:
|
||||||
|
# LOCAL_MODULE_CLASS, LOCAL_MODULE, LOCAL_MODULE_MAKEFILE, LOCAL_BUILT_MODULE
|
||||||
|
# from base_rules.mk: my_kind, my_host_cross
|
||||||
|
# my_common: empty or COMMON, like the argument to intermediates-dir-for
|
||||||
|
# my_2nd_arch_prefix: usually LOCAL_2ND_ARCH_VAR_PREFIX, separate for JNI installation
|
||||||
|
#
|
||||||
|
# my_link_type: the tags to apply to this module
|
||||||
|
# my_warn_types: the tags to warn about in our dependencies
|
||||||
|
# my_allowed_types: the tags to allow in our dependencies
|
||||||
|
# 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),_)
|
||||||
|
link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE)
|
||||||
|
ALL_LINK_TYPES := $(ALL_LINK_TYPES) $(link_type)
|
||||||
|
$(link_type).TYPE := $(my_link_type)
|
||||||
|
$(link_type).MAKEFILE := $(LOCAL_MODULE_MAKEFILE)
|
||||||
|
$(link_type).WARN := $(my_warn_types)
|
||||||
|
$(link_type).ALLOWED := $(my_allowed_types)
|
||||||
|
$(link_type).DEPS := $(addprefix $(my_link_prefix):,$(my_link_deps))
|
||||||
|
$(link_type).BUILT := $(LOCAL_BUILT_MODULE)
|
||||||
|
|
||||||
|
link_type :=
|
||||||
|
my_allowed_types :=
|
||||||
|
my_link_prefix :=
|
||||||
|
my_link_type :=
|
||||||
|
my_warn_types :=
|
165
core/main.mk
165
core/main.mk
@@ -726,6 +726,168 @@ p :=
|
|||||||
deps :=
|
deps :=
|
||||||
add-required-deps :=
|
add-required-deps :=
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Link type checking
|
||||||
|
#
|
||||||
|
# ALL_LINK_TYPES contains a list of all link type prefixes (generally one per
|
||||||
|
# module, but APKs can "link" to both java and native code). The link type
|
||||||
|
# prefix consists of all the information needed by intermediates-dir-for:
|
||||||
|
#
|
||||||
|
# LINK_TYPE:TARGET:_:2ND:STATIC_LIBRARIES:libfoo
|
||||||
|
#
|
||||||
|
# 1: LINK_TYPE literal
|
||||||
|
# 2: prefix
|
||||||
|
# - TARGET
|
||||||
|
# - HOST
|
||||||
|
# - HOST_CROSS
|
||||||
|
# - AUX
|
||||||
|
# 3: Whether to use the common intermediates directory or not
|
||||||
|
# - _
|
||||||
|
# - COMMON
|
||||||
|
# 4: Whether it's the second arch or not
|
||||||
|
# - _
|
||||||
|
# - 2ND_
|
||||||
|
# 5: Module Class
|
||||||
|
# - STATIC_LIBRARIES
|
||||||
|
# - SHARED_LIBRARIES
|
||||||
|
# - ...
|
||||||
|
# 6: Module Name
|
||||||
|
#
|
||||||
|
# Then fields under that are separated by a period and the field name:
|
||||||
|
# - TYPE: the link types for this module
|
||||||
|
# - MAKEFILE: Where this module was defined
|
||||||
|
# - BUILT: The built module location
|
||||||
|
# - DEPS: the link type prefixes for the module's dependencies
|
||||||
|
# - ALLOWED: the link types to allow in this module's dependencies
|
||||||
|
# - WARN: the link types to warn about in this module's dependencies
|
||||||
|
#
|
||||||
|
# All of the dependency link types not listed in ALLOWED or WARN will become
|
||||||
|
# errors.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
link_type_error :=
|
||||||
|
|
||||||
|
define link-type-prefix
|
||||||
|
$(word 2,$(subst :,$(space),$(1)))
|
||||||
|
endef
|
||||||
|
define link-type-common
|
||||||
|
$(patsubst _,,$(word 3,$(subst :,$(space),$(1))))
|
||||||
|
endef
|
||||||
|
define link-type-2ndarchprefix
|
||||||
|
$(patsubst _,,$(word 4,$(subst :,$(space),$(1))))
|
||||||
|
endef
|
||||||
|
define link-type-class
|
||||||
|
$(word 5,$(subst :,$(space),$(1)))
|
||||||
|
endef
|
||||||
|
define link-type-name
|
||||||
|
$(word 6,$(subst :,$(space),$(1)))
|
||||||
|
endef
|
||||||
|
define link-type-os
|
||||||
|
$(strip $(eval _p := $(link-type-prefix))\
|
||||||
|
$(if $(filter HOST HOST_CROSS,$(_p)),\
|
||||||
|
$($(_p)_OS),\
|
||||||
|
$(if $(filter AUX,$(_p)),AUX,android)))
|
||||||
|
endef
|
||||||
|
define link-type-arch
|
||||||
|
$($(link-type-prefix)_$(link-type-2ndarchprefix)ARCH)
|
||||||
|
endef
|
||||||
|
define link-type-name-variant
|
||||||
|
$(link-type-name) ($(link-type-class) $(link-type-os)-$(link-type-arch))
|
||||||
|
endef
|
||||||
|
|
||||||
|
# $(1): the prefix of the module doing the linking
|
||||||
|
# $(2): the prefix of the linked module
|
||||||
|
define link-type-warning
|
||||||
|
$(shell $(call echo-warning,$($(1).MAKEFILE),"$(call link-type-name,$(1)) ($($(1).TYPE)) should not link against $(call link-type-name,$(2)) ($(3))"))
|
||||||
|
endef
|
||||||
|
|
||||||
|
# $(1): the prefix of the module doing the linking
|
||||||
|
# $(2): the prefix of the linked module
|
||||||
|
define link-type-error
|
||||||
|
$(shell $(call echo-error,$($(1).MAKEFILE),"$(call link-type-name,$(1)) ($($(1).TYPE)) can not link against $(call link-type-name,$(2)) ($(3))"))\
|
||||||
|
$(eval link_type_error := true)
|
||||||
|
endef
|
||||||
|
|
||||||
|
link-type-missing :=
|
||||||
|
ifneq ($(ALLOW_MISSING_DEPENDENCIES),true)
|
||||||
|
# Print an error message if the linked-to module is missing
|
||||||
|
# $(1): the prefix of the module doing the linking
|
||||||
|
# $(2): the prefix of the missing module
|
||||||
|
define link-type-missing
|
||||||
|
$(shell $(call echo-error,$($(1).MAKEFILE),"$(call link-type-name-variant,$(1)) missing $(call link-type-name-variant,$(2))"))\
|
||||||
|
$(eval available_variants := $(filter %:$(call link-type-name,$(2)),$(ALL_LINK_TYPES)))\
|
||||||
|
$(if $(available_variants),\
|
||||||
|
$(info Available variants:)\
|
||||||
|
$(foreach v,$(available_variants),$(info $(space)$(space)$(call link-type-name-variant,$(v)))))\
|
||||||
|
$(info You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.)\
|
||||||
|
$(eval link_type_error := true)
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define link-type-missing
|
||||||
|
$(eval $$(1).MISSING := true)
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Verify that $(1) can link against $(2)
|
||||||
|
# Both $(1) and $(2) are the link type prefix defined above
|
||||||
|
define verify-link-type
|
||||||
|
$(foreach t,$($(2).TYPE),\
|
||||||
|
$(if $(filter-out $($(1).ALLOWED),$(t)),\
|
||||||
|
$(if $(filter $(t),$($(1).WARN)),\
|
||||||
|
$(call link-type-warning,$(1),$(2),$(t)),\
|
||||||
|
$(call link-type-error,$(1),$(2),$(t)))))
|
||||||
|
endef
|
||||||
|
|
||||||
|
# TODO: Verify all branches/configs have reasonable warnings/errors, and remove
|
||||||
|
# these overrides
|
||||||
|
link-type-missing = $(eval $$(1).MISSING := true)
|
||||||
|
verify-link-type = $(eval $$(1).MISSING := true)
|
||||||
|
|
||||||
|
$(foreach lt,$(ALL_LINK_TYPES),\
|
||||||
|
$(foreach d,$($(lt).DEPS),\
|
||||||
|
$(if $($(d).TYPE),\
|
||||||
|
$(call verify-link-type,$(lt),$(d)),\
|
||||||
|
$(call link-type-missing,$(lt),$(d)))))
|
||||||
|
|
||||||
|
ifdef link_type_error
|
||||||
|
$(error exiting from previous errors)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# The intermediate filename for link type rules
|
||||||
|
#
|
||||||
|
# APPS are special -- they have up to three different rules:
|
||||||
|
# 1. The COMMON rule for Java libraries
|
||||||
|
# 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
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES
|
||||||
|
# case. We always need to write the file for mm to work, but only need to
|
||||||
|
# check it if we weren't able to check it when reading the Android.mk files.
|
||||||
|
define link-type-file-rule
|
||||||
|
my_link_type_deps := $(foreach l,$($(1).DEPS),$(call link-type-file,$(l)))
|
||||||
|
my_link_type_file := $(call link-type-file,$(1))
|
||||||
|
$($(1).BUILT): | $$(my_link_type_file)
|
||||||
|
$$(my_link_type_file): PRIVATE_DEPS := $$(my_link_type_deps)
|
||||||
|
ifeq ($($(1).MISSING),true)
|
||||||
|
$$(my_link_type_file): $(CHECK_LINK_TYPE)
|
||||||
|
endif
|
||||||
|
$$(my_link_type_file): $$(my_link_type_deps)
|
||||||
|
@echo Check module type: $$@
|
||||||
|
$$(hide) mkdir -p $$(dir $$@) && rm -f $$@
|
||||||
|
ifeq ($($(1).MISSING),true)
|
||||||
|
$$(hide) $(CHECK_LINK_TYPE) --makefile $($(1).MAKEFILE) --module $(link-type-name) \
|
||||||
|
--type "$($(1).TYPE)" $(addprefix --allowed ,$($(1).ALLOWED)) \
|
||||||
|
$(addprefix --warn ,$($(1).WARN)) $$(PRIVATE_DEPS)
|
||||||
|
endif
|
||||||
|
$$(hide) echo "$($(1).TYPE)" >$$@
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach lt,$(ALL_LINK_TYPES),\
|
||||||
|
$(eval $(call link-type-file-rule,$(lt))))
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# Figure out our module sets.
|
# Figure out our module sets.
|
||||||
#
|
#
|
||||||
@@ -1140,7 +1302,4 @@ tidy_only:
|
|||||||
ndk: $(SOONG_OUT_DIR)/ndk.timestamp
|
ndk: $(SOONG_OUT_DIR)/ndk.timestamp
|
||||||
.PHONY: ndk
|
.PHONY: ndk
|
||||||
|
|
||||||
.PHONY: all_link_types
|
|
||||||
all_link_types:
|
|
||||||
|
|
||||||
endif # KATI
|
endif # KATI
|
||||||
|
@@ -148,21 +148,20 @@ else
|
|||||||
endif
|
endif
|
||||||
export_cflags :=
|
export_cflags :=
|
||||||
|
|
||||||
my_link_type := $(intermediates)/link_type
|
|
||||||
ifdef LOCAL_SDK_VERSION
|
ifdef LOCAL_SDK_VERSION
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := native:ndk
|
my_link_type := native:ndk
|
||||||
else ifdef LOCAL_USE_VNDK
|
else ifdef LOCAL_USE_VNDK
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := native:vendor
|
my_link_type := native:vendor
|
||||||
else
|
else
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := native:platform
|
my_link_type := native:platform
|
||||||
endif
|
endif
|
||||||
$(eval $(call link-type-partitions,$(my_link_type)))
|
|
||||||
$(my_link_type):
|
|
||||||
@echo Check module type: $@
|
|
||||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
|
||||||
$(hide) echo "$(PRIVATE_LINK_TYPE)" >$@
|
|
||||||
|
|
||||||
$(LOCAL_BUILT_MODULE) : | $(export_includes) $(my_link_type)
|
# TODO: check dependencies of prebuilt files
|
||||||
|
my_link_deps :=
|
||||||
|
|
||||||
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
||||||
|
my_common :=
|
||||||
|
include $(BUILD_SYSTEM)/link_type.mk
|
||||||
endif # prebuilt_module_is_a_library
|
endif # prebuilt_module_is_a_library
|
||||||
|
|
||||||
# The real dependency will be added after all Android.mks are loaded and the install paths
|
# The real dependency will be added after all Android.mks are loaded and the install paths
|
||||||
@@ -473,20 +472,20 @@ common_javalib_jar := $(intermediates.COMMON)/javalib.jar
|
|||||||
$(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE)
|
$(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE)
|
||||||
$(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_PREFIX := $(my_prefix)
|
$(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_PREFIX := $(my_prefix)
|
||||||
|
|
||||||
my_link_type := $(intermediates.COMMON)/link_type
|
|
||||||
ifeq ($(LOCAL_SDK_VERSION),system_current)
|
ifeq ($(LOCAL_SDK_VERSION),system_current)
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := java:system
|
my_link_type := java:system
|
||||||
else ifneq ($(LOCAL_SDK_VERSION),)
|
else ifneq ($(LOCAL_SDK_VERSION),)
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := java:sdk
|
my_link_type := java:sdk
|
||||||
else
|
else
|
||||||
$(my_link_type): PRIVATE_LINK_TYPE := java:platform
|
my_link_type := java:platform
|
||||||
endif
|
endif
|
||||||
$(eval $(call link-type-partitions,$(my_link_type)))
|
|
||||||
$(my_link_type):
|
# TODO: check dependencies of prebuilt files
|
||||||
@echo Check module type: $@
|
my_link_deps :=
|
||||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
|
||||||
$(hide) echo "$(PRIVATE_LINK_TYPE)" >$@
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
||||||
$(LOCAL_BUILT_MODULE): $(my_link_type)
|
my_common := COMMON
|
||||||
|
include $(BUILD_SYSTEM)/link_type.mk
|
||||||
|
|
||||||
ifeq ($(prebuilt_module_is_dex_javalib),true)
|
ifeq ($(prebuilt_module_is_dex_javalib),true)
|
||||||
# For prebuilt shared Java library we don't have classes.jar.
|
# For prebuilt shared Java library we don't have classes.jar.
|
||||||
|
@@ -38,7 +38,7 @@ $(SOONG_VARIABLES): FORCE
|
|||||||
echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
|
echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
|
||||||
echo ' "Brillo": $(if $(BRILLO),true,false),'; \
|
echo ' "Brillo": $(if $(BRILLO),true,false),'; \
|
||||||
echo ' "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
|
echo ' "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
|
||||||
echo ' "Allow_missing_dependencies": $(if $(TARGET_BUILD_APPS)$(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),true,false),'; \
|
echo ' "Allow_missing_dependencies": $(if $(ALLOW_MISSING_DEPENDENCIES),true,false),'; \
|
||||||
echo ' "SanitizeHost": $(call json_list,$(SANITIZE_HOST)),'; \
|
echo ' "SanitizeHost": $(call json_list,$(SANITIZE_HOST)),'; \
|
||||||
echo ' "SanitizeDevice": $(call json_list,$(SANITIZE_TARGET)),'; \
|
echo ' "SanitizeDevice": $(call json_list,$(SANITIZE_TARGET)),'; \
|
||||||
echo ' "SanitizeDeviceArch": $(call json_list,$(SANITIZE_TARGET_ARCH)),'; \
|
echo ' "SanitizeDeviceArch": $(call json_list,$(SANITIZE_TARGET_ARCH)),'; \
|
||||||
|
@@ -25,6 +25,12 @@ $(foreach m,$(my_modules),\
|
|||||||
$(eval my_modules_and_deps += $(_explicitly_required))\
|
$(eval my_modules_and_deps += $(_explicitly_required))\
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Ignore unknown installed files on partial builds
|
||||||
|
my_missing_files :=
|
||||||
|
ifneq ($(ALLOW_MISSING_DEPENDENCIES),true)
|
||||||
|
my_missing_files = $(shell $(call echo-warning,$(my_makefile),$(my_package_name): Unknown installed file for module '$(1)'))
|
||||||
|
endif
|
||||||
|
|
||||||
# Iterate over modules' built files and installed files;
|
# Iterate over modules' built files and installed files;
|
||||||
# Calculate the dest files in the output zip file.
|
# Calculate the dest files in the output zip file.
|
||||||
|
|
||||||
@@ -34,7 +40,7 @@ $(foreach m,$(my_modules_and_deps),\
|
|||||||
$(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\
|
$(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\
|
||||||
$(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).BUILT_INSTALLED)))\
|
$(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).BUILT_INSTALLED)))\
|
||||||
$(if $(_pickup_files)$(_built_files),,\
|
$(if $(_pickup_files)$(_built_files),,\
|
||||||
$(shell $(call echo-warning,$(my_makefile),$(my_package_name): Unknown installed file for module '$(m)')))\
|
$(call my_missing_files,$(m)))\
|
||||||
$(eval my_pickup_files += $(_pickup_files))\
|
$(eval my_pickup_files += $(_pickup_files))\
|
||||||
$(foreach i, $(_built_files),\
|
$(foreach i, $(_built_files),\
|
||||||
$(eval bui_ins := $(subst :,$(space),$(i)))\
|
$(eval bui_ins := $(subst :,$(space),$(i)))\
|
||||||
|
Reference in New Issue
Block a user