Merge "Indent the install_jni_libs makefiles"

am: 6de8abc920

Change-Id: I4c54d83d362c7f686bb5382a875f49a52d57ae42
This commit is contained in:
Anton Hansson 2019-04-04 03:56:32 -07:00 committed by android-build-merger
commit d888386205
2 changed files with 127 additions and 127 deletions

View File

@ -13,10 +13,10 @@
my_embed_jni := my_embed_jni :=
ifneq ($(TARGET_BUILD_APPS),) ifneq ($(TARGET_BUILD_APPS),)
my_embed_jni := true my_embed_jni := true
endif endif
ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),) ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),)
my_embed_jni := true my_embed_jni := true
endif endif
# If the APK is not installed in one of the following partitions, force its libraries # If the APK is not installed in one of the following partitions, force its libraries
@ -29,13 +29,13 @@ supported_partition_patterns := \
$(TARGET_OUT_PRODUCT_SERVICES)/% \ $(TARGET_OUT_PRODUCT_SERVICES)/% \
ifeq ($(filter $(supported_partition_patterns),$(my_module_path)),) ifeq ($(filter $(supported_partition_patterns),$(my_module_path)),)
my_embed_jni := true my_embed_jni := true
endif endif
# If we're installing this APP as a compressed module, we include all JNI libraries # If we're installing this APP as a compressed module, we include all JNI libraries
# in the compressed artifact, rather than as separate files on the partition in question. # in the compressed artifact, rather than as separate files on the partition in question.
ifdef LOCAL_COMPRESSED_MODULE ifdef LOCAL_COMPRESSED_MODULE
my_embed_jni := true my_embed_jni := true
endif endif
jni_shared_libraries := jni_shared_libraries :=
@ -50,56 +50,56 @@ my_2nd_arch_prefix :=
my_add_jni := my_add_jni :=
# The module is built for TARGET_ARCH # The module is built for TARGET_ARCH
ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX)) ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX))
my_add_jni := true my_add_jni := true
endif endif
# Or it explicitly requires both # Or it explicitly requires both
ifeq ($(my_module_multilib),both) ifeq ($(my_module_multilib),both)
my_add_jni := true my_add_jni := true
endif endif
ifeq ($(my_add_jni),true) ifeq ($(my_add_jni),true)
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH)) my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH))
ifndef my_prebuilt_jni_libs ifndef my_prebuilt_jni_libs
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS) my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS)
endif endif
include $(BUILD_SYSTEM)/install_jni_libs_internal.mk include $(BUILD_SYSTEM)/install_jni_libs_internal.mk
jni_shared_libraries += $(my_jni_shared_libraries) jni_shared_libraries += $(my_jni_shared_libraries)
jni_shared_libraries_abis += $(my_jni_shared_libraries_abi) jni_shared_libraries_abis += $(my_jni_shared_libraries_abi)
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\ jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
$(my_jni_shared_libraries)) $(my_jni_shared_libraries))
embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs) embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs)
# Include RS dynamically-generated libraries as well # Include RS dynamically-generated libraries as well
# TODO: Add multilib support once RS supports generating multilib libraries. # TODO: Add multilib support once RS supports generating multilib libraries.
jni_shared_libraries += $(rs_compatibility_jni_libs) jni_shared_libraries += $(rs_compatibility_jni_libs)
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\ jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
$(rs_compatibility_jni_libs)) $(rs_compatibility_jni_libs))
endif # my_add_jni endif # my_add_jni
####################################### #######################################
# For TARGET_2ND_ARCH # For TARGET_2ND_ARCH
ifdef TARGET_2ND_ARCH ifdef TARGET_2ND_ARCH
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
my_add_jni := my_add_jni :=
# The module is built for TARGET_2ND_ARCH # The module is built for TARGET_2ND_ARCH
ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX)) ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX))
my_add_jni := true my_add_jni := true
endif endif
# Or it explicitly requires both # Or it explicitly requires both
ifeq ($(my_module_multilib),both) ifeq ($(my_module_multilib),both)
my_add_jni := true my_add_jni := true
endif endif
ifeq ($(my_add_jni),true) ifeq ($(my_add_jni),true)
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH)) my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH))
ifndef my_prebuilt_jni_libs ifndef my_prebuilt_jni_libs
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS) my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS)
endif endif
include $(BUILD_SYSTEM)/install_jni_libs_internal.mk include $(BUILD_SYSTEM)/install_jni_libs_internal.mk
jni_shared_libraries += $(my_jni_shared_libraries) jni_shared_libraries += $(my_jni_shared_libraries)
jni_shared_libraries_abis += $(my_jni_shared_libraries_abi) jni_shared_libraries_abis += $(my_jni_shared_libraries_abi)
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\ jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
$(my_jni_shared_libraries)) $(my_jni_shared_libraries))
embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs) embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs)
endif # my_add_jni endif # my_add_jni
endif # TARGET_2ND_ARCH endif # TARGET_2ND_ARCH
jni_shared_libraries := $(strip $(jni_shared_libraries)) jni_shared_libraries := $(strip $(jni_shared_libraries))

