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 | c36b450 | 2011-09-15 12:00:52 -0700 | [diff] [blame] | 19 | ifdef LOCAL_IS_HOST_MODULE |
| 20 | my_prefix:=HOST_ |
| 21 | else |
| 22 | my_prefix:=TARGET_ |
| 23 | endif |
| 24 | ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 25 | # Put the built targets of all shared libraries in a common directory |
| 26 | # to simplify the link line. |
| 27 | OVERRIDE_BUILT_MODULE_PATH := $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES) |
| 28 | endif |
| 29 | |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 30 | ifeq ($(LOCAL_STRIP_MODULE),true) |
| 31 | ifdef LOCAL_IS_HOST_MODULE |
| 32 | $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH)) |
| 33 | endif |
| 34 | ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),) |
| 35 | $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) |
| 36 | endif |
| 37 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
| 38 | $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH)) |
| 39 | endif |
| 40 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 41 | built_module := $(linked_module) |
| 42 | else |
| 43 | include $(BUILD_SYSTEM)/base_rules.mk |
| 44 | built_module := $(LOCAL_BUILT_MODULE) |
| 45 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 46 | |
| 47 | # Deal with the OSX library timestamp issue when installing |
| 48 | # a prebuilt simulator library. |
| 49 | ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) |
| 50 | prebuilt_module_is_a_library := true |
| 51 | else |
| 52 | prebuilt_module_is_a_library := |
| 53 | endif |
| 54 | |
Owen Lin | 64d5a80 | 2009-10-16 02:43:05 -0700 | [diff] [blame] | 55 | PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) |
| 56 | |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 57 | ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) |
| 58 | # The magic string "EXTERNAL" means this package will be signed with |
| 59 | # the default dev key throughout the build process, but we expect |
| 60 | # the final package to be signed with a different key. |
| 61 | # |
| 62 | # This can be used for packages where we don't have access to the |
| 63 | # keys, but want the package to be predexopt'ed. |
| 64 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 65 | PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 |
| 66 | |
| 67 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 68 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 69 | endif |
| 70 | ifeq ($(LOCAL_CERTIFICATE),) |
| 71 | ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) |
| 72 | # It is now a build error to add a prebuilt .apk without |
| 73 | # specifying a key for it. |
| 74 | $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)") |
| 75 | endif |
| 76 | else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 77 | # The magic string "PRESIGNED" means this package is already checked |
| 78 | # signed with its release key. |
| 79 | # |
| 80 | # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be |
| 81 | # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") |
| 82 | # but the dexpreopt process will not try to re-sign the app. |
| 83 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED |
| 84 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 85 | else |
| 86 | # If this is not an absolute certificate, assign it to a generic one. |
| 87 | ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) |
| 88 | LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) |
| 89 | endif |
| 90 | |
| 91 | PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 92 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 93 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 94 | |
| 95 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 96 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 97 | endif |
| 98 | |
Dianne Hackborn | 9c0c4b7 | 2009-08-11 19:16:46 -0700 | [diff] [blame] | 99 | ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 100 | ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 101 | # Ensure that presigned .apks have been aligned. |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 102 | $(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN) |
Dianne Hackborn | 9c0c4b7 | 2009-08-11 19:16:46 -0700 | [diff] [blame] | 103 | $(transform-prebuilt-to-target-with-zipalign) |
| 104 | else |
Doug Zongker | 08d79c1 | 2011-10-05 08:16:30 -0700 | [diff] [blame] | 105 | # Sign and align non-presigned .apks. |
| 106 | $(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) |
| 107 | $(transform-prebuilt-to-target) |
| 108 | $(sign-package) |
| 109 | $(align-package) |
| 110 | endif |
| 111 | else |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 112 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 113 | $(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 114 | $(transform-prebuilt-to-target-strip-comments) |
| 115 | else |
Ji-Hwan Lee | 0219e92 | 2011-07-07 03:10:14 +0900 | [diff] [blame] | 116 | $(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 117 | $(transform-prebuilt-to-target) |
Doug Zongker | 1046d20 | 2009-08-06 13:02:19 -0700 | [diff] [blame] | 118 | endif |
Dianne Hackborn | 9c0c4b7 | 2009-08-11 19:16:46 -0700 | [diff] [blame] | 119 | endif |
| 120 | |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 121 | ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) |
| 122 | # for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, |
| 123 | # 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] | 124 | # For nonstatic library, $(common_javalib_jar) is the dependency file, |
| 125 | # while $(common_classes_jar) is used to link. |
| 126 | common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar |
| 127 | common_javalib_jar := $(dir $(common_classes_jar))javalib.jar |
| 128 | |
| 129 | $(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 130 | $(transform-prebuilt-to-target) |
Ying Wang | 5b316b6 | 2011-02-01 12:57:45 -0800 | [diff] [blame] | 131 | |
| 132 | $(common_javalib_jar) : $(common_classes_jar) | $(ACP) |
| 133 | $(transform-prebuilt-to-target) |
| 134 | |
| 135 | # 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] | 136 | $(built_module) : $(common_javalib_jar) |
Ying Wang | 5b316b6 | 2011-02-01 12:57:45 -0800 | [diff] [blame] | 137 | endif # TARGET JAVA_LIBRARIES |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 138 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 139 | ifneq ($(prebuilt_module_is_a_library),) |
| 140 | ifneq ($(LOCAL_IS_HOST_MODULE),) |
| 141 | $(transform-host-ranlib-copy-hack) |
| 142 | else |
| 143 | $(transform-ranlib-copy-hack) |
| 144 | endif |
| 145 | endif |