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