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