From d8d37212400ee275bbec78e584c86f60ac10b666 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 21 Mar 2014 16:17:04 -0700 Subject: [PATCH] Complete installed shared library dependency Previously the installed shared library dependency doesn't include modules introduced by LOCAL_SHARED_LIBRARIES_. This change fix the problem. It also cleans up use of the shared library variable. Bug: 13528787 Change-Id: Id8d807cc57f0ec4a71f18b64545d91191efad8fb --- core/binary.mk | 71 +++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index 689181e7b5..81dd5bf9b1 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1,10 +1,14 @@ ########################################################### ## Standard rules for building binary object files from -## asm/c/cpp/yacc/lex source files. +## asm/c/cpp/yacc/lex/etc source files. ## ## The list of object files is exported in $(all_objects). ########################################################### +####################################### +include $(BUILD_SYSTEM)/base_rules.mk +####################################### + my_ndk_version_root := ifdef LOCAL_SDK_VERSION ifdef LOCAL_NDK_VERSION @@ -73,30 +77,18 @@ endif # supply that, for example, when building libc itself. ifdef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) - LOCAL_SYSTEM_SHARED_LIBRARIES := + my_system_shared_libraries := + else + my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) endif else ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) - LOCAL_SYSTEM_SHARED_LIBRARIES := $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES) + my_system_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES) + else + my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) endif endif -ifdef LOCAL_SDK_VERSION - # Get the list of INSTALLED libraries as module names. - # We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for - # they may cusomize their install path with LOCAL_MODULE_PATH - installed_shared_library_module_names := \ - $(LOCAL_SHARED_LIBRARIES) -else - installed_shared_library_module_names := \ - $(LOCAL_SYSTEM_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES) -endif -installed_shared_library_module_names := $(sort $(installed_shared_library_module_names)) - -####################################### -include $(BUILD_SYSTEM)/base_rules.mk -####################################### - # The following LOCAL_ variables will be modified in this file. # Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch, # we can't modify them in place. @@ -132,15 +124,6 @@ my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$(TARGET_$(LOCAL_2ND my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags)) endif -# The real dependency will be added after all Android.mks are loaded and the install paths -# of the shared libraries are determined. -ifdef LOCAL_INSTALLED_MODULE -ifdef installed_shared_library_module_names -$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ - $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) -endif -endif - # Add static HAL libraries ifdef LOCAL_HAL_STATIC_LIBRARIES $(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \ @@ -189,6 +172,31 @@ endif ########################################################### my_asflags += -D__ASSEMBLY__ + +########################################################## +## Set up installed module dependency +## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for +## they may cusomize their install path with LOCAL_MODULE_PATH +########################################################## +# Get the list of INSTALLED libraries as module names. +ifdef LOCAL_SDK_VERSION + installed_shared_library_module_names := \ + $(my_shared_libraries) +else + installed_shared_library_module_names := \ + $(my_system_shared_libraries) $(my_shared_libraries) +endif +installed_shared_library_module_names := $(sort $(installed_shared_library_module_names)) + +# The real dependency will be added after all Android.mks are loaded and the install paths +# of the shared libraries are determined. +ifdef LOCAL_INSTALLED_MODULE +ifdef installed_shared_library_module_names +$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ + $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) +endif +endif + ########################################################### ## Define PRIVATE_ variables from global vars ########################################################### @@ -811,19 +819,18 @@ built_shared_libraries := \ $(addsuffix $(so_suffix), \ $(my_shared_libraries))) +# Add the NDK libraries to the built module dependency my_system_shared_libraries_fullpath := \ $(my_ndk_stl_shared_lib_fullpath) \ $(addprefix $(my_ndk_version_root)/usr/lib/, \ - $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES))) + $(addsuffix $(so_suffix), $(my_system_shared_libraries))) built_shared_libraries += $(my_system_shared_libraries_fullpath) -my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES) else -my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES) built_shared_libraries := \ $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ $(addsuffix $(so_suffix), \ - $(my_shared_libraries))) + $(installed_shared_library_module_names))) endif built_static_libraries := \