prebuilt_internal.mk revision b9aa5d43de114cecdf94fabb23d3f61f147b627d
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 19# Not much sense to check build prebuilts 20LOCAL_DONT_CHECK_MODULE := true 21 22ifdef LOCAL_PREBUILT_MODULE_FILE 23 my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) 24else 25 ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) 26 my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) 27 else 28 my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES) 29 endif 30endif 31 32ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)) 33 # Put the built targets of all shared libraries in a common directory 34 # to simplify the link line. 35 OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES) 36endif 37 38ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) 39 prebuilt_module_is_a_library := true 40else 41 prebuilt_module_is_a_library := 42endif 43 44# Don't install static libraries by default. 45ifndef LOCAL_UNINSTALLABLE_MODULE 46ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)) 47 LOCAL_UNINSTALLABLE_MODULE := true 48endif 49endif 50 51ifeq ($(LOCAL_STRIP_MODULE),true) 52 ifdef LOCAL_IS_HOST_MODULE 53 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH)) 54 endif 55 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),) 56 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) 57 endif 58 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) 59 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH)) 60 endif 61 include $(BUILD_SYSTEM)/dynamic_binary.mk 62 built_module := $(linked_module) 63else # LOCAL_STRIP_MODULE not true 64 include $(BUILD_SYSTEM)/base_rules.mk 65 built_module := $(LOCAL_BUILT_MODULE) 66 67ifdef prebuilt_module_is_a_library 68export_includes := $(intermediates)/export_includes 69$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) 70$(export_includes) : $(LOCAL_MODULE_MAKEFILE) 71 @echo Export includes file: $< -- $@ 72 $(hide) mkdir -p $(dir $@) && rm -f $@ 73ifdef LOCAL_EXPORT_C_INCLUDE_DIRS 74 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ 75 echo "-I $$d" >> $@; \ 76 done 77else 78 $(hide) touch $@ 79endif 80 81$(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes 82endif # prebuilt_module_is_a_library 83 84# The real dependency will be added after all Android.mks are loaded and the install paths 85# of the shared libraries are determined. 86ifdef LOCAL_INSTALLED_MODULE 87ifdef LOCAL_SHARED_LIBRARIES 88$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ 89 $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES)) 90 91# We also need the LOCAL_BUILT_MODULE dependency, 92# since we use -rpath-link which points to the built module's path. 93built_shared_libraries := \ 94 $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ 95 $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \ 96 $(LOCAL_SHARED_LIBRARIES))) 97$(LOCAL_BUILT_MODULE) : $(built_shared_libraries) 98endif 99endif 100 101endif # LOCAL_STRIP_MODULE not true 102 103PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) 104 105rs_compatibility_jni_libs := 106include $(BUILD_SYSTEM)/install_jni_libs.mk 107 108ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) 109 # The magic string "EXTERNAL" means this package will be signed with 110 # the default dev key throughout the build process, but we expect 111 # the final package to be signed with a different key. 112 # 113 # This can be used for packages where we don't have access to the 114 # keys, but want the package to be predexopt'ed. 115 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) 116 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 117 118 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 119 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 120endif 121ifeq ($(LOCAL_CERTIFICATE),) 122 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 123 # It is now a build error to add a prebuilt .apk without 124 # specifying a key for it. 125 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)") 126 endif 127else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) 128 # The magic string "PRESIGNED" means this package is already checked 129 # signed with its release key. 130 # 131 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be 132 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") 133 # but the dexpreopt process will not try to re-sign the app. 134 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED 135 PACKAGES := $(PACKAGES) $(LOCAL_MODULE) 136else 137 # If this is not an absolute certificate, assign it to a generic one. 138 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) 139 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) 140 endif 141 142 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 143 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 144 PACKAGES := $(PACKAGES) $(LOCAL_MODULE) 145 146 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 147 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 148endif 149 150ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),) 151 152# Disable dex-preopt of prebuilts to save space 153LOCAL_DEX_PREOPT := false 154 155####################################### 156# defines built_odex along with rule to install odex 157include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk 158####################################### 159ifdef LOCAL_DEX_PREOPT 160$(built_module): PRIVATE_BUILT_ODEX := $(built_odex) 161# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe. 162$(built_odex) : $(LOCAL_BUILT_MODULE) 163endif # LOCAL_DEX_PREOPT 164# Sign and align non-presigned .apks. 165$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) 166 $(transform-prebuilt-to-target) 167ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) 168 $(sign-package) 169endif 170ifdef LOCAL_DEX_PREOPT 171 $(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX)) 172endif 173 $(align-package) 174 175else # LOCAL_MODULE_CLASS != APPS 176ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) 177$(built_module) : $(my_prebuilt_src_file) 178 $(transform-prebuilt-to-target-strip-comments) 179else 180$(built_module) : $(my_prebuilt_src_file) | $(ACP) 181 $(transform-prebuilt-to-target) 182ifneq ($(prebuilt_module_is_a_library),) 183 ifneq ($(LOCAL_IS_HOST_MODULE),) 184 $(transform-host-ranlib-copy-hack) 185 else 186 $(transform-ranlib-copy-hack) 187 endif 188endif 189endif 190endif # LOCAL_MODULE_CLASS != APPS 191 192ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) 193# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, 194# while the deps should be in the common dir, so we make a copy in the common dir. 195# For nonstatic library, $(common_javalib_jar) is the dependency file, 196# while $(common_classes_jar) is used to link. 197common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar 198common_javalib_jar := $(dir $(common_classes_jar))javalib.jar 199 200$(common_classes_jar) : $(my_prebuilt_src_file) | $(ACP) 201 $(transform-prebuilt-to-target) 202 203$(common_javalib_jar) : $(common_classes_jar) | $(ACP) 204 $(transform-prebuilt-to-target) 205 206# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) 207$(built_module) : $(common_javalib_jar) 208endif # TARGET JAVA_LIBRARIES 209 210$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES) 211 212my_prebuilt_src_file := 213