Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 1 | ########################################################### |
| 2 | ## Standard rules for copying files that are prebuilt |
| 3 | ## |
| 4 | ## Additional inputs from base_rules.make: |
| 5 | ## None. |
| 6 | ## |
| 7 | ########################################################### |
| 8 | |
Chih-Hung Hsieh | 32427d6 | 2018-04-12 10:55:54 -0700 | [diff] [blame] | 9 | include $(BUILD_SYSTEM)/use_lld_setup.mk |
| 10 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 11 | ifneq ($(LOCAL_PREBUILT_LIBS),) |
Colin Cross | 8466769 | 2018-06-25 13:20:04 -0700 | [diff] [blame] | 12 | $(call pretty-error,dont use LOCAL_PREBUILT_LIBS anymore) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 13 | endif |
| 14 | ifneq ($(LOCAL_PREBUILT_EXECUTABLES),) |
Colin Cross | 8466769 | 2018-06-25 13:20:04 -0700 | [diff] [blame] | 15 | $(call pretty-error,dont use LOCAL_PREBUILT_EXECUTABLES anymore) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 16 | endif |
| 17 | ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),) |
Colin Cross | 8466769 | 2018-06-25 13:20:04 -0700 | [diff] [blame] | 18 | $(call pretty-error,dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 19 | endif |
| 20 | |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 21 | my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32) |
| 22 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 23 | ifdef LOCAL_PREBUILT_MODULE_FILE |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 24 | my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) |
Dan Willemsen | 926ee44 | 2018-02-27 23:27:30 +0000 | [diff] [blame] | 25 | else ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
| 26 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
| 27 | LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := |
| 28 | else ifdef LOCAL_SRC_FILES_$(my_32_64_bit_suffix) |
| 29 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) |
| 30 | LOCAL_SRC_FILES_$(my_32_64_bit_suffix) := |
| 31 | else ifdef LOCAL_SRC_FILES |
| 32 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES) |
| 33 | LOCAL_SRC_FILES := |
| 34 | else ifdef LOCAL_REPLACE_PREBUILT_APK_INSTALLED |
| 35 | # This is handled specially below |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 36 | else |
Dan Willemsen | 926ee44 | 2018-02-27 23:27:30 +0000 | [diff] [blame] | 37 | $(call pretty-error,No source files specified) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 38 | endif |
| 39 | |
Colin Cross | 01e1b8f | 2016-10-27 22:10:55 +0000 | [diff] [blame] | 40 | LOCAL_CHECKED_MODULE := $(my_prebuilt_src_file) |
| 41 | |
Jaewoong Jung | 09bfe55 | 2019-03-18 14:25:00 -0700 | [diff] [blame^] | 42 | ifeq (APPS,$(LOCAL_MODULE_CLASS)) |
| 43 | include $(BUILD_SYSTEM)/app_prebuilt_internal.mk |
| 44 | else |
| 45 | # |
| 46 | # Non-APPS prebuilt modules handling almost to the end of the file |
| 47 | # |
| 48 | |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 49 | my_strip_module := $(firstword \ |
| 50 | $(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \ |
| 51 | $(LOCAL_STRIP_MODULE)) |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 52 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 53 | ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 54 | ifeq ($(LOCAL_IS_HOST_MODULE)$(my_strip_module),) |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 55 | # Strip but not try to add debuglink |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 56 | my_strip_module := no_debuglink |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 57 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 58 | endif |
| 59 | |
| 60 | ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) |
| 61 | prebuilt_module_is_a_library := true |
| 62 | else |
| 63 | prebuilt_module_is_a_library := |
| 64 | endif |
| 65 | |
| 66 | # Don't install static libraries by default. |
| 67 | ifndef LOCAL_UNINSTALLABLE_MODULE |
| 68 | ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 69 | LOCAL_UNINSTALLABLE_MODULE := true |
| 70 | endif |
| 71 | endif |
| 72 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 73 | ifeq (JAVA_LIBRARIES,$(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS)$(filter true,$(LOCAL_UNINSTALLABLE_MODULE))) |
| 74 | prebuilt_module_is_dex_javalib := true |
| 75 | else |
| 76 | prebuilt_module_is_dex_javalib := |
| 77 | endif |
| 78 | |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 79 | ifdef LOCAL_COMPRESSED_MODULE |
| 80 | $(error $(LOCAL_MODULE) : LOCAL_COMPRESSED_MODULE can only be defined for module class APPS) |
| 81 | endif # LOCAL_COMPRESSED_MODULE |
Narayan Kamath | 7c20510 | 2017-08-07 12:31:17 +0100 | [diff] [blame] | 82 | |
Colin Cross | 979f9f9 | 2018-06-25 12:33:35 -0700 | [diff] [blame] | 83 | ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module)),) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 84 | ifdef LOCAL_IS_HOST_MODULE |
Colin Cross | 8466769 | 2018-06-25 13:20:04 -0700 | [diff] [blame] | 85 | $(call pretty-error,Cannot strip/pack host module) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 86 | endif |
Dan Willemsen | 7fe992c | 2016-03-02 13:54:51 -0800 | [diff] [blame] | 87 | ifeq ($(filter SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),) |
Colin Cross | 8466769 | 2018-06-25 13:20:04 -0700 | [diff] [blame] | 88 | $(call pretty-error,Can strip/pack only shared libraries or executables) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 89 | endif |
| 90 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Colin Cross | 8466769 | 2018-06-25 13:20:04 -0700 | [diff] [blame] | 91 | $(call pretty-error,Cannot strip/pack scripts) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 92 | endif |
Colin Cross | 979f9f9 | 2018-06-25 12:33:35 -0700 | [diff] [blame] | 93 | # Set the arch-specific variables to set up the strip rules |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 94 | LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_strip_module) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 95 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 96 | built_module := $(linked_module) |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 97 | |
Colin Cross | 979f9f9 | 2018-06-25 12:33:35 -0700 | [diff] [blame] | 98 | else # my_strip_module not true |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 99 | include $(BUILD_SYSTEM)/base_rules.mk |
| 100 | built_module := $(LOCAL_BUILT_MODULE) |
| 101 | |
| 102 | ifdef prebuilt_module_is_a_library |
| 103 | export_includes := $(intermediates)/export_includes |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 104 | export_cflags := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d)) |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 105 | $(export_includes): PRIVATE_EXPORT_CFLAGS := $(export_cflags) |
Dan Willemsen | ba6a164 | 2016-09-29 12:08:29 -0700 | [diff] [blame] | 106 | $(export_includes): $(LOCAL_EXPORT_C_INCLUDE_DEPS) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 107 | @echo Export includes file: $< -- $@ |
| 108 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 109 | ifdef export_cflags |
| 110 | $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >$@ |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 111 | else |
| 112 | $(hide) touch $@ |
| 113 | endif |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 114 | export_cflags := |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 115 | |
Dan Albert | 975e303 | 2017-12-19 11:26:05 -0800 | [diff] [blame] | 116 | include $(BUILD_SYSTEM)/allowed_ndk_types.mk |
| 117 | |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 118 | ifdef LOCAL_SDK_VERSION |
Dan Albert | 4297c39 | 2017-12-19 11:27:39 -0800 | [diff] [blame] | 119 | my_link_type := native:ndk:$(my_ndk_stl_family):$(my_ndk_stl_link_type) |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 120 | else ifdef LOCAL_USE_VNDK |
Jiyong Park | a3fb158 | 2017-08-16 18:28:12 +0900 | [diff] [blame] | 121 | _name := $(patsubst %.vendor,%,$(LOCAL_MODULE)) |
| 122 | ifneq ($(filter $(_name),$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(LLNDK_LIBRARIES)),) |
| 123 | ifeq ($(filter $(_name),$(VNDK_PRIVATE_LIBRARIES)),) |
| 124 | my_link_type := native:vndk |
| 125 | else |
| 126 | my_link_type := native:vndk_private |
| 127 | endif |
| 128 | else |
| 129 | my_link_type := native:vendor |
| 130 | endif |
Jiyong Park | 5dc3475 | 2018-08-28 12:32:45 +0900 | [diff] [blame] | 131 | else ifneq ($(filter $(TARGET_RECOVERY_OUT)/%,$(LOCAL_MODULE_PATH)),) |
| 132 | my_link_type := native:recovery |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 133 | else |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 134 | my_link_type := native:platform |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 135 | endif |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 136 | |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 137 | # TODO: check dependencies of prebuilt files |
| 138 | my_link_deps := |
| 139 | |
| 140 | my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 141 | my_common := |
| 142 | include $(BUILD_SYSTEM)/link_type.mk |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 143 | endif # prebuilt_module_is_a_library |
| 144 | |
| 145 | # The real dependency will be added after all Android.mks are loaded and the install paths |
| 146 | # of the shared libraries are determined. |
| 147 | ifdef LOCAL_INSTALLED_MODULE |
Logan Chien | 3291184 | 2019-01-31 12:05:12 +0800 | [diff] [blame] | 148 | ifdef LOCAL_IS_HOST_MODULE |
| 149 | ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) |
| 150 | my_system_shared_libraries := |
| 151 | else |
| 152 | my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) |
| 153 | endif |
| 154 | else |
| 155 | ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) |
| 156 | my_system_shared_libraries := libc libm libdl |
| 157 | else |
| 158 | my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) |
| 159 | my_system_shared_libraries := $(patsubst libc,libc libdl,$(my_system_shared_libraries)) |
| 160 | endif |
| 161 | endif |
| 162 | |
| 163 | my_shared_libraries := \ |
| 164 | $(filter-out $(my_system_shared_libraries),$(LOCAL_SHARED_LIBRARIES)) \ |
| 165 | $(my_system_shared_libraries) |
| 166 | |
| 167 | ifdef my_shared_libraries |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 168 | # Extra shared libraries introduced by LOCAL_CXX_STL. |
| 169 | include $(BUILD_SYSTEM)/cxx_stl_setup.mk |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 170 | ifdef LOCAL_USE_VNDK |
Colin Cross | 8fb525d | 2018-09-06 16:25:22 -0700 | [diff] [blame] | 171 | my_shared_libraries := $(foreach l,$(my_shared_libraries),\ |
| 172 | $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 173 | endif |
Ying Wang | 58f462f | 2014-02-25 18:26:29 -0800 | [diff] [blame] | 174 | $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 175 | $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 176 | endif |
Logan Chien | 3291184 | 2019-01-31 12:05:12 +0800 | [diff] [blame] | 177 | endif # my_shared_libraries |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 178 | |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 179 | # We need to enclose the above export_includes and my_built_shared_libraries in |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 180 | # "my_strip_module not true" because otherwise the rules are defined in dynamic_binary.mk. |
| 181 | endif # my_strip_module not true |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 182 | |
Logan Chien | 6549cd0 | 2019-01-31 12:05:32 +0800 | [diff] [blame] | 183 | # Check prebuilt ELF binaries. |
| 184 | include $(BUILD_SYSTEM)/check_elf_file.mk |
| 185 | |
Dan Willemsen | 9f95665 | 2016-10-21 15:04:12 -0700 | [diff] [blame] | 186 | ifeq ($(NATIVE_COVERAGE),true) |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 187 | ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE))) |
| 188 | $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).gcnodir)) |
| 189 | ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true) |
| 190 | ifdef LOCAL_IS_HOST_MODULE |
| 191 | my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path)) |
| 192 | else |
| 193 | my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) |
| 194 | endif |
Dan Willemsen | ba9badf | 2017-11-20 12:45:48 -0800 | [diff] [blame] | 195 | my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).gcnodir |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 196 | $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path))) |
| 197 | $(LOCAL_BUILT_MODULE): $(my_coverage_path) |
| 198 | endif |
| 199 | else |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 200 | # Coverage information is needed when static lib is a dependency of another |
| 201 | # coverage-enabled module. |
| 202 | ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS)) |
| 203 | GCNO_ARCHIVE := $(LOCAL_MODULE).gcnodir |
| 204 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := |
| 205 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := |
Dan Willemsen | 9f95665 | 2016-10-21 15:04:12 -0700 | [diff] [blame] | 206 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix) |
| 207 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 208 | $(intermediates)/$(GCNO_ARCHIVE) : |
| 209 | $(transform-o-to-static-lib) |
| 210 | endif |
Dan Willemsen | 9f95665 | 2016-10-21 15:04:12 -0700 | [diff] [blame] | 211 | endif |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 212 | endif |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 213 | |
Jaewoong Jung | 09bfe55 | 2019-03-18 14:25:00 -0700 | [diff] [blame^] | 214 | ifeq ($(prebuilt_module_is_dex_javalib),true) |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 215 | my_dex_jar := $(my_prebuilt_src_file) |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 216 | # This is a target shared library, i.e. a jar with classes.dex. |
Colin Cross | 47e384c | 2019-02-11 14:25:13 -0800 | [diff] [blame] | 217 | |
| 218 | ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) |
| 219 | $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files) |
| 220 | endif |
| 221 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 222 | ####################################### |
| 223 | # defines built_odex along with rule to install odex |
| 224 | include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk |
| 225 | ####################################### |
| 226 | ifdef LOCAL_DEX_PREOPT |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 227 | |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 228 | $(built_module): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh |
| 229 | $(built_module): $(intermediates)/strip.sh |
Colin Cross | ded0aec | 2019-01-17 16:22:04 -0800 | [diff] [blame] | 230 | $(built_module): | $(DEXPREOPT_STRIP_DEPS) |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 231 | $(built_module): .KATI_DEPFILE := $(built_module).d |
| 232 | $(built_module): $(my_prebuilt_src_file) |
| 233 | $(PRIVATE_STRIP_SCRIPT) $< $@ |
| 234 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 235 | else # ! LOCAL_DEX_PREOPT |
| 236 | $(built_module) : $(my_prebuilt_src_file) |
| 237 | $(call copy-file-to-target) |
| 238 | endif # LOCAL_DEX_PREOPT |
| 239 | |
| 240 | else # ! prebuilt_module_is_dex_javalib |
Tom Cherry | fc97764 | 2018-06-13 14:51:05 -0700 | [diff] [blame] | 241 | ifneq ($(filter init%rc,$(notdir $(LOCAL_INSTALLED_MODULE)))$(filter %/etc/init,$(dir $(LOCAL_INSTALLED_MODULE))),) |
| 242 | $(eval $(call copy-init-script-file-checked,$(my_prebuilt_src_file),$(built_module))) |
| 243 | else ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 244 | $(built_module) : $(my_prebuilt_src_file) |
| 245 | $(transform-prebuilt-to-target-strip-comments) |
| 246 | else |
Tom Cherry | fc97764 | 2018-06-13 14:51:05 -0700 | [diff] [blame] | 247 | $(built_module) : $(my_prebuilt_src_file) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 248 | $(transform-prebuilt-to-target) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 249 | endif |
Dan Willemsen | 7fe992c | 2016-03-02 13:54:51 -0800 | [diff] [blame] | 250 | ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),) |
Dan Willemsen | 08420cb | 2016-03-01 22:04:57 -0800 | [diff] [blame] | 251 | $(hide) chmod +x $@ |
| 252 | endif |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 253 | endif # ! prebuilt_module_is_dex_javalib |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 254 | |
Ying Wang | 8c89b4b | 2016-02-22 15:54:27 -0800 | [diff] [blame] | 255 | ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) |
| 256 | my_src_jar := $(my_prebuilt_src_file) |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 257 | |
| 258 | ifdef LOCAL_IS_HOST_MODULE |
| 259 | # for host java libraries deps should be in the common dir, so we make a copy in |
| 260 | # the common dir. |
| 261 | common_classes_jar := $(intermediates.COMMON)/classes.jar |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 262 | common_header_jar := $(intermediates.COMMON)/classes-header.jar |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 263 | |
Colin Cross | 96476c1 | 2017-04-06 09:56:19 -0700 | [diff] [blame] | 264 | $(common_classes_jar): PRIVATE_MODULE := $(LOCAL_MODULE) |
Colin Cross | d2e778f | 2017-04-14 15:14:33 -0700 | [diff] [blame] | 265 | $(common_classes_jar): PRIVATE_PREFIX := $(my_prefix) |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 266 | |
| 267 | $(common_classes_jar) : $(my_src_jar) |
| 268 | $(transform-prebuilt-to-target) |
| 269 | |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 270 | ifneq ($(TURBINE_ENABLED),false) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 271 | $(common_header_jar) : $(my_src_jar) |
| 272 | $(transform-prebuilt-to-target) |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 273 | endif |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 274 | |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 275 | else # !LOCAL_IS_HOST_MODULE |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 276 | # for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, |
| 277 | # while the deps should be in the common dir, so we make a copy in the common dir. |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 278 | common_classes_jar := $(intermediates.COMMON)/classes.jar |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 279 | common_header_jar := $(intermediates.COMMON)/classes-header.jar |
Colin Cross | 950f1ef | 2017-04-05 15:30:42 -0700 | [diff] [blame] | 280 | common_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 281 | common_javalib_jar := $(intermediates.COMMON)/javalib.jar |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 282 | |
Colin Cross | d2e778f | 2017-04-14 15:14:33 -0700 | [diff] [blame] | 283 | $(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE) |
| 284 | $(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_PREFIX := $(my_prefix) |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 285 | |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 286 | ifeq ($(LOCAL_SDK_VERSION),system_current) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 287 | my_link_type := java:system |
Sundong Ahn | 5a44d1f | 2017-10-16 19:20:34 +0900 | [diff] [blame] | 288 | else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) |
| 289 | my_link_type := java:system |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 290 | else ifeq ($(LOCAL_SDK_VERSION),core_current) |
| 291 | my_link_type := java:core |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 292 | else ifneq ($(LOCAL_SDK_VERSION),) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 293 | my_link_type := java:sdk |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 294 | else |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 295 | my_link_type := java:platform |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 296 | endif |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 297 | |
| 298 | # TODO: check dependencies of prebuilt files |
| 299 | my_link_deps := |
| 300 | |
| 301 | my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 302 | my_common := COMMON |
| 303 | include $(BUILD_SYSTEM)/link_type.mk |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 304 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 305 | ifeq ($(prebuilt_module_is_dex_javalib),true) |
| 306 | # For prebuilt shared Java library we don't have classes.jar. |
| 307 | $(common_javalib_jar) : $(my_src_jar) |
| 308 | $(transform-prebuilt-to-target) |
| 309 | |
| 310 | else # ! prebuilt_module_is_dex_javalib |
| 311 | |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 312 | my_src_aar := $(filter %.aar, $(my_prebuilt_src_file)) |
| 313 | ifneq ($(my_src_aar),) |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 314 | # This is .aar file, archive of classes.jar and Android resources. |
Jeff Gaston | db6557e | 2018-02-27 14:05:40 -0500 | [diff] [blame] | 315 | |
| 316 | # run Jetifier if needed |
| 317 | LOCAL_JETIFIER_INPUT_FILE := $(my_src_aar) |
| 318 | include $(BUILD_SYSTEM)/jetifier.mk |
| 319 | my_src_aar := $(LOCAL_JETIFIER_OUTPUT_FILE) |
| 320 | |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 321 | my_src_jar := $(intermediates.COMMON)/aar/classes.jar |
Dan Willemsen | 1d64623 | 2017-11-17 13:11:26 -0800 | [diff] [blame] | 322 | my_src_proguard_options := $(intermediates.COMMON)/aar/proguard.txt |
Colin Cross | 93fbe84 | 2018-06-12 14:02:41 -0700 | [diff] [blame] | 323 | my_src_android_manifest := $(intermediates.COMMON)/aar/AndroidManifest.xml |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 324 | |
Dan Willemsen | 1d64623 | 2017-11-17 13:11:26 -0800 | [diff] [blame] | 325 | $(my_src_jar) : .KATI_IMPLICIT_OUTPUTS := $(my_src_proguard_options) |
Colin Cross | 93fbe84 | 2018-06-12 14:02:41 -0700 | [diff] [blame] | 326 | $(my_src_jar) : .KATI_IMPLICIT_OUTPUTS += $(my_src_android_manifest) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 327 | $(my_src_jar) : $(my_src_aar) |
Dan Willemsen | 7a1ad6c | 2017-04-27 23:10:47 -0700 | [diff] [blame] | 328 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(dir $@)/res |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 329 | $(hide) unzip -qo -d $(dir $@) $< |
| 330 | # Make sure the extracted classes.jar has a new timestamp. |
| 331 | $(hide) touch $@ |
Colin Cross | 93fbe84 | 2018-06-12 14:02:41 -0700 | [diff] [blame] | 332 | # Make sure the proguard and AndroidManifest.xml files exist |
| 333 | # and have a new timestamp. |
Dan Willemsen | 1d64623 | 2017-11-17 13:11:26 -0800 | [diff] [blame] | 334 | $(hide) touch $(dir $@)/proguard.txt |
Colin Cross | 93fbe84 | 2018-06-12 14:02:41 -0700 | [diff] [blame] | 335 | $(hide) touch $(dir $@)/AndroidManifest.xml |
Colin Cross | 8e92179 | 2018-06-07 16:44:07 -0700 | [diff] [blame] | 336 | |
| 337 | my_prebuilt_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml |
| 338 | $(eval $(call copy-one-file,$(my_src_android_manifest),$(my_prebuilt_android_manifest))) |
| 339 | $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_prebuilt_android_manifest)) |
| 340 | |
Jeff Gaston | db6557e | 2018-02-27 14:05:40 -0500 | [diff] [blame] | 341 | else |
| 342 | |
| 343 | # run Jetifier if needed |
| 344 | LOCAL_JETIFIER_INPUT_FILE := $(my_src_jar) |
| 345 | include $(BUILD_SYSTEM)/jetifier.mk |
| 346 | my_src_jar := $(LOCAL_JETIFIER_OUTPUT_FILE) |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 347 | |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 348 | endif |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 349 | |
Dan Willemsen | 7f01615 | 2016-02-29 17:52:39 -0800 | [diff] [blame] | 350 | $(common_classes_jar) : $(my_src_jar) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 351 | $(transform-prebuilt-to-target) |
| 352 | |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 353 | ifneq ($(TURBINE_ENABLED),false) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 354 | $(common_header_jar) : $(my_src_jar) |
| 355 | $(transform-prebuilt-to-target) |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 356 | endif |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 357 | |
Colin Cross | 950f1ef | 2017-04-05 15:30:42 -0700 | [diff] [blame] | 358 | $(common_classes_pre_proguard_jar) : $(my_src_jar) |
| 359 | $(transform-prebuilt-to-target) |
| 360 | |
Dan Willemsen | 7f01615 | 2016-02-29 17:52:39 -0800 | [diff] [blame] | 361 | $(common_javalib_jar) : $(common_classes_jar) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 362 | $(transform-prebuilt-to-target) |
| 363 | |
Colin Cross | 2029903 | 2018-05-09 13:29:51 -0700 | [diff] [blame] | 364 | include $(BUILD_SYSTEM)/force_aapt2.mk |
| 365 | |
Dan Willemsen | bb6393c | 2017-11-17 15:39:52 -0800 | [diff] [blame] | 366 | ifdef LOCAL_AAPT2_ONLY |
| 367 | LOCAL_USE_AAPT2 := true |
| 368 | endif |
| 369 | |
Colin Cross | 2029903 | 2018-05-09 13:29:51 -0700 | [diff] [blame] | 370 | ifeq ($(LOCAL_USE_AAPT2),true) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 371 | ifneq ($(my_src_aar),) |
Dan Willemsen | 1d64623 | 2017-11-17 13:11:26 -0800 | [diff] [blame] | 372 | |
| 373 | $(intermediates.COMMON)/export_proguard_flags : $(my_src_proguard_options) |
| 374 | $(transform-prebuilt-to-target) |
| 375 | |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 376 | LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION)) |
| 377 | ifeq ($(LOCAL_SDK_RES_VERSION),) |
| 378 | LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION) |
| 379 | endif |
| 380 | |
| 381 | framework_res_package_export := |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 382 | # Please refer to package.mk |
| 383 | ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 384 | ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) |
| 385 | framework_res_package_export := \ |
Anton Hansson | 66d47b8 | 2018-04-27 14:11:17 +0100 | [diff] [blame] | 386 | $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 387 | else |
| 388 | framework_res_package_export := \ |
| 389 | $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 390 | endif |
| 391 | endif |
| 392 | |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 393 | my_res_package := $(intermediates.COMMON)/package-res.apk |
| 394 | |
| 395 | # We needed only very few PRIVATE variables and aapt2.mk input variables. Reset the unnecessary ones. |
| 396 | $(my_res_package): PRIVATE_AAPT2_CFLAGS := |
Dan Willemsen | e3c9901 | 2017-10-05 13:22:30 -0700 | [diff] [blame] | 397 | $(my_res_package): PRIVATE_AAPT_FLAGS := --static-lib --no-static-lib-packages --auto-add-overlay |
Colin Cross | 93fbe84 | 2018-06-12 14:02:41 -0700 | [diff] [blame] | 398 | $(my_res_package): PRIVATE_ANDROID_MANIFEST := $(my_src_android_manifest) |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 399 | $(my_res_package): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 400 | $(my_res_package): PRIVATE_SOURCE_INTERMEDIATES_DIR := |
| 401 | $(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := |
| 402 | $(my_res_package): PRIVATE_DEFAULT_APP_TARGET_SDK := |
| 403 | $(my_res_package): PRIVATE_DEFAULT_APP_TARGET_SDK := |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 404 | $(my_res_package): PRIVATE_PRODUCT_AAPT_CONFIG := |
| 405 | $(my_res_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := |
| 406 | $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := |
Colin Cross | 65c7cdf | 2018-02-20 14:31:33 -0800 | [diff] [blame] | 407 | $(my_res_package) : $(framework_res_package_export) |
Colin Cross | 93fbe84 | 2018-06-12 14:02:41 -0700 | [diff] [blame] | 408 | $(my_res_package) : $(my_src_android_manifest) |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 409 | |
| 410 | full_android_manifest := |
| 411 | my_res_resources := |
| 412 | my_overlay_resources := |
Dan Willemsen | 4884525 | 2017-04-27 21:25:34 -0700 | [diff] [blame] | 413 | my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 414 | R_file_stamp := |
| 415 | proguard_options_file := |
| 416 | my_generated_res_dirs := $(intermediates.COMMON)/aar/res |
| 417 | my_generated_res_dirs_deps := $(my_src_jar) |
| 418 | include $(BUILD_SYSTEM)/aapt2.mk |
| 419 | |
| 420 | # Make sure my_res_package is created when you run mm/mmm. |
| 421 | $(built_module) : $(my_res_package) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 422 | endif # $(my_src_aar) |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 423 | endif # LOCAL_USE_AAPT2 |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 424 | # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) |
| 425 | $(built_module) : $(common_javalib_jar) |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 426 | |
Jiyong Park | 1cf8ee6 | 2018-05-22 15:39:59 +0900 | [diff] [blame] | 427 | my_exported_sdk_libs_file := $(intermediates.COMMON)/exported-sdk-libs |
| 428 | $(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS := $(LOCAL_EXPORT_SDK_LIBRARIES) |
| 429 | $(my_exported_sdk_libs_file): |
| 430 | @echo "Export SDK libs $@" |
| 431 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
Jiyong Park | be4910a | 2018-07-14 15:06:48 +0900 | [diff] [blame] | 432 | $(if $(PRIVATE_EXPORTED_SDK_LIBS),\ |
Jiyong Park | 1cf8ee6 | 2018-05-22 15:39:59 +0900 | [diff] [blame] | 433 | $(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\ |
| 434 | $(hide) touch $@) |
| 435 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 436 | endif # ! prebuilt_module_is_dex_javalib |
Ying Wang | 8c89b4b | 2016-02-22 15:54:27 -0800 | [diff] [blame] | 437 | endif # LOCAL_IS_HOST_MODULE is not set |
Yohann Roussel | d87cc99 | 2016-01-19 16:08:34 +0100 | [diff] [blame] | 438 | |
Yohann Roussel | b4c49cb | 2014-09-08 14:45:14 +0200 | [diff] [blame] | 439 | endif # JAVA_LIBRARIES |
| 440 | |
Jaewoong Jung | 09bfe55 | 2019-03-18 14:25:00 -0700 | [diff] [blame^] | 441 | endif # APPS |
| 442 | |
Dan Willemsen | 1c6dc5b | 2016-01-06 14:28:36 -0800 | [diff] [blame] | 443 | $(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 444 | |
| 445 | my_prebuilt_src_file := |
Mathieu Chartier | 55eabd5 | 2017-09-15 13:40:48 -0700 | [diff] [blame] | 446 | my_preopt_for_extracted_apk := |