Don't add .vendor suffix for vendor-only modules
Soong now adds .vendor suffix only for modules having both core and
vendor variants. Furthermore, names listed in LOCAL_SHARED_LIBRARIES
are correct (= have .vendor suffix when the dependent lib has variants).
Therefore, make does not need to force add .vendor suffix when parsing
modules from soong.
Bug: 37480243
Test: BOARD_VNDK_VERSION=current m -j <name> is successful, where <name>
is one of the vendor-only libraries in Soong. (i.e.
android.hardware.renderscript@1.0-impl)
Test: m -j does not break anything
Change-Id: Id8d0d01313c63496a10de4cd3ddb9f75180efef6
diff --git a/core/binary.mk b/core/binary.mk
index 6753e18..41cf2be 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -464,6 +464,8 @@
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LINKER)
endif
+# Modules from soong do not need this since the dependencies are already handled there.
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
include $(BUILD_SYSTEM)/config_sanitizers.mk
ifneq ($(LOCAL_NO_LIBCOMPILER_RT),true)
@@ -477,6 +479,7 @@
ifeq ($($(my_prefix)OS),windows)
my_static_libraries += libwinpthread
endif
+endif # this module is not from soong
ifneq ($(filter ../%,$(my_src_files)),)
my_soong_problems += dotdot_srcs
@@ -1324,14 +1327,9 @@
## switch all soong libraries over to the /vendor
## variant.
####################################################
- ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
- # Soong-built libraries should always use the .vendor variant
- my_whole_static_libraries := $(addsuffix .vendor,$(my_whole_static_libraries))
- my_static_libraries := $(addsuffix .vendor,$(my_static_libraries))
- my_shared_libraries := $(addsuffix .vendor,$(my_shared_libraries))
- my_system_shared_libraries := $(addsuffix .vendor,$(my_system_shared_libraries))
- my_header_libraries := $(addsuffix .vendor,$(my_header_libraries))
- else
+ ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ # We don't do this renaming for soong-defined modules since they already have correct
+ # names (with .vendor suffix when necessary) in their LOCAL_*_LIBRARIES.
my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
$(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
my_static_libraries := $(foreach l,$(my_static_libraries),\
@@ -1375,7 +1373,7 @@
import_includes := $(intermediates)/import_includes
import_includes_deps := $(strip \
$(if $(LOCAL_USE_VNDK),\
- $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers.vendor,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
+ $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(installed_shared_library_module_names), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 9f4c903..28ab0e7 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -84,7 +84,11 @@
endif
ifdef LOCAL_USE_VNDK
- SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(patsubst %.vendor,%,$(LOCAL_MODULE)) := 1
+ name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE))
+ ifneq ($(name_without_suffix),$(LOCAL_MODULE)
+ SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
+ endif
+ name_without_suffix :=
endif
endif
@@ -172,9 +176,7 @@
# Extra shared libraries introduced by LOCAL_CXX_STL.
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
ifdef LOCAL_USE_VNDK
- ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
- my_shared_libraries := $(addsuffix .vendor,$(my_shared_libraries))
- else
+ ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
$(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
endif