1# Decides how to install the jni libraries needed by an apk. 2# Input variables: 3# my_module_multilib, LOCAL_2ND_ARCH_VAR_PREFIX (from package.mk or prebuilt.mk) 4# rs_compatibility_jni_libs (from java.mk) 5# my_module_path (from base_rules.mk) 6# partition_tag (from base_rules.mk) 7# my_prebuilt_src_file (from prebuilt_internal.mk) 8# 9# Output variables: 10# jni_shared_libraries, jni_shared_libraries_abi, jni_shared_libraries_with_abis if we are going to embed the libraries into the apk; 11# extracted_jni_libs, if we extract jni libs from prebuilt apk. 12# 13 14my_embed_jni := 15ifneq ($(TARGET_BUILD_APPS),) 16my_embed_jni := true 17endif 18ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),) 19my_embed_jni := true 20endif 21ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),) 22# If this app isn't to be installed to system partitions. 23my_embed_jni := true 24endif 25 26jni_shared_libraries := 27jni_shared_libraries_abis := 28# jni_shared_libraries_with_abis is a list of <abi>:<path-to-the-built-jni-lib> 29jni_shared_libraries_with_abis := 30extracted_jni_libs := 31 32####################################### 33# For TARGET_ARCH 34my_2nd_arch_prefix := 35my_add_jni := 36# The module is built for TARGET_ARCH 37ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX)) 38my_add_jni := true 39endif 40# Or it explicitly requires both 41ifeq ($(my_module_multilib),both) 42my_add_jni := true 43endif 44ifeq ($(my_add_jni),true) 45my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH)) 46ifndef my_prebuilt_jni_libs 47my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS) 48endif 49include $(BUILD_SYSTEM)/install_jni_libs_internal.mk 50jni_shared_libraries += $(my_jni_shared_libraries) 51jni_shared_libraries_abis += $(my_jni_shared_libraries_abi) 52jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\ 53 $(my_jni_shared_libraries)) 54extracted_jni_libs += $(my_extracted_jni_libs) 55 56# Include RS dynamically-generated libraries as well 57# TODO: Add multilib support once RS supports generating multilib libraries. 58jni_shared_libraries += $(rs_compatibility_jni_libs) 59jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\ 60 $(rs_compatibility_jni_libs)) 61endif # my_add_jni 62 63####################################### 64# For TARGET_2ND_ARCH 65ifdef TARGET_2ND_ARCH 66my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 67my_add_jni := 68# The module is built for TARGET_2ND_ARCH 69ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX)) 70my_add_jni := true 71endif 72# Or it explicitly requires both 73ifeq ($(my_module_multilib),both) 74my_add_jni := true 75endif 76ifeq ($(my_add_jni),true) 77my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH)) 78ifndef my_prebuilt_jni_libs 79my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS) 80endif 81include $(BUILD_SYSTEM)/install_jni_libs_internal.mk 82jni_shared_libraries += $(my_jni_shared_libraries) 83jni_shared_libraries_abis += $(my_jni_shared_libraries_abi) 84jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\ 85 $(my_jni_shared_libraries)) 86extracted_jni_libs += $(my_extracted_jni_libs) 87endif # my_add_jni 88endif # TARGET_2ND_ARCH 89 90jni_shared_libraries := $(strip $(jni_shared_libraries)) 91jni_shared_libraries_abis := $(sort $(jni_shared_libraries_abis)) 92jni_shared_libraries_with_abis := $(strip $(jni_shared_libraries_with_abis)) 93extracted_jni_libs := $(strip $(extracted_jni_libs)) 94