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