diff --git a/CleanSpec.mk b/CleanSpec.mk index 791439b514..88f917297a 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -414,6 +414,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/vendor/lib*) +# Soong module variant change, remove obsolete intermediates +$(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/binary.mk b/core/binary.mk index c2527d4260..589c462765 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -518,10 +518,31 @@ my_asflags += -D__ASSEMBLY__ ## When compiling against the VNDK, use LL-NDK libraries ########################################################### ifneq ($(LOCAL_USE_VNDK),) - my_shared_libraries := $(foreach lib,$(my_shared_libraries),\ - $(if $(filter $(LLNDK_LIBRARIES),$(lib)),$(lib).llndk,$(lib))) - my_system_shared_libraries := $(foreach lib,$(my_system_shared_libraries),\ - $(if $(filter $(LLNDK_LIBRARIES),$(lib)),$(lib).llndk,$(lib))) + #################################################### + ## Soong modules may be built twice, once for /system + ## and once for /vendor. If we're using the VNDK, + ## 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 + 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),\ + $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l))) + my_shared_libraries := $(foreach l,$(my_shared_libraries),\ + $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) + my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\ + $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) + my_header_libraries := $(foreach l,$(my_header_libraries),\ + $(if $(SPLIT_VENDOR.HEADER_LIBRARIES.$(l)),$(l).vendor,$(l))) + endif endif ########################################################### @@ -1381,6 +1402,10 @@ ifdef LOCAL_SDK_VERSION $(my_link_type): PRIVATE_LINK_TYPE := native:ndk $(my_link_type): PRIVATE_WARN_TYPES := $(my_link_type): PRIVATE_ALLOWED_TYPES := native:ndk +else ifdef LOCAL_USE_VNDK +$(my_link_type): PRIVATE_LINK_TYPE := native:vendor +$(my_link_type): PRIVATE_WARN_TYPES := +$(my_link_type): PRIVATE_ALLOWED_TYPES := native:vendor else $(my_link_type): PRIVATE_LINK_TYPE := native:platform $(my_link_type): PRIVATE_WARN_TYPES := diff --git a/core/executable_internal.mk b/core/executable_internal.mk index f51ddb84a7..3509bd2cb6 100644 --- a/core/executable_internal.mk +++ b/core/executable_internal.mk @@ -44,12 +44,16 @@ ifeq ($(LOCAL_NO_CRT),true) my_target_crtbegin_dynamic_o := my_target_crtbegin_static_o := my_target_crtend_o := +else ifdef LOCAL_USE_VNDK +my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.vendor.o +my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.vendor.o +my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.vendor.o else my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o endif -ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),) +ifneq ($(LOCAL_SDK_VERSION),) my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_dynamic.o) my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.o) my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o) diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 20ffc872cb..8a2f1182f8 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -79,9 +79,13 @@ else endif ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) -ifeq ($(prebuilt_module_is_a_library),true) -SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE) -endif + ifeq ($(prebuilt_module_is_a_library),true) + SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE) + endif + + ifdef LOCAL_USE_VNDK + SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(patsubst %.vendor,%,$(LOCAL_MODULE)) := 1 + endif endif # Don't install static libraries by default. @@ -145,7 +149,13 @@ endif export_cflags := my_link_type := $(intermediates)/link_type -$(my_link_type): PRIVATE_LINK_TYPE := native:$(if $(LOCAL_SDK_VERSION),ndk,platform) +ifdef LOCAL_SDK_VERSION +$(my_link_type): PRIVATE_LINK_TYPE := native:ndk +else ifdef LOCAL_USE_VNDK +$(my_link_type): PRIVATE_LINK_TYPE := native:vendor +else +$(my_link_type): PRIVATE_LINK_TYPE := native:platform +endif $(eval $(call link-type-partitions,$(my_link_type))) $(my_link_type): @echo Check module type: $@ @@ -162,6 +172,14 @@ ifdef LOCAL_SHARED_LIBRARIES my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) # 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 + my_shared_libraries := $(foreach l,$(my_shared_libraries),\ + $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) + endif +endif $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries)) diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk index 1ea4cb8989..687536b35a 100644 --- a/core/shared_library_internal.mk +++ b/core/shared_library_internal.mk @@ -48,11 +48,14 @@ my_target_libatomic := $(call intermediates-dir-for,STATIC_LIBRARIES,libatomic,, ifeq ($(LOCAL_NO_CRT),true) my_target_crtbegin_so_o := my_target_crtend_so_o := +else ifdef LOCAL_USE_VNDK +my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.vendor.o +my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.vendor.o else my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o endif -ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),) +ifneq ($(LOCAL_SDK_VERSION),) my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o) my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o) endif