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 | |
| 9 | ifneq ($(LOCAL_PREBUILT_LIBS),) |
| 10 | $(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH)) |
| 11 | endif |
| 12 | ifneq ($(LOCAL_PREBUILT_EXECUTABLES),) |
| 13 | $(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH)) |
| 14 | endif |
| 15 | ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),) |
| 16 | $(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH)) |
| 17 | endif |
| 18 | |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 19 | my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32) |
| 20 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 21 | ifdef LOCAL_PREBUILT_MODULE_FILE |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 22 | my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 23 | else |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 24 | ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
| 25 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Dan Willemsen | 5709bd5 | 2016-02-01 21:40:17 -0800 | [diff] [blame] | 26 | LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 27 | else |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 28 | ifdef LOCAL_SRC_FILES_$(my_32_64_bit_suffix) |
| 29 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 30 | LOCAL_SRC_FILES_$(my_32_64_bit_suffix) := |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 31 | else |
| 32 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 33 | LOCAL_SRC_FILES := |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 34 | endif |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 35 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 36 | endif |
| 37 | |
Colin Cross | 01e1b8f | 2016-10-27 22:10:55 +0000 | [diff] [blame] | 38 | LOCAL_CHECKED_MODULE := $(my_prebuilt_src_file) |
| 39 | |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 40 | my_strip_module := $(firstword \ |
| 41 | $(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \ |
| 42 | $(LOCAL_STRIP_MODULE)) |
| 43 | my_pack_module_relocations := $(firstword \ |
| 44 | $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \ |
| 45 | $(LOCAL_PACK_MODULE_RELOCATIONS)) |
| 46 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 47 | ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
Dan Albert | 4ac4231 | 2016-07-20 11:02:18 -0700 | [diff] [blame] | 48 | # LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES indicates that this prebuilt should be |
| 49 | # installed to the common directory of libraries. This is needed for the NDK |
| 50 | # shared libraries built by soong, as we build many different versions of each |
| 51 | # library (one for each API level). Since they all have the same basename, |
| 52 | # they'd clobber each other (as well as any platform libraries by the same |
| 53 | # name). |
| 54 | ifneq ($(LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES),false) |
| 55 | # Put the built targets of all shared libraries in a common directory |
| 56 | # to simplify the link line. |
| 57 | OVERRIDE_BUILT_MODULE_PATH := \ |
| 58 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES) |
| 59 | endif |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 60 | ifeq ($(LOCAL_IS_HOST_MODULE)$(my_strip_module),) |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 61 | # Strip but not try to add debuglink |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 62 | my_strip_module := no_debuglink |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 63 | endif |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 64 | |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 65 | ifeq ($(LOCAL_IS_HOST_MODULE)$(my_pack_module_relocations),) |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 66 | # Do not pack relocations by default |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 67 | my_pack_module_relocations := false |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 68 | endif |
Dan Albert | 52831d1 | 2015-11-12 15:27:49 -0800 | [diff] [blame] | 69 | |
| 70 | ifeq ($(DISABLE_RELOCATION_PACKER),true) |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 71 | my_pack_module_relocations := false |
Dan Albert | 52831d1 | 2015-11-12 15:27:49 -0800 | [diff] [blame] | 72 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 73 | endif |
| 74 | |
| 75 | ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) |
| 76 | prebuilt_module_is_a_library := true |
| 77 | else |
| 78 | prebuilt_module_is_a_library := |
| 79 | endif |
| 80 | |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 81 | ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 82 | ifeq ($(prebuilt_module_is_a_library),true) |
| 83 | SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE) |
| 84 | endif |
| 85 | |
| 86 | ifdef LOCAL_USE_VNDK |
Jiyong Park | a9c4c71 | 2017-07-18 13:35:27 +0900 | [diff] [blame] | 87 | name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE)) |
| 88 | ifneq ($(name_without_suffix),$(LOCAL_MODULE) |
| 89 | SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1 |
| 90 | endif |
| 91 | name_without_suffix := |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 92 | endif |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 93 | endif |
| 94 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 95 | # Don't install static libraries by default. |
| 96 | ifndef LOCAL_UNINSTALLABLE_MODULE |
| 97 | ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 98 | LOCAL_UNINSTALLABLE_MODULE := true |
| 99 | endif |
| 100 | endif |
| 101 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 102 | ifeq (JAVA_LIBRARIES,$(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS)$(filter true,$(LOCAL_UNINSTALLABLE_MODULE))) |
| 103 | prebuilt_module_is_dex_javalib := true |
| 104 | else |
| 105 | prebuilt_module_is_dex_javalib := |
| 106 | endif |
| 107 | |
Ying Wang | af9757e | 2014-07-17 21:24:42 -0700 | [diff] [blame] | 108 | ifeq ($(LOCAL_MODULE_CLASS),APPS) |
| 109 | LOCAL_BUILT_MODULE_STEM := package.apk |
Dan Willemsen | dc1ddfc | 2016-08-05 17:23:33 -0700 | [diff] [blame] | 110 | ifndef LOCAL_INSTALLED_MODULE_STEM |
Ying Wang | af9757e | 2014-07-17 21:24:42 -0700 | [diff] [blame] | 111 | LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk |
| 112 | endif |
Dan Willemsen | dc1ddfc | 2016-08-05 17:23:33 -0700 | [diff] [blame] | 113 | endif |
Ying Wang | af9757e | 2014-07-17 21:24:42 -0700 | [diff] [blame] | 114 | |
Dan Willemsen | 4598fbc | 2016-07-13 16:08:36 -0700 | [diff] [blame] | 115 | ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module) $(my_pack_module_relocations)),) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 116 | ifdef LOCAL_IS_HOST_MODULE |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 117 | $(error Cannot strip/pack host module LOCAL_PATH=$(LOCAL_PATH)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 118 | endif |
Dan Willemsen | 7fe992c | 2016-03-02 13:54:51 -0800 | [diff] [blame] | 119 | ifeq ($(filter SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),) |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 120 | $(error Can strip/pack only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 121 | endif |
| 122 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 123 | $(error Cannot strip/pack scripts LOCAL_PATH=$(LOCAL_PATH)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 124 | endif |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 125 | # Set the arch-specific variables to set up the strip/pack rules. |
| 126 | LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_strip_module) |
| 127 | LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_pack_module_relocations) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 128 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 129 | built_module := $(linked_module) |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 130 | |
Ying Wang | b6eb8dd | 2016-03-01 20:14:52 -0800 | [diff] [blame] | 131 | else # my_strip_module and my_pack_module_relocations not true |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 132 | include $(BUILD_SYSTEM)/base_rules.mk |
| 133 | built_module := $(LOCAL_BUILT_MODULE) |
| 134 | |
| 135 | ifdef prebuilt_module_is_a_library |
| 136 | export_includes := $(intermediates)/export_includes |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 137 | export_cflags := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d)) |
| 138 | # Soong exports cflags instead of include dirs, so that -isystem can be included. |
| 139 | ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) |
| 140 | export_cflags += $(LOCAL_EXPORT_CFLAGS) |
| 141 | else ifdef LOCAL_EXPORT_CFLAGS |
| 142 | $(call pretty-error,LOCAL_EXPORT_CFLAGS can only be used by Soong, use LOCAL_EXPORT_C_INCLUDE_DIRS instead) |
| 143 | endif |
| 144 | $(export_includes): PRIVATE_EXPORT_CFLAGS := $(export_cflags) |
Dan Willemsen | ba6a164 | 2016-09-29 12:08:29 -0700 | [diff] [blame] | 145 | $(export_includes): $(LOCAL_EXPORT_C_INCLUDE_DEPS) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 146 | @echo Export includes file: $< -- $@ |
| 147 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 148 | ifdef export_cflags |
| 149 | $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >$@ |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 150 | else |
| 151 | $(hide) touch $@ |
| 152 | endif |
Dan Willemsen | 05909fa | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 153 | export_cflags := |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 154 | |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 155 | ifdef LOCAL_SDK_VERSION |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 156 | my_link_type := native:ndk |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 157 | else ifdef LOCAL_USE_VNDK |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 158 | my_link_type := native:vendor |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 159 | else |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 160 | my_link_type := native:platform |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 161 | endif |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 162 | |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 163 | # TODO: check dependencies of prebuilt files |
| 164 | my_link_deps := |
| 165 | |
| 166 | my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 167 | my_common := |
| 168 | include $(BUILD_SYSTEM)/link_type.mk |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 169 | endif # prebuilt_module_is_a_library |
| 170 | |
| 171 | # The real dependency will be added after all Android.mks are loaded and the install paths |
| 172 | # of the shared libraries are determined. |
| 173 | ifdef LOCAL_INSTALLED_MODULE |
| 174 | ifdef LOCAL_SHARED_LIBRARIES |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 175 | my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) |
| 176 | # Extra shared libraries introduced by LOCAL_CXX_STL. |
| 177 | include $(BUILD_SYSTEM)/cxx_stl_setup.mk |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 178 | ifdef LOCAL_USE_VNDK |
Jiyong Park | a9c4c71 | 2017-07-18 13:35:27 +0900 | [diff] [blame] | 179 | ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 180 | my_shared_libraries := $(foreach l,$(my_shared_libraries),\ |
| 181 | $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) |
| 182 | endif |
| 183 | endif |
Ying Wang | 58f462f | 2014-02-25 18:26:29 -0800 | [diff] [blame] | 184 | $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 185 | $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 186 | |
| 187 | # We also need the LOCAL_BUILT_MODULE dependency, |
| 188 | # since we use -rpath-link which points to the built module's path. |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 189 | my_built_shared_libraries := \ |
Ying Wang | 58f462f | 2014-02-25 18:26:29 -0800 | [diff] [blame] | 190 | $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 191 | $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \ |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 192 | $(my_shared_libraries))) |
| 193 | $(LOCAL_BUILT_MODULE) : $(my_built_shared_libraries) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 194 | endif |
| 195 | endif |
| 196 | |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 197 | # 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] | 198 | # "my_strip_module not true" because otherwise the rules are defined in dynamic_binary.mk. |
| 199 | endif # my_strip_module not true |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 200 | |
Dan Willemsen | 9f95665 | 2016-10-21 15:04:12 -0700 | [diff] [blame] | 201 | ifeq ($(NATIVE_COVERAGE),true) |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 202 | ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE))) |
| 203 | $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).gcnodir)) |
| 204 | ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true) |
| 205 | ifdef LOCAL_IS_HOST_MODULE |
| 206 | my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path)) |
| 207 | else |
| 208 | my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) |
| 209 | endif |
| 210 | my_coverage_path := $(my_coverage_path)/$(basename $(my_installed_module_stem)).gcnodir |
| 211 | $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path))) |
| 212 | $(LOCAL_BUILT_MODULE): $(my_coverage_path) |
| 213 | endif |
| 214 | else |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 215 | # Coverage information is needed when static lib is a dependency of another |
| 216 | # coverage-enabled module. |
| 217 | ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS)) |
| 218 | GCNO_ARCHIVE := $(LOCAL_MODULE).gcnodir |
| 219 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := |
| 220 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := |
Dan Willemsen | 9f95665 | 2016-10-21 15:04:12 -0700 | [diff] [blame] | 221 | $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix) |
| 222 | $(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] | 223 | $(intermediates)/$(GCNO_ARCHIVE) : |
| 224 | $(transform-o-to-static-lib) |
| 225 | endif |
Dan Willemsen | 9f95665 | 2016-10-21 15:04:12 -0700 | [diff] [blame] | 226 | endif |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 227 | endif |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 228 | |
Ying Wang | f0534c2 | 2014-04-15 11:12:21 -0700 | [diff] [blame] | 229 | ifeq ($(LOCAL_MODULE_CLASS),APPS) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 230 | PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) |
| 231 | |
Dan Willemsen | 048f56d | 2016-06-18 20:43:51 -0700 | [diff] [blame] | 232 | my_extract_apk := $(strip $(LOCAL_EXTRACT_APK)) |
| 233 | |
Ying Wang | 43f7a32 | 2014-11-17 16:56:04 -0800 | [diff] [blame] | 234 | # Select dpi-specific source |
| 235 | ifdef LOCAL_DPI_VARIANTS |
Ying Wang | 6068658 | 2014-12-10 12:40:09 -0800 | [diff] [blame] | 236 | my_dpi := $(firstword $(filter $(LOCAL_DPI_VARIANTS),$(PRODUCT_AAPT_PREF_CONFIG) $(PRODUCT_AAPT_PREBUILT_DPI))) |
Ying Wang | 43f7a32 | 2014-11-17 16:56:04 -0800 | [diff] [blame] | 237 | ifdef my_dpi |
| 238 | ifdef LOCAL_DPI_FILE_STEM |
| 239 | my_prebuilt_dpi_file_stem := $(LOCAL_DPI_FILE_STEM) |
| 240 | else |
| 241 | my_prebuilt_dpi_file_stem := $(LOCAL_MODULE)_%.apk |
| 242 | endif |
| 243 | my_prebuilt_src_file := $(dir $(my_prebuilt_src_file))$(subst %,$(my_dpi),$(my_prebuilt_dpi_file_stem)) |
Dan Willemsen | 048f56d | 2016-06-18 20:43:51 -0700 | [diff] [blame] | 244 | |
| 245 | ifneq ($(strip $(LOCAL_EXTRACT_DPI_APK)),) |
| 246 | my_extract_apk := $(subst %,$(my_dpi),$(LOCAL_EXTRACT_DPI_APK)) |
| 247 | endif # LOCAL_EXTRACT_DPI_APK |
Ying Wang | 43f7a32 | 2014-11-17 16:56:04 -0800 | [diff] [blame] | 248 | endif # my_dpi |
| 249 | endif # LOCAL_DPI_VARIANTS |
| 250 | |
Dan Willemsen | 048f56d | 2016-06-18 20:43:51 -0700 | [diff] [blame] | 251 | ifdef my_extract_apk |
| 252 | my_extracted_apk := $(intermediates)/extracted.apk |
| 253 | |
| 254 | $(my_extracted_apk): PRIVATE_EXTRACT := $(my_extract_apk) |
| 255 | $(my_extracted_apk): $(my_prebuilt_src_file) |
| 256 | @echo Extract APK: $@ |
| 257 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
| 258 | $(hide) unzip -p $< $(PRIVATE_EXTRACT) >$@ |
| 259 | |
| 260 | my_prebuilt_src_file := $(my_extracted_apk) |
| 261 | my_extracted_apk := |
| 262 | my_extract_apk := |
| 263 | endif |
| 264 | |
Ying Wang | 96bcad4 | 2014-04-17 13:38:04 -0700 | [diff] [blame] | 265 | rs_compatibility_jni_libs := |
| 266 | include $(BUILD_SYSTEM)/install_jni_libs.mk |
| 267 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 268 | ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) |
| 269 | # The magic string "EXTERNAL" means this package will be signed with |
| 270 | # the default dev key throughout the build process, but we expect |
| 271 | # the final package to be signed with a different key. |
| 272 | # |
| 273 | # This can be used for packages where we don't have access to the |
| 274 | # keys, but want the package to be predexopt'ed. |
| 275 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 276 | PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 |
| 277 | |
Shinichiro Hamaji | 641e61c | 2016-05-13 16:03:24 +0900 | [diff] [blame] | 278 | $(built_module) : $(LOCAL_CERTIFICATE).pk8 $(LOCAL_CERTIFICATE).x509.pem |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 279 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 280 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 281 | endif |
| 282 | ifeq ($(LOCAL_CERTIFICATE),) |
Ying Wang | f0534c2 | 2014-04-15 11:12:21 -0700 | [diff] [blame] | 283 | # It is now a build error to add a prebuilt .apk without |
| 284 | # specifying a key for it. |
| 285 | $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)") |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 286 | else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 287 | # The magic string "PRESIGNED" means this package is already checked |
| 288 | # signed with its release key. |
| 289 | # |
| 290 | # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be |
| 291 | # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") |
| 292 | # but the dexpreopt process will not try to re-sign the app. |
| 293 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED |
| 294 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 295 | else |
| 296 | # If this is not an absolute certificate, assign it to a generic one. |
| 297 | ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) |
| 298 | LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) |
| 299 | endif |
| 300 | |
| 301 | PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 302 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 303 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 304 | |
Shinichiro Hamaji | 641e61c | 2016-05-13 16:03:24 +0900 | [diff] [blame] | 305 | $(built_module) : $(LOCAL_CERTIFICATE).pk8 $(LOCAL_CERTIFICATE).x509.pem |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 306 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 307 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 308 | endif |
| 309 | |
Andreas Gampe | 5e0dbe0 | 2014-10-01 22:01:16 -0700 | [diff] [blame] | 310 | # Disable dex-preopt of prebuilts to save space, if requested. |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 311 | ifndef LOCAL_DEX_PREOPT |
Andreas Gampe | 5e0dbe0 | 2014-10-01 22:01:16 -0700 | [diff] [blame] | 312 | ifeq ($(DONT_DEXPREOPT_PREBUILTS),true) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 313 | LOCAL_DEX_PREOPT := false |
Andreas Gampe | 5e0dbe0 | 2014-10-01 22:01:16 -0700 | [diff] [blame] | 314 | endif |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 315 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 316 | |
| 317 | ####################################### |
| 318 | # defines built_odex along with rule to install odex |
| 319 | include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk |
| 320 | ####################################### |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 321 | ifneq ($(LOCAL_REPLACE_PREBUILT_APK_INSTALLED),) |
| 322 | # There is a replacement for the prebuilt .apk we can install without any processing. |
| 323 | $(built_module) : $(LOCAL_REPLACE_PREBUILT_APK_INSTALLED) |
| 324 | $(transform-prebuilt-to-target) |
Ying Wang | b7d33c0 | 2016-03-15 16:28:57 -0700 | [diff] [blame] | 325 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 326 | else # ! LOCAL_REPLACE_PREBUILT_APK_INSTALLED |
| 327 | # Sign and align non-presigned .apks. |
Ying Wang | 1fb0152 | 2015-05-01 14:02:26 -0700 | [diff] [blame] | 328 | # The embedded prebuilt jni to uncompress. |
Ying Wang | 226eb92 | 2015-06-01 19:19:57 -0700 | [diff] [blame] | 329 | ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 330 | # For PRESIGNED apks we must uncompress every .so file: |
| 331 | # even if the .so file isn't for the current TARGET_ARCH, |
| 332 | # we can't strip the file. |
| 333 | embedded_prebuilt_jni_libs := 'lib/*.so' |
| 334 | endif |
Ying Wang | 1fb0152 | 2015-05-01 14:02:26 -0700 | [diff] [blame] | 335 | ifndef embedded_prebuilt_jni_libs |
| 336 | # No LOCAL_PREBUILT_JNI_LIBS, uncompress all. |
| 337 | embedded_prebuilt_jni_libs := 'lib/*.so' |
| 338 | endif |
| 339 | $(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs) |
| 340 | |
Alex Klyubin | 1b391c0 | 2016-12-15 12:51:25 -0800 | [diff] [blame] | 341 | $(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(SIGNAPK_JAR) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 342 | $(transform-prebuilt-to-target) |
Ying Wang | 226eb92 | 2015-06-01 19:19:57 -0700 | [diff] [blame] | 343 | $(uncompress-shared-libs) |
Nicolas Geoffray | b06c30b | 2017-09-19 11:51:45 +0000 | [diff] [blame] | 344 | ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)) |
| 345 | ifeq (true,$(LOCAL_PRIVILEGED_MODULE)) |
| 346 | $(uncompress-dexs) |
Nicolas Geoffray | a95fbd1 | 2017-09-19 13:10:31 +0100 | [diff] [blame^] | 347 | else |
| 348 | ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE))) |
| 349 | $(uncompress-dexs) |
| 350 | endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES |
Nicolas Geoffray | b06c30b | 2017-09-19 11:51:45 +0000 | [diff] [blame] | 351 | endif # LOCAL_PRIVILEGED_MODULE |
| 352 | endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 353 | ifdef LOCAL_DEX_PREOPT |
| 354 | ifneq ($(BUILD_PLATFORM_ZIP),) |
| 355 | @# Keep a copy of apk with classes.dex unstripped |
| 356 | $(hide) cp -f $@ $(dir $@)package.dex.apk |
| 357 | endif # BUILD_PLATFORM_ZIP |
| 358 | endif # LOCAL_DEX_PREOPT |
Kenny Root | dff3755 | 2015-04-15 12:09:32 -0700 | [diff] [blame] | 359 | ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 360 | @# Only strip out files if we can re-sign the package. |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 361 | ifdef LOCAL_DEX_PREOPT |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 362 | ifneq (nostripping,$(LOCAL_DEX_PREOPT)) |
| 363 | $(call dexpreopt-remove-classes.dex,$@) |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 364 | endif # LOCAL_DEX_PREOPT != nostripping |
| 365 | endif # LOCAL_DEX_PREOPT |
Kenny Root | dff3755 | 2015-04-15 12:09:32 -0700 | [diff] [blame] | 366 | $(sign-package) |
Alex Klyubin | 5b826ac | 2015-12-04 10:07:41 -0800 | [diff] [blame] | 367 | # No need for align-package because sign-package takes care of alignment |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 368 | else # LOCAL_CERTIFICATE == PRESIGNED |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 369 | $(align-package) |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 370 | endif # LOCAL_CERTIFICATE |
| 371 | endif # ! LOCAL_REPLACE_PREBUILT_APK_INSTALLED |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 372 | |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 373 | ############################### |
| 374 | ## Rule to build the odex file |
| 375 | ifdef LOCAL_DEX_PREOPT |
| 376 | $(built_odex) : $(my_prebuilt_src_file) |
| 377 | $(call dexpreopt-one-file,$<,$@) |
| 378 | endif |
| 379 | |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 380 | ############################### |
| 381 | ## Install split apks. |
| 382 | ifdef LOCAL_PACKAGE_SPLITS |
| 383 | # LOCAL_PACKAGE_SPLITS is a list of apks to be installed. |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 384 | built_apk_splits := $(addprefix $(intermediates)/,$(notdir $(LOCAL_PACKAGE_SPLITS))) |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 385 | installed_apk_splits := $(addprefix $(my_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS))) |
| 386 | |
Alex Klyubin | 5b826ac | 2015-12-04 10:07:41 -0800 | [diff] [blame] | 387 | # Rules to sign the split apks. |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 388 | my_src_dir := $(sort $(dir $(LOCAL_PACKAGE_SPLITS))) |
| 389 | ifneq (1,$(words $(my_src_dir))) |
| 390 | $(error You must put all the split source apks in the same folder: $(LOCAL_PACKAGE_SPLITS)) |
| 391 | endif |
| 392 | my_src_dir := $(LOCAL_PATH)/$(my_src_dir) |
| 393 | |
Shinichiro Hamaji | 641e61c | 2016-05-13 16:03:24 +0900 | [diff] [blame] | 394 | $(built_apk_splits) : $(LOCAL_CERTIFICATE).pk8 $(LOCAL_CERTIFICATE).x509.pem |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 395 | $(built_apk_splits) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 396 | $(built_apk_splits) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 397 | $(built_apk_splits) : $(intermediates)/%.apk : $(my_src_dir)/%.apk |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 398 | $(copy-file-to-new-target) |
| 399 | $(sign-package) |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 400 | |
| 401 | # Rules to install the split apks. |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 402 | $(installed_apk_splits) : $(my_module_path)/%.apk : $(intermediates)/%.apk |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 403 | @echo "Install: $@" |
| 404 | $(copy-file-to-new-target) |
| 405 | |
| 406 | # Register the additional built and installed files. |
| 407 | ALL_MODULES.$(my_register_name).INSTALLED += $(installed_apk_splits) |
| 408 | ALL_MODULES.$(my_register_name).BUILT_INSTALLED += \ |
Dan Willemsen | f72308a | 2017-05-15 23:38:04 -0700 | [diff] [blame] | 409 | $(foreach s,$(LOCAL_PACKAGE_SPLITS),$(intermediates)/$(notdir $(s)):$(my_module_path)/$(notdir $(s))) |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 410 | |
| 411 | # Make sure to install the splits when you run "make <module_name>". |
Colin Cross | 3388670 | 2016-09-20 16:01:28 -0700 | [diff] [blame] | 412 | $(my_all_targets): $(installed_apk_splits) |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 413 | |
| 414 | endif # LOCAL_PACKAGE_SPLITS |
| 415 | |
Ying Wang | da36635 | 2016-03-15 17:05:52 -0700 | [diff] [blame] | 416 | else ifeq ($(prebuilt_module_is_dex_javalib),true) # ! LOCAL_MODULE_CLASS != APPS |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 417 | # This is a target shared library, i.e. a jar with classes.dex. |
| 418 | ####################################### |
| 419 | # defines built_odex along with rule to install odex |
| 420 | include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk |
| 421 | ####################################### |
| 422 | ifdef LOCAL_DEX_PREOPT |
| 423 | ifneq ($(dexpreopt_boot_jar_module),) # boot jar |
| 424 | # boot jar's rules are defined in dex_preopt.mk |
| 425 | dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar |
| 426 | $(built_module) : $(dexpreopted_boot_jar) |
| 427 | $(call copy-file-to-target) |
Dan Willemsen | 08420cb | 2016-03-01 22:04:57 -0800 | [diff] [blame] | 428 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 429 | # For libart boot jars, we don't have .odex files. |
| 430 | else # ! boot jar |
| 431 | $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE) |
| 432 | # Use pattern rule - we may have multiple built odex files. |
| 433 | $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(my_prebuilt_src_file) |
| 434 | @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)" |
| 435 | $(call dexpreopt-one-file,$<,$@) |
| 436 | |
| 437 | $(built_module) : $(my_prebuilt_src_file) |
| 438 | $(call copy-file-to-target) |
| 439 | ifneq (nostripping,$(LOCAL_DEX_PREOPT)) |
| 440 | $(call dexpreopt-remove-classes.dex,$@) |
| 441 | endif |
| 442 | endif # boot jar |
| 443 | else # ! LOCAL_DEX_PREOPT |
| 444 | $(built_module) : $(my_prebuilt_src_file) |
| 445 | $(call copy-file-to-target) |
| 446 | endif # LOCAL_DEX_PREOPT |
| 447 | |
| 448 | else # ! prebuilt_module_is_dex_javalib |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 449 | $(built_module) : $(my_prebuilt_src_file) |
Dan Willemsen | 08420cb | 2016-03-01 22:04:57 -0800 | [diff] [blame] | 450 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 451 | $(transform-prebuilt-to-target-strip-comments) |
| 452 | else |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 453 | $(transform-prebuilt-to-target) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 454 | endif |
Dan Willemsen | 7fe992c | 2016-03-02 13:54:51 -0800 | [diff] [blame] | 455 | ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),) |
Dan Willemsen | 08420cb | 2016-03-01 22:04:57 -0800 | [diff] [blame] | 456 | $(hide) chmod +x $@ |
| 457 | endif |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 458 | endif # ! prebuilt_module_is_dex_javalib |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 459 | |
Ying Wang | 8c89b4b | 2016-02-22 15:54:27 -0800 | [diff] [blame] | 460 | ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) |
| 461 | my_src_jar := $(my_prebuilt_src_file) |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 462 | |
| 463 | ifdef LOCAL_IS_HOST_MODULE |
| 464 | # for host java libraries deps should be in the common dir, so we make a copy in |
| 465 | # the common dir. |
| 466 | common_classes_jar := $(intermediates.COMMON)/classes.jar |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 467 | common_header_jar := $(intermediates.COMMON)/classes-header.jar |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 468 | |
Colin Cross | 96476c1 | 2017-04-06 09:56:19 -0700 | [diff] [blame] | 469 | $(common_classes_jar): PRIVATE_MODULE := $(LOCAL_MODULE) |
Colin Cross | d2e778f | 2017-04-14 15:14:33 -0700 | [diff] [blame] | 470 | $(common_classes_jar): PRIVATE_PREFIX := $(my_prefix) |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 471 | |
| 472 | $(common_classes_jar) : $(my_src_jar) |
| 473 | $(transform-prebuilt-to-target) |
| 474 | |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 475 | ifneq ($(TURBINE_ENABLED),false) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 476 | $(common_header_jar) : $(my_src_jar) |
| 477 | $(transform-prebuilt-to-target) |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 478 | endif |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 479 | |
Colin Cross | 941b682 | 2017-03-29 13:53:29 -0700 | [diff] [blame] | 480 | else # !LOCAL_IS_HOST_MODULE |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 481 | # for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, |
| 482 | # 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] | 483 | common_classes_jar := $(intermediates.COMMON)/classes.jar |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 484 | common_header_jar := $(intermediates.COMMON)/classes-header.jar |
Colin Cross | 950f1ef | 2017-04-05 15:30:42 -0700 | [diff] [blame] | 485 | common_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 486 | common_javalib_jar := $(intermediates.COMMON)/javalib.jar |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 487 | |
Colin Cross | d2e778f | 2017-04-14 15:14:33 -0700 | [diff] [blame] | 488 | $(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE) |
| 489 | $(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] | 490 | |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 491 | ifeq ($(LOCAL_SDK_VERSION),system_current) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 492 | my_link_type := java:system |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 493 | else ifneq ($(LOCAL_SDK_VERSION),) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 494 | my_link_type := java:sdk |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 495 | else |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 496 | my_link_type := java:platform |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 497 | endif |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 498 | |
| 499 | # TODO: check dependencies of prebuilt files |
| 500 | my_link_deps := |
| 501 | |
| 502 | my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 503 | my_common := COMMON |
| 504 | include $(BUILD_SYSTEM)/link_type.mk |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 505 | |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 506 | ifeq ($(prebuilt_module_is_dex_javalib),true) |
| 507 | # For prebuilt shared Java library we don't have classes.jar. |
| 508 | $(common_javalib_jar) : $(my_src_jar) |
| 509 | $(transform-prebuilt-to-target) |
| 510 | |
| 511 | else # ! prebuilt_module_is_dex_javalib |
| 512 | |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 513 | my_src_aar := $(filter %.aar, $(my_prebuilt_src_file)) |
| 514 | ifneq ($(my_src_aar),) |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 515 | # This is .aar file, archive of classes.jar and Android resources. |
| 516 | my_src_jar := $(intermediates.COMMON)/aar/classes.jar |
| 517 | |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 518 | $(my_src_jar) : $(my_src_aar) |
Dan Willemsen | 7a1ad6c | 2017-04-27 23:10:47 -0700 | [diff] [blame] | 519 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(dir $@)/res |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 520 | $(hide) unzip -qo -d $(dir $@) $< |
| 521 | # Make sure the extracted classes.jar has a new timestamp. |
| 522 | $(hide) touch $@ |
| 523 | |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 524 | endif |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 525 | |
Dan Willemsen | 7f01615 | 2016-02-29 17:52:39 -0800 | [diff] [blame] | 526 | $(common_classes_jar) : $(my_src_jar) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 527 | $(transform-prebuilt-to-target) |
| 528 | |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 529 | ifneq ($(TURBINE_ENABLED),false) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 530 | $(common_header_jar) : $(my_src_jar) |
| 531 | $(transform-prebuilt-to-target) |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 532 | endif |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 533 | |
Colin Cross | 950f1ef | 2017-04-05 15:30:42 -0700 | [diff] [blame] | 534 | $(common_classes_pre_proguard_jar) : $(my_src_jar) |
| 535 | $(transform-prebuilt-to-target) |
| 536 | |
Dan Willemsen | 7f01615 | 2016-02-29 17:52:39 -0800 | [diff] [blame] | 537 | $(common_javalib_jar) : $(common_classes_jar) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 538 | $(transform-prebuilt-to-target) |
| 539 | |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 540 | ifdef LOCAL_USE_AAPT2 |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 541 | ifneq ($(my_src_aar),) |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 542 | LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION)) |
| 543 | ifeq ($(LOCAL_SDK_RES_VERSION),) |
| 544 | LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION) |
| 545 | endif |
| 546 | |
| 547 | framework_res_package_export := |
| 548 | framework_res_package_export_deps := |
| 549 | # Please refer to package.mk |
| 550 | ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 551 | 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))),) |
| 552 | framework_res_package_export := \ |
| 553 | $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar |
| 554 | framework_res_package_export_deps := $(framework_res_package_export) |
| 555 | else |
| 556 | framework_res_package_export := \ |
| 557 | $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk |
| 558 | framework_res_package_export_deps := \ |
| 559 | $(dir $(framework_res_package_export))src/R.stamp |
| 560 | endif |
| 561 | endif |
| 562 | |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 563 | my_res_package := $(intermediates.COMMON)/package-res.apk |
| 564 | |
| 565 | # We needed only very few PRIVATE variables and aapt2.mk input variables. Reset the unnecessary ones. |
| 566 | $(my_res_package): PRIVATE_AAPT2_CFLAGS := |
Dan Willemsen | 7a1ad6c | 2017-04-27 23:10:47 -0700 | [diff] [blame] | 567 | $(my_res_package): PRIVATE_AAPT_FLAGS := --static-lib --no-static-lib-packages |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 568 | $(my_res_package): PRIVATE_ANDROID_MANIFEST := $(intermediates.COMMON)/aar/AndroidManifest.xml |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 569 | $(my_res_package): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 570 | $(my_res_package): PRIVATE_SOURCE_INTERMEDIATES_DIR := |
| 571 | $(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := |
| 572 | $(my_res_package): PRIVATE_DEFAULT_APP_TARGET_SDK := |
| 573 | $(my_res_package): PRIVATE_DEFAULT_APP_TARGET_SDK := |
Adam Lesinski | e758f93 | 2016-02-26 11:13:43 -0800 | [diff] [blame] | 574 | $(my_res_package): PRIVATE_PRODUCT_AAPT_CONFIG := |
| 575 | $(my_res_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := |
| 576 | $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := |
Dan Willemsen | 470e0e1 | 2017-04-27 22:28:06 -0700 | [diff] [blame] | 577 | $(my_res_package) : $(framework_res_package_export_deps) |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 578 | |
| 579 | full_android_manifest := |
| 580 | my_res_resources := |
| 581 | my_overlay_resources := |
Dan Willemsen | 4884525 | 2017-04-27 21:25:34 -0700 | [diff] [blame] | 582 | my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 583 | R_file_stamp := |
| 584 | proguard_options_file := |
| 585 | my_generated_res_dirs := $(intermediates.COMMON)/aar/res |
| 586 | my_generated_res_dirs_deps := $(my_src_jar) |
| 587 | include $(BUILD_SYSTEM)/aapt2.mk |
| 588 | |
| 589 | # Make sure my_res_package is created when you run mm/mmm. |
| 590 | $(built_module) : $(my_res_package) |
Ying Wang | dd71c85 | 2015-12-04 13:59:18 -0800 | [diff] [blame] | 591 | endif # $(my_src_aar) |
Ying Wang | e295c3d | 2016-02-24 14:11:55 -0800 | [diff] [blame] | 592 | endif # LOCAL_USE_AAPT2 |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 593 | # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) |
| 594 | $(built_module) : $(common_javalib_jar) |
Ying Wang | 09c306c | 2016-03-15 16:36:29 -0700 | [diff] [blame] | 595 | |
| 596 | endif # ! prebuilt_module_is_dex_javalib |
Ying Wang | 8c89b4b | 2016-02-22 15:54:27 -0800 | [diff] [blame] | 597 | endif # LOCAL_IS_HOST_MODULE is not set |
Yohann Roussel | d87cc99 | 2016-01-19 16:08:34 +0100 | [diff] [blame] | 598 | |
Yohann Roussel | b4c49cb | 2014-09-08 14:45:14 +0200 | [diff] [blame] | 599 | endif # JAVA_LIBRARIES |
| 600 | |
Dan Willemsen | 1c6dc5b | 2016-01-06 14:28:36 -0800 | [diff] [blame] | 601 | $(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 602 | |
| 603 | my_prebuilt_src_file := |