The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | ########################################################### |
| 2 | ## Standard rules for copying files that are prebuilt |
| 3 | ## |
| 4 | ## Additional inputs from base_rules.make: |
| 5 | ## None. |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 6 | ## |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 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 | |
Colin Cross | 0b70c43 | 2014-01-24 13:34:51 -0800 | [diff] [blame] | 19 | ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true) |
| 20 | # Build for TARGET_ARCH |
| 21 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 22 | else |
| 23 | # Build for TARGET_2ND_ARCH |
| 24 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 25 | endif |
| 26 | |
| 27 | |
Ying Wang | 883071f | 2013-08-02 13:30:54 -0700 | [diff] [blame] | 28 | # Not much sense to check build prebuilts |
| 29 | LOCAL_DONT_CHECK_MODULE := true |
| 30 | |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 31 | ifdef LOCAL_PREBUILT_MODULE_FILE |
| 32 | my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) |
| 33 | else |
| 34 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES) |
| 35 | endif |
| 36 | |
Ying Wang | c36b450 | 2011-09-15 12:00:52 -0700 | [diff] [blame] | 37 | ifdef LOCAL_IS_HOST_MODULE |
Ying Wang | 13d6950 | 2012-11-01 17:22:33 -0700 | [diff] [blame] | 38 | my_prefix := HOST_ |
Ying Wang | c36b450 | 2011-09-15 12:00:52 -0700 | [diff] [blame] | 39 | else |
Ying Wang | 13d6950 | 2012-11-01 17:22:33 -0700 | [diff] [blame] | 40 | my_prefix := TARGET_ |
Ying Wang | c36b450 | 2011-09-15 12:00:52 -0700 | [diff] [blame] | 41 | endif |
| 42 | ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 43 | # Put the built targets of all shared libraries in a common directory |
| 44 | # to simplify the link line. |
Colin Cross | 0b70c43 | 2014-01-24 13:34:51 -0800 | [diff] [blame] | 45 | OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES) |
Ying Wang | c36b450 | 2011-09-15 12:00:52 -0700 | [diff] [blame] | 46 | endif |
| 47 | |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 48 | ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) |
| 49 | prebuilt_module_is_a_library := true |
| 50 | else |
| 51 | prebuilt_module_is_a_library := |
| 52 | endif |
| 53 | |
Ying Wang | b1a4e4e | 2012-05-15 15:31:41 -0700 | [diff] [blame] | 54 | # Don't install static libraries by default. |
| 55 | ifndef LOCAL_UNINSTALLABLE_MODULE |
| 56 | ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 57 | LOCAL_UNINSTALLABLE_MODULE := true |
| 58 | endif |
| 59 | endif |
| 60 | |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 61 | ifeq ($(LOCAL_STRIP_MODULE),true) |
| 62 | ifdef LOCAL_IS_HOST_MODULE |
| 63 | $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH)) |
| 64 | endif |
| 65 | ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),) |
| 66 | $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) |
| 67 | endif |
| 68 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
| 69 | $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH)) |
| 70 | endif |
| 71 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 72 | built_module := $(linked_module) |
Ying Wang | 6c86a13 | 2013-02-25 18:12:11 -0800 | [diff] [blame] | 73 | else # LOCAL_STRIP_MODULE not true |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 74 | include $(BUILD_SYSTEM)/base_rules.mk |
| 75 | built_module := $(LOCAL_BUILT_MODULE) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 76 | |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 77 | ifdef prebuilt_module_is_a_library |
Ying Wang | fe3f62d | 2012-12-03 18:24:55 -0800 | [diff] [blame] | 78 | export_includes := $(intermediates)/export_includes |
| 79 | $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) |
| 80 | $(export_includes) : $(LOCAL_MODULE_MAKEFILE) |
| 81 | @echo Export includes file: $< -- $@ |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 82 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
Ying Wang | fe3f62d | 2012-12-03 18:24:55 -0800 | [diff] [blame] | 83 | ifdef LOCAL_EXPORT_C_INCLUDE_DIRS |
| 84 | $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ |
| 85 | echo "-I $$d" >> $@; \ |
| 86 | done |
| 87 | else |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 88 | $(hide) touch $@ |
Ying Wang | fe3f62d | 2012-12-03 18:24:55 -0800 | [diff] [blame] | 89 | endif |
Ying Wang | 616e596 | 2012-04-18 17:35:55 -0700 | [diff] [blame] | 90 | |
| 91 | $(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 92 | endif # prebuilt_module_is_a_library |
Ying Wang | 6c86a13 | 2013-02-25 18:12:11 -0800 | [diff] [blame] | 93 | |
| 94 | # The real dependency will be added after all Android.mks are loaded and the install paths |
| 95 | # of the shared libraries are determined. |
| 96 | ifdef LOCAL_INSTALLED_MODULE |
| 97 | ifdef LOCAL_SHARED_LIBRARIES |
Ying Wang | d6b1d61 | 2013-04-15 17:32:21 -0700 | [diff] [blame] | 98 | $(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES)) |
Ying Wang | ada8f29 | 2013-07-12 22:05:14 -0700 | [diff] [blame] | 99 | |
| 100 | # We also need the LOCAL_BUILT_MODULE dependency, |
| 101 | # since we use -rpath-link which points to the built module's path. |
| 102 | built_shared_libraries := \ |
| 103 | $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ |
Ying Wang | 80b71fa | 2013-07-15 08:47:33 -0700 | [diff] [blame] | 104 | $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \ |
Ying Wang | ada8f29 | 2013-07-12 22:05:14 -0700 | [diff] [blame] | 105 | $(LOCAL_SHARED_LIBRARIES))) |
| 106 | $(LOCAL_BUILT_MODULE) : $(built_shared_libraries) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 107 | endif |
Ying Wang | 6c86a13 | 2013-02-25 18:12:11 -0800 | [diff] [blame] | 108 | endif |
| 109 | |
| 110 | endif # LOCAL_STRIP_MODULE not true |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 111 | |
Owen Lin | 64d5a80 | 2009-10-16 02:43:05 -0700 | [diff] [blame] | 112 | PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) |
| 113 | |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 114 | ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) |
| 115 | # The magic string "EXTERNAL" means this package will be signed with |
| 116 | # the default dev key throughout the build process, but we expect |
| 117 | # the final package to be signed with a different key. |
| 118 | # |
| 119 | # This can be used for packages where we don't have access to the |
| 120 | # keys, but want the package to be predexopt'ed. |
| 121 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 122 | PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 |
| 123 | |
| 124 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 125 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 126 | endif |
| 127 | ifeq ($(LOCAL_CERTIFICATE),) |
| 128 | ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) |
| 129 | # It is now a build error to add a prebuilt .apk without |
| 130 | # specifying a key for it. |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 131 | $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)") |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 132 | endif |
| 133 | else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 134 | # The magic string "PRESIGNED" means this package is already checked |
| 135 | # signed with its release key. |
| 136 | # |
| 137 | # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be |
| 138 | # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") |
| 139 | # but the dexpreopt process will not try to re-sign the app. |
| 140 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED |
| 141 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 142 | else |
| 143 | # If this is not an absolute certificate, assign it to a generic one. |
| 144 | ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) |
| 145 | LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) |
| 146 | endif |
| 147 | |
| 148 | PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 149 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 150 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 151 | |
| 152 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 153 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 154 | endif |
| 155 | |
Dianne Hackborn | 9c0c4b7 | 2009-08-11 19:16:46 -0700 | [diff] [blame] | 156 | ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 157 | |
| 158 | # Disable dex-preopt of prebuilts to save space |
| 159 | LOCAL_DEX_PREOPT := false |
| 160 | |
| 161 | ####################################### |
| 162 | # defines built_odex along with rule to install odex |
| 163 | include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk |
| 164 | ####################################### |
| 165 | ifdef LOCAL_DEX_PREOPT |
| 166 | $(built_module): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE) |
| 167 | $(built_module): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) |
| 168 | $(built_module): PRIVATE_BUILT_ODEX := $(built_odex) |
| 169 | # Make sure the boot jars get dexpreopt-ed first |
| 170 | $(built_module) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) |
| 171 | $(built_module) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) |
| 172 | (built_module) : $(LOCAL_DEX_PREOPT_IMAGE) |
| 173 | # built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe. |
| 174 | $(built_odex) : $(LOCAL_BUILT_MODULE) |
| 175 | endif # LOCAL_DEX_PREOPT |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 176 | # Sign and align non-presigned .apks. |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 177 | $(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 178 | $(transform-prebuilt-to-target) |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 179 | ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 180 | $(sign-package) |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 181 | endif |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 182 | ifdef LOCAL_DEX_PREOPT |
| 183 | $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$@,$(PRIVATE_DEX_LOCATION),$(PRIVATE_BUILT_ODEX)) |
| 184 | endif |
| 185 | $(align-package) |
| 186 | |
| 187 | else # LOCAL_MODULE_CLASS != APPS |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 188 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 189 | $(built_module) : $(my_prebuilt_src_file) |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 190 | $(transform-prebuilt-to-target-strip-comments) |
| 191 | else |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 192 | $(built_module) : $(my_prebuilt_src_file) | $(ACP) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 193 | $(transform-prebuilt-to-target) |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 194 | ifneq ($(prebuilt_module_is_a_library),) |
| 195 | ifneq ($(LOCAL_IS_HOST_MODULE),) |
| 196 | $(transform-host-ranlib-copy-hack) |
| 197 | else |
| 198 | $(transform-ranlib-copy-hack) |
| 199 | endif |
| 200 | endif |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 201 | endif |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 202 | endif # LOCAL_MODULE_CLASS != APPS |
Dianne Hackborn | 9c0c4b7 | 2009-08-11 19:16:46 -0700 | [diff] [blame] | 203 | |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 204 | ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) |
| 205 | # for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, |
| 206 | # while the deps should be in the common dir, so we make a copy in the common dir. |
Ying Wang | 5b316b6 | 2011-02-01 12:57:45 -0800 | [diff] [blame] | 207 | # For nonstatic library, $(common_javalib_jar) is the dependency file, |
| 208 | # while $(common_classes_jar) is used to link. |
| 209 | common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar |
| 210 | common_javalib_jar := $(dir $(common_classes_jar))javalib.jar |
| 211 | |
Ying Wang | 63d94fa | 2012-12-13 18:23:01 -0800 | [diff] [blame] | 212 | $(common_classes_jar) : $(my_prebuilt_src_file) | $(ACP) |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 213 | $(transform-prebuilt-to-target) |
Ying Wang | 5b316b6 | 2011-02-01 12:57:45 -0800 | [diff] [blame] | 214 | |
| 215 | $(common_javalib_jar) : $(common_classes_jar) | $(ACP) |
| 216 | $(transform-prebuilt-to-target) |
| 217 | |
| 218 | # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 219 | $(built_module) : $(common_javalib_jar) |
Ying Wang | 5b316b6 | 2011-02-01 12:57:45 -0800 | [diff] [blame] | 220 | endif # TARGET JAVA_LIBRARIES |
Elliott Hughes | 32d315a | 2013-08-13 17:05:34 -0700 | [diff] [blame] | 221 | |
| 222 | $(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES) |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 223 | |
| 224 | my_prebuilt_src_file := |
Colin Cross | 0b70c43 | 2014-01-24 13:34:51 -0800 | [diff] [blame] | 225 | |
| 226 | LOCAL_2ND_ARCH_VAR_PREFIX := |