Retire LOCAL_NDK_VERSION.

We are now unifying the NDK versions of unbundled native code to always
use the latest NDK.
We don't need the variable LOCAL_NDK_VERSION now.
To build native code with NDK, you need set just LOCAL_SDK_VERSION.

Bug: 6932421
Change-Id: I86f05a264249cda6bae97b4b1616f03700cd9dfa
This commit is contained in:
Ying Wang 2012-08-14 10:13:16 -07:00
parent 4000ff5611
commit 848020f22a
5 changed files with 17 additions and 35 deletions

View file

@ -5,30 +5,17 @@
## The list of object files is exported in $(all_objects). ## The list of object files is exported in $(all_objects).
########################################################### ###########################################################
######################################
## Sanity check for LOCAL_NDK_VERSION
######################################
my_ndk_version_root := my_ndk_version_root :=
ifdef LOCAL_NDK_VERSION ifdef LOCAL_SDK_VERSION
ifdef LOCAL_IS_HOST_MODULE ifdef LOCAL_IS_HOST_MODULE
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION can not be used in host module) $(error $(LOCAL_PATH): LOCAL_SDK_VERSION can not be used in host module)
endif endif
ifneq ($(filter-out SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),) ifneq ($(filter-out SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION can only be used to build target shared/static libraries, \ $(error $(LOCAL_PATH): NDK can only be used to build target shared/static libraries, \
while your module is of class $(LOCAL_MODULE_CLASS)) while your module is of class $(LOCAL_MODULE_CLASS))
endif endif
ifeq ($(filter $(LOCAL_NDK_VERSION),$(TARGET_AVAILABLE_NDK_VERSIONS)),) my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
$(error $(LOCAL_PATH): Invalid LOCAL_NDK_VERSION '$(LOCAL_NDK_VERSION)' \ my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
Choices are $(TARGET_AVAILABLE_NDK_VERSIONS))
endif
ifndef LOCAL_SDK_VERSION
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION must be defined with LOCAL_SDK_VERSION)
endif
my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
ifeq ($(wildcard $(my_ndk_version_root)),)
$(error $(LOCAL_PATH): ndk version root does not exist: $(my_ndk_version_root))
endif
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location. # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
# See ndk/docs/CPLUSPLUS-SUPPORT.html # See ndk/docs/CPLUSPLUS-SUPPORT.html
@ -40,7 +27,7 @@ ifdef LOCAL_NDK_VERSION
LOCAL_NDK_STL_VARIANT := system LOCAL_NDK_STL_VARIANT := system
endif endif
ifneq (1,$(words $(filter system stlport_static stlport_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT)))) ifneq (1,$(words $(filter system stlport_static stlport_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
$(error $(LOCAL_PATH): Unkown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT)) $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
endif endif
ifeq (system,$(LOCAL_NDK_STL_VARIANT)) ifeq (system,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
@ -58,7 +45,7 @@ ifdef LOCAL_NDK_VERSION
# LOCAL_NDK_STL_VARIANT is gnustl_static # LOCAL_NDK_STL_VARIANT is gnustl_static
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \ my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \
$(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libstdc++.a my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libgnustl_static.a
endif endif
endif endif
endif endif
@ -106,7 +93,7 @@ ifneq (,$(filter libcutils libutils,$(LOCAL_WHOLE_STATIC_LIBRARIES)))
LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES)) LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES))
endif endif
ifdef LOCAL_NDK_VERSION ifdef LOCAL_SDK_VERSION
# Get the list of INSTALLED libraries as module names. # Get the list of INSTALLED libraries as module names.
# We can not compute the full path of the LOCAL_SHARED_LIBRARIES for # We can not compute the full path of the LOCAL_SHARED_LIBRARIES for
# they may cusomize their install path with LOCAL_MODULE_PATH # they may cusomize their install path with LOCAL_MODULE_PATH
@ -133,7 +120,7 @@ ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
endif endif
# Add in libcompiler-rt for all regular device builds # Add in libcompiler-rt for all regular device builds
ifeq (,$(LOCAL_NDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(BUILD_TINY_ANDROID)) ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(BUILD_TINY_ANDROID))
LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES) LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
endif endif
@ -178,7 +165,7 @@ else
my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS) my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
endif endif
ifdef LOCAL_NDK_VERSION ifdef LOCAL_SDK_VERSION
my_target_project_includes := my_target_project_includes :=
my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
# TODO: more reliable way to remove platform stuff. # TODO: more reliable way to remove platform stuff.
@ -572,7 +559,7 @@ all_objects := \
LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
ifndef LOCAL_NDK_VERSION ifndef LOCAL_SDK_VERSION
LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
endif endif
@ -617,7 +604,7 @@ include $(BUILD_COPY_HEADERS)
so_suffix := $($(my_prefix)SHLIB_SUFFIX) so_suffix := $($(my_prefix)SHLIB_SUFFIX)
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX) a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
ifdef LOCAL_NDK_VERSION ifdef LOCAL_SDK_VERSION
built_shared_libraries := \ built_shared_libraries := \
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \ $(addsuffix $(so_suffix), \
@ -643,7 +630,7 @@ built_static_libraries := \
$(call intermediates-dir-for, \ $(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
ifdef LOCAL_NDK_VERSION ifdef LOCAL_SDK_VERSION
built_static_libraries += $(my_ndk_stl_static_lib) built_static_libraries += $(my_ndk_stl_static_lib)
endif endif

View file

@ -97,7 +97,6 @@ LOCAL_DX_FLAGS:=
LOCAL_CERTIFICATE:= LOCAL_CERTIFICATE:=
LOCAL_SDK_VERSION:= LOCAL_SDK_VERSION:=
LOCAL_SDK_RES_VERSION:= LOCAL_SDK_RES_VERSION:=
LOCAL_NDK_VERSION:=
LOCAL_NDK_STL_VARIANT:= LOCAL_NDK_STL_VARIANT:=
LOCAL_NO_EMMA_INSTRUMENT:= LOCAL_NO_EMMA_INSTRUMENT:=
LOCAL_NO_EMMA_COMPILE:= LOCAL_NO_EMMA_COMPILE:=

View file

@ -432,10 +432,6 @@ TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \ $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar))) $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
TARGET_AVAILABLE_NDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_NDK_VERSIONS_ROOT)/%/platforms,%, \
$(wildcard $(HISTORICAL_NDK_VERSIONS_ROOT)/*/platforms)))
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
# This is the standard way to name a directory containing prebuilt target # This is the standard way to name a directory containing prebuilt target

View file

@ -299,12 +299,12 @@ jni_shared_libraries := \
# libstlport_shared.so should never go to the system image. # libstlport_shared.so should never go to the system image.
# Instead it should be packaged into the apk. # Instead it should be packaged into the apk.
ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT)) ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
ifndef LOCAL_NDK_VERSION ifndef LOCAL_SDK_VERSION
$(error LOCAL_NDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \ $(error LOCAL_SDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \
LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME)) LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
endif endif
jni_shared_libraries += \ jni_shared_libraries += \
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
endif endif
# Set the abi directory used by the local JNI shared libraries. # Set the abi directory used by the local JNI shared libraries.

View file

@ -46,7 +46,7 @@ my_target_fdo_lib := $(TARGET_FDO_LIB)
my_target_libgcc := $(TARGET_LIBGCC) my_target_libgcc := $(TARGET_LIBGCC)
my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O) my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
my_target_crtend_so_o := $(TARGET_CRTEND_SO_O) my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
ifdef LOCAL_NDK_VERSION ifdef LOCAL_SDK_VERSION
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS, # Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree. # so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
my_target_global_ld_dirs := \ my_target_global_ld_dirs := \