dex_preopt_odex_install.mk revision 5c7fed28f2c06e80182a08e36318d66e494a5a33
1# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs 2# This file depends on variables set in base_rules.mk 3# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module 4 5# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc 6LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT)) 7ifneq (true,$(WITH_DEXPREOPT)) 8 LOCAL_DEX_PREOPT := 9else # WITH_DEXPREOPT=true 10 ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty 11 ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined 12 ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty 13 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT) 14 else # LOCAL_APK_LIBRARIES not empty 15 LOCAL_DEX_PREOPT := nostripping 16 endif # LOCAL_APK_LIBRARIES not empty 17 endif # LOCAL_DEX_PREOPT undefined 18 endif # TARGET_BUILD_APPS empty 19endif # WITH_DEXPREOPT=true 20ifeq (false,$(LOCAL_DEX_PREOPT)) 21 LOCAL_DEX_PREOPT := 22endif 23ifdef LOCAL_UNINSTALLABLE_MODULE 24LOCAL_DEX_PREOPT := 25endif 26ifeq (,$(strip $(all_java_sources)$(full_static_java_libs)$(my_prebuilt_src_file))) # contains no java code 27LOCAL_DEX_PREOPT := 28endif 29# if module oat file requested in data, disable LOCAL_DEX_PREOPT, will default location to dalvik-cache 30ifneq (,$(filter $(LOCAL_MODULE),$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA))) 31LOCAL_DEX_PREOPT := 32endif 33 34built_odex := 35installed_odex := 36ifdef LOCAL_DEX_PREOPT 37dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)) 38ifdef dexpreopt_boot_jar_module 39ifeq ($(DALVIK_VM_LIB),libdvm.so) 40built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex 41installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex 42else # libdvm.so 43# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE). 44# We use this installed_odex trick to get boot.art installed. 45installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) 46endif # libdvm.so 47else # boot jar 48built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex 49installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex 50 51ifneq ($(DALVIK_VM_LIB),libdvm.so) # libart 52ifndef LOCAL_DEX_PREOPT_IMAGE 53LOCAL_DEX_PREOPT_IMAGE := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) 54endif 55endif # libart 56endif # boot jar 57 58ifdef built_odex 59# We need $(LOCAL_BUILT_MODULE) in the deps to enforce reinstallation 60# even if $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE), such as in package.mk. 61$(installed_odex) : $(built_odex) $(LOCAL_BUILT_MODULE) | $(ACP) 62 @echo "Install: $@" 63 $(copy-file-to-target) 64endif 65 66# Add the installed_odex to the list of installed files for this module. 67ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(installed_odex) 68# Make sure to install the .odex when you run "make <module_name>" 69$(my_register_name): $(installed_odex) 70 71endif # LOCAL_DEX_PREOPT 72