Support split /system and /vendor modules from Soong

Soong modules may be split into both /system and /vendor variants.
Ensure that Make libraries link against the correct version based on
whether LOCAL_USE_VNDK is set.

Bug: 36426473
Bug: 36079834
Test: build-aosp_arm64.ninja files are the same before/after
Test: attempt building with BOARD_VNDK_VERSION:=current
Change-Id: I229bc290373743406275f3ca16081eae04c27987
This commit is contained in:
Dan Willemsen
2017-04-07 20:58:43 -07:00
parent 2d6e79d268
commit 9d2b3280e8
5 changed files with 63 additions and 10 deletions

View File

@@ -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 :=