prebuilt.mk revision 40c34f3778e778762c7a7dcaf8697b2c90a717de
1########################################################### 2## Standard rules for copying files that are prebuilt 3## 4## Additional inputs from base_rules.make: 5## None. 6## 7########################################################### 8 9ifneq ($(LOCAL_PREBUILT_LIBS),) 10$(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH)) 11endif 12ifneq ($(LOCAL_PREBUILT_EXECUTABLES),) 13$(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH)) 14endif 15ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),) 16$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH)) 17endif 18 19ifdef LOCAL_IS_HOST_MODULE 20 my_prefix:=HOST_ 21else 22 my_prefix:=TARGET_ 23endif 24ifeq (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) 28endif 29 30# Deal with the OSX library timestamp issue when installing 31# a prebuilt simulator library. 32ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) 33 prebuilt_module_is_a_library := true 34else 35 prebuilt_module_is_a_library := 36endif 37 38ifeq ($(LOCAL_STRIP_MODULE),true) 39 ifdef LOCAL_IS_HOST_MODULE 40 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH)) 41 endif 42 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),) 43 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) 44 endif 45 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) 46 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH)) 47 endif 48 include $(BUILD_SYSTEM)/dynamic_binary.mk 49 built_module := $(linked_module) 50else 51 include $(BUILD_SYSTEM)/base_rules.mk 52 built_module := $(LOCAL_BUILT_MODULE) 53 54ifdef prebuilt_module_is_a_library 55# Create a dummy export_includes. 56$(intermediates)/export_includes: 57 $(hide) mkdir -p $(dir $@) && rm -f $@ 58 $(hide) touch $@ 59 60$(LOCAL_BUILT_MODULE) : $(intermediates)/export_includes 61endif 62endif 63 64PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) 65 66ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) 67 # The magic string "EXTERNAL" means this package will be signed with 68 # the default dev key throughout the build process, but we expect 69 # the final package to be signed with a different key. 70 # 71 # This can be used for packages where we don't have access to the 72 # keys, but want the package to be predexopt'ed. 73 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) 74 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 75 76 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 77 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 78endif 79ifeq ($(LOCAL_CERTIFICATE),) 80 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 81 # It is now a build error to add a prebuilt .apk without 82 # specifying a key for it. 83 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)") 84 endif 85else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) 86 # The magic string "PRESIGNED" means this package is already checked 87 # signed with its release key. 88 # 89 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be 90 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") 91 # but the dexpreopt process will not try to re-sign the app. 92 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED 93 PACKAGES := $(PACKAGES) $(LOCAL_MODULE) 94else 95 # If this is not an absolute certificate, assign it to a generic one. 96 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) 97 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) 98 endif 99 100 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 101 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 102 PACKAGES := $(PACKAGES) $(LOCAL_MODULE) 103 104 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 105 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 106endif 107 108ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 109ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) 110# Ensure that presigned .apks have been aligned. 111$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN) 112 $(transform-prebuilt-to-target-with-zipalign) 113else 114# Sign and align non-presigned .apks. 115$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) 116 $(transform-prebuilt-to-target) 117 $(sign-package) 118 $(align-package) 119endif 120else 121ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) 122$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) 123 $(transform-prebuilt-to-target-strip-comments) 124else 125$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) 126 $(transform-prebuilt-to-target) 127ifneq ($(prebuilt_module_is_a_library),) 128 ifneq ($(LOCAL_IS_HOST_MODULE),) 129 $(transform-host-ranlib-copy-hack) 130 else 131 $(transform-ranlib-copy-hack) 132 endif 133endif 134endif 135endif 136 137ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) 138# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, 139# while the deps should be in the common dir, so we make a copy in the common dir. 140# For nonstatic library, $(common_javalib_jar) is the dependency file, 141# while $(common_classes_jar) is used to link. 142common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar 143common_javalib_jar := $(dir $(common_classes_jar))javalib.jar 144 145$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) 146 $(transform-prebuilt-to-target) 147 148$(common_javalib_jar) : $(common_classes_jar) | $(ACP) 149 $(transform-prebuilt-to-target) 150 151# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) 152$(built_module) : $(common_javalib_jar) 153endif # TARGET JAVA_LIBRARIES 154