prebuilt.mk revision 0219e9292e242b61058475c914930a4880c1acf2
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 19ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 20ifeq (true,$(WITH_DEXPREOPT)) 21ifeq (,$(TARGET_BUILD_APPS)) 22ifndef LOCAL_DEX_PREOPT 23LOCAL_DEX_PREOPT := true 24endif 25endif 26endif 27endif 28 29ifeq ($(LOCAL_STRIP_MODULE),true) 30 ifdef LOCAL_IS_HOST_MODULE 31 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH)) 32 endif 33 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),) 34 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) 35 endif 36 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) 37 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH)) 38 endif 39 include $(BUILD_SYSTEM)/dynamic_binary.mk 40 built_module := $(linked_module) 41else 42 include $(BUILD_SYSTEM)/base_rules.mk 43 built_module := $(LOCAL_BUILT_MODULE) 44endif 45 46# Deal with the OSX library timestamp issue when installing 47# a prebuilt simulator library. 48ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) 49 prebuilt_module_is_a_library := true 50else 51 prebuilt_module_is_a_library := 52endif 53 54PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) 55 56# Ensure that prebuilt .apks have been aligned. 57ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 58ifeq ($(LOCAL_DEX_PREOPT),true) 59# Make sure the boot jars get dexpreopt-ed first 60$(built_module): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT) 61endif 62$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN) 63 $(transform-prebuilt-to-target-with-zipalign) 64ifeq ($(LOCAL_DEX_PREOPT),true) 65 $(hide) rm -f $(patsubst %.apk,%.odex,$@) 66 $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@)) 67 $(call dexpreopt-remove-classes.dex,$@) 68 69built_odex := $(basename $(built_module)).odex 70$(built_odex): $(built_module) 71endif 72else 73ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) 74$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) 75 $(transform-prebuilt-to-target-strip-comments) 76else 77$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) 78 $(transform-prebuilt-to-target) 79endif 80endif 81 82ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) 83# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, 84# while the deps should be in the common dir, so we make a copy in the common dir. 85# For nonstatic library, $(common_javalib_jar) is the dependency file, 86# while $(common_classes_jar) is used to link. 87common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar 88common_javalib_jar := $(dir $(common_classes_jar))javalib.jar 89 90$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) 91 $(transform-prebuilt-to-target) 92 93$(common_javalib_jar) : $(common_classes_jar) | $(ACP) 94 $(transform-prebuilt-to-target) 95 96# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) 97$(built_module) : $(common_javalib_jar) 98endif # TARGET JAVA_LIBRARIES 99 100ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) 101 # The magic string "EXTERNAL" means this package will be signed with 102 # the test key throughout the build process, but we expect the final 103 # package to be signed with a different key. 104 # 105 # This can be used for packages where we don't have access to the 106 # keys, but want the package to be predexopt'ed. 107 LOCAL_CERTIFICATE := testkey 108 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 109endif 110ifeq ($(LOCAL_CERTIFICATE),) 111 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 112 # It is now a build error to add a prebuilt .apk without 113 # specifying a key for it. 114 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)") 115 endif 116else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) 117 # The magic string "PRESIGNED" means this package is already checked 118 # signed with its release key. 119 # 120 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be 121 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") 122 # but the dexpreopt process will not try to re-sign the app. 123 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED 124 PACKAGES := $(PACKAGES) $(LOCAL_MODULE) 125else 126 # If this is not an absolute certificate, assign it to a generic one. 127 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) 128 LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE) 129 endif 130 131 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 132 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 133 PACKAGES := $(PACKAGES) $(LOCAL_MODULE) 134endif 135 136ifneq ($(prebuilt_module_is_a_library),) 137 ifneq ($(LOCAL_IS_HOST_MODULE),) 138 $(transform-host-ranlib-copy-hack) 139 else 140 $(transform-ranlib-copy-hack) 141 endif 142endif 143