View File

@ -12,117 +12,117 @@
# my_embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk. # my_embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk.
# #
my_jni_shared_libraries := \ my_jni_shared_libraries := $(strip \
$(foreach lib,$(LOCAL_JNI_SHARED_LIBRARIES), \ $(foreach lib,$(LOCAL_JNI_SHARED_LIBRARIES), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(lib),,,$(my_2nd_arch_prefix))/$(lib).so) $(call intermediates-dir-for,SHARED_LIBRARIES,$(lib),,,$(my_2nd_arch_prefix))/$(lib).so))
# App-specific lib path. # App-specific lib path.
my_app_lib_path := $(dir $(LOCAL_INSTALLED_MODULE))lib/$(TARGET_$(my_2nd_arch_prefix)ARCH) my_app_lib_path := $(dir $(LOCAL_INSTALLED_MODULE))lib/$(TARGET_$(my_2nd_arch_prefix)ARCH)
my_embedded_prebuilt_jni_libs := my_embedded_prebuilt_jni_libs :=
ifdef my_embed_jni ifdef my_embed_jni
# App explicitly requires the prebuilt NDK stl shared libraies. # App explicitly requires the prebuilt NDK stl shared libraies.
# The NDK stl shared libraries should never go to the system image. # The NDK stl shared libraries should never go to the system image.
ifeq ($(LOCAL_NDK_STL_VARIANT),c++_shared) ifeq ($(LOCAL_NDK_STL_VARIANT),c++_shared)
ifndef LOCAL_SDK_VERSION ifndef LOCAL_SDK_VERSION
$(error LOCAL_SDK_VERSION must be defined with LOCAL_NDK_STL_VARIANT, \ $(error LOCAL_SDK_VERSION must be defined with LOCAL_NDK_STL_VARIANT, \
LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME)) LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
endif endif
my_jni_shared_libraries += \ my_jni_shared_libraries += \
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources/cxx-stl/llvm-libc++/libs/$(TARGET_$(my_2nd_arch_prefix)CPU_ABI)/libc++_shared.so $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources/cxx-stl/llvm-libc++/libs/$(TARGET_$(my_2nd_arch_prefix)CPU_ABI)/libc++_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.
# (Doesn't change how the local shared libraries are compiled, just # (Doesn't change how the local shared libraries are compiled, just
# sets where they are stored in the apk.) # sets where they are stored in the apk.)
ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),) ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
my_jni_shared_libraries_abi := $(TARGET_$(my_2nd_arch_prefix)CPU_ABI) my_jni_shared_libraries_abi := $(TARGET_$(my_2nd_arch_prefix)CPU_ABI)
else else
my_jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI) my_jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
endif endif
else # not my_embed_jni else ifneq ($(my_jni_shared_libraries),) # not my_embed_jni
my_jni_shared_libraries := $(strip $(my_jni_shared_libraries)) # The jni libaries will be installed to the system.img.
ifneq ($(my_jni_shared_libraries),) my_jni_filenames := $(notdir $(my_jni_shared_libraries))
# The jni libaries will be installed to the system.img. # Make sure the JNI libraries get installed
my_jni_filenames := $(notdir $(my_jni_shared_libraries)) my_shared_library_path := $(call get_non_asan_path,\
# Make sure the JNI libraries get installed $($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
my_shared_library_path := $(call get_non_asan_path,\ my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
$($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES)) # Do not use order-only dependency, because we want to rebuild the image if an jni is updated.
# Do not use order-only dependency, because we want to rebuild the image if an jni is updated. $(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
$(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
# Create symlink in the app specific lib path ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
# Skip creating this symlink when running the second part of a target sanitization build.
ifeq ($(filter address,$(SANITIZE_TARGET)),)
ifdef LOCAL_POST_INSTALL_CMD
# Add a shell command separator
LOCAL_POST_INSTALL_CMD += ;
endif
my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\ # Create symlink in the app specific lib path
$(my_shared_library_path)) # Skip creating this symlink when running the second part of a target sanitization build.
LOCAL_POST_INSTALL_CMD += \ ifeq ($(filter address,$(SANITIZE_TARGET)),)
mkdir -p $(my_app_lib_path) \ ifdef LOCAL_POST_INSTALL_CMD
$(foreach lib, $(my_jni_filenames), ;ln -sf $(my_symlink_target_dir)/$(lib) $(my_app_lib_path)/$(lib)) # Add a shell command separator
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) LOCAL_POST_INSTALL_CMD += ;
else endif
ifdef LOCAL_POST_INSTALL_CMD
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
endif
endif
# Clear jni_shared_libraries to not embed it into the apk. my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
my_jni_shared_libraries := $(my_shared_library_path))
endif # $(my_jni_shared_libraries) not empty LOCAL_POST_INSTALL_CMD += \
mkdir -p $(my_app_lib_path) \
$(foreach lib, $(my_jni_filenames), ;ln -sf $(my_symlink_target_dir)/$(lib) $(my_app_lib_path)/$(lib))
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
else
ifdef LOCAL_POST_INSTALL_CMD
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
endif
endif
# Clear jni_shared_libraries to not embed it into the apk.
my_jni_shared_libraries :=
endif # my_embed_jni endif # my_embed_jni
ifdef my_prebuilt_jni_libs ifdef my_prebuilt_jni_libs
# Files like @lib/<abi>/libfoo.so (path inside the apk) are JNI libs embedded prebuilt apk; # Files like @lib/<abi>/libfoo.so (path inside the apk) are JNI libs embedded prebuilt apk;
# Files like path/to/libfoo.so (path relative to LOCAL_PATH) are prebuilts in the source tree. # Files like path/to/libfoo.so (path relative to LOCAL_PATH) are prebuilts in the source tree.
my_embedded_prebuilt_jni_libs := $(patsubst @%,%, \ my_embedded_prebuilt_jni_libs := $(patsubst @%,%, \
$(filter @%, $(my_prebuilt_jni_libs))) $(filter @%, $(my_prebuilt_jni_libs)))
# prebuilt JNI exsiting as separate source files. # prebuilt JNI exsiting as separate source files.
my_prebuilt_jni_libs := $(addprefix $(LOCAL_PATH)/, \ my_prebuilt_jni_libs := $(addprefix $(LOCAL_PATH)/, \
$(filter-out @%, $(my_prebuilt_jni_libs))) $(filter-out @%, $(my_prebuilt_jni_libs)))
ifdef my_prebuilt_jni_libs ifdef my_prebuilt_jni_libs
ifdef my_embed_jni ifdef my_embed_jni
# Embed my_prebuilt_jni_libs to the apk # Embed my_prebuilt_jni_libs to the apk
my_jni_shared_libraries += $(my_prebuilt_jni_libs) my_jni_shared_libraries += $(my_prebuilt_jni_libs)
else # not my_embed_jni else # not my_embed_jni
# Install my_prebuilt_jni_libs as separate files. # Install my_prebuilt_jni_libs as separate files.
$(foreach lib, $(my_prebuilt_jni_libs), \ $(foreach lib, $(my_prebuilt_jni_libs), \
$(eval $(call copy-one-file, $(lib), $(my_app_lib_path)/$(notdir $(lib))))) $(eval $(call copy-one-file, $(lib), $(my_app_lib_path)/$(notdir $(lib)))))
my_installed_library := $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebuilt_jni_libs))) my_installed_library := $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebuilt_jni_libs)))
$(LOCAL_INSTALLED_MODULE) : $(my_installed_library) $(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
endif # my_embed_jni ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
endif # inner my_prebuilt_jni_libs endif # my_embed_jni
endif # inner my_prebuilt_jni_libs
endif # outer my_prebuilt_jni_libs endif # outer my_prebuilt_jni_libs
# Verify that all included libraries are built against the NDK # Verify that all included libraries are built against the NDK
include $(BUILD_SYSTEM)/allowed_ndk_types.mk include $(BUILD_SYSTEM)/allowed_ndk_types.mk
ifneq ($(strip $(LOCAL_JNI_SHARED_LIBRARIES)),) ifneq ($(strip $(LOCAL_JNI_SHARED_LIBRARIES)),)
ifneq ($(LOCAL_SDK_VERSION),) ifneq ($(LOCAL_SDK_VERSION),)
my_link_type := app:sdk my_link_type := app:sdk
my_warn_types := native:platform $(my_warn_ndk_types) my_warn_types := native:platform $(my_warn_ndk_types)
my_allowed_types := $(my_allowed_ndk_types) my_allowed_types := $(my_allowed_ndk_types)
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
my_allowed_types += native:vendor native:vndk native:platform_vndk my_allowed_types += native:vendor native:vndk native:platform_vndk
endif endif
else else
my_link_type := app:platform my_link_type := app:platform
my_warn_types := $(my_warn_ndk_types) my_warn_types := $(my_warn_ndk_types)
my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private native:platform_vndk my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private native:platform_vndk
endif endif
my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES)) my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
my_common := my_common :=
include $(BUILD_SYSTEM)/link_type.mk include $(BUILD_SYSTEM)/link_type.mk
endif endif