Merge "Rewrite LDLIBS and SHARED_LIBRARIES"

This commit is contained in:
Dan Willemsen 2016-06-08 21:09:34 +00:00 committed by Gerrit Code Review
commit a8d13592ac
2 changed files with 48 additions and 0 deletions

View file

@ -1133,6 +1133,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
@ -1431,6 +1459,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

@ -781,6 +781,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