Merge \\\\"Rewrite LDLIBS and SHARED_LIBRARIES\\\\" am: a8d13592ac am: d8210177af am: 74da7c9272

am: 4aff13e769

Change-Id: I055f4571c3a67a13f6807b001ce40939a8ed6b3a
This commit is contained in:
Dan Willemsen 2016-06-08 21:22:51 +00:00 committed by android-build-merger
commit 89368014ac
2 changed files with 48 additions and 0 deletions

View File

@ -1167,6 +1167,34 @@ asm_objects += $(asm_objects_asm)
endif
####################################################
## For NDK-built libraries, move LOCAL_SHARED_LIBRARY
## references to my_ldlibs, so that we use the NDK
## prebuilt library and headers for linking.
####################################################
ifndef LOCAL_IS_HOST_MODULE
my_allowed_ldlibs :=
ifdef LOCAL_SDK_VERSION
my_ndk_shared_libraries := $(filter $(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES)),$(my_shared_libraries))
my_shared_libraries := $(filter-out $(my_ndk_shared_libraries),$(my_shared_libraries))
my_ldlibs += $(patsubst lib%,-l%,$(my_ndk_shared_libraries))
my_ndk_shared_libraries :=
my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES))
endif
# Sort ldlibs and ldflags between -l and other linker flags
# We'll do this again later, since there are still changes happening, but that's fine.
my_ldlib_flags := $(my_ldflags) $(my_ldlibs)
my_ldlibs := $(filter -l%,$(my_ldlib_flags))
my_ldflags := $(filter-out -l%,$(my_ldlib_flags))
my_ldlib_flags :=
# Move other ldlibs back to shared libraries
my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs)))
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
endif
##########################################################
## Set up installed module dependency
## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
@ -1465,6 +1493,24 @@ ifneq (,$(filter 1 true,$(my_tidy_enabled)))
endif
endif
# Move -l* entries from ldflags to ldlibs, and everything else to ldflags
my_ldlib_flags := $(my_ldflags) $(my_ldlibs)
my_ldlibs := $(filter -l%,$(my_ldlib_flags))
my_ldflags := $(filter-out -l%,$(my_ldlib_flags))
# One last verification check for ldlibs
ifndef LOCAL_IS_HOST_MODULE
my_allowed_ldlibs :=
ifdef LOCAL_SDK_VERSION
my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES))
endif
my_bad_ldlibs := $(filter-out $(my_allowed_ldlibs),$(my_ldlibs))
ifneq ($(my_bad_ldlibs),)
$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Bad LOCAL_LDLIBS entries: $(my_bad_ldlibs))
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)

View File

@ -794,6 +794,8 @@ endif
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
NDK_PREBUILT_SHARED_LIBRARIES := android c dl EGL GLESv1_CM GLESv2 GLESv3 jnigraphics log mediandk m OpenMAXAL OpenSLES stdc++ vulkan z
ifeq ($(JAVA_NOT_REQUIRED),true)
# Remove java and tools from our path so that we make sure nobody uses them.
unexport ANDROID_JAVA_HOME