From 848020f22a5e305ddf8814942e71d8120509a4ec Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 14 Aug 2012 10:13:16 -0700 Subject: [PATCH] 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 --- core/binary.mk | 39 +++++++++++++-------------------------- core/clear_vars.mk | 1 - core/config.mk | 4 ---- core/package.mk | 6 +++--- core/shared_library.mk | 2 +- 5 files changed, 17 insertions(+), 35 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index 08f7162111..77e6aee78c 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -5,30 +5,17 @@ ## The list of object files is exported in $(all_objects). ########################################################### -###################################### -## Sanity check for LOCAL_NDK_VERSION -###################################### my_ndk_version_root := -ifdef LOCAL_NDK_VERSION +ifdef LOCAL_SDK_VERSION 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 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)) endif - ifeq ($(filter $(LOCAL_NDK_VERSION),$(TARGET_AVAILABLE_NDK_VERSIONS)),) - $(error $(LOCAL_PATH): Invalid LOCAL_NDK_VERSION '$(LOCAL_NDK_VERSION)' \ - 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 + my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources + my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH) # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location. # See ndk/docs/CPLUSPLUS-SUPPORT.html @@ -40,7 +27,7 @@ ifdef LOCAL_NDK_VERSION LOCAL_NDK_STL_VARIANT := system endif 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 ifeq (system,$(LOCAL_NDK_STL_VARIANT)) 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 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_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 @@ -106,7 +93,7 @@ ifneq (,$(filter libcutils libutils,$(LOCAL_WHOLE_STATIC_LIBRARIES))) LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES)) endif -ifdef LOCAL_NDK_VERSION +ifdef LOCAL_SDK_VERSION # Get the list of INSTALLED libraries as module names. # We can not compute the full path of the LOCAL_SHARED_LIBRARIES for # they may cusomize their install path with LOCAL_MODULE_PATH @@ -133,7 +120,7 @@ ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true) endif # 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) endif @@ -178,7 +165,7 @@ else my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS) endif -ifdef LOCAL_NDK_VERSION +ifdef LOCAL_SDK_VERSION my_target_project_includes := my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include # TODO: more reliable way to remove platform stuff. @@ -572,7 +559,7 @@ all_objects := \ LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) -ifndef LOCAL_NDK_VERSION +ifndef LOCAL_SDK_VERSION LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) endif @@ -617,7 +604,7 @@ include $(BUILD_COPY_HEADERS) so_suffix := $($(my_prefix)SHLIB_SUFFIX) a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX) -ifdef LOCAL_NDK_VERSION +ifdef LOCAL_SDK_VERSION built_shared_libraries := \ $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ $(addsuffix $(so_suffix), \ @@ -643,7 +630,7 @@ built_static_libraries := \ $(call intermediates-dir-for, \ 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) endif diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 8273eb66db..a564b3cddf 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -97,7 +97,6 @@ LOCAL_DX_FLAGS:= LOCAL_CERTIFICATE:= LOCAL_SDK_VERSION:= LOCAL_SDK_RES_VERSION:= -LOCAL_NDK_VERSION:= LOCAL_NDK_STL_VARIANT:= LOCAL_NO_EMMA_INSTRUMENT:= LOCAL_NO_EMMA_COMPILE:= diff --git a/core/config.mk b/core/config.mk index b54e6d8c88..e3b11999ce 100644 --- a/core/config.mk +++ b/core/config.mk @@ -432,10 +432,6 @@ TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\ $(patsubst $(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 # This is the standard way to name a directory containing prebuilt target diff --git a/core/package.mk b/core/package.mk index fac954992b..7b10c3381c 100644 --- a/core/package.mk +++ b/core/package.mk @@ -299,12 +299,12 @@ jni_shared_libraries := \ # libstlport_shared.so should never go to the system image. # Instead it should be packaged into the apk. ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT)) -ifndef LOCAL_NDK_VERSION -$(error LOCAL_NDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \ +ifndef LOCAL_SDK_VERSION +$(error LOCAL_SDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \ LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME)) endif 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 # Set the abi directory used by the local JNI shared libraries. diff --git a/core/shared_library.mk b/core/shared_library.mk index ab7480d56e..122cd299b8 100644 --- a/core/shared_library.mk +++ b/core/shared_library.mk @@ -46,7 +46,7 @@ my_target_fdo_lib := $(TARGET_FDO_LIB) my_target_libgcc := $(TARGET_LIBGCC) my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_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, # 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 := \