dex_preopt_libart.mk revision b9aa5d43de114cecdf94fabb23d3f61f147b627d
1####################################
2# dexpreopt support for ART
3#
4####################################
5
6DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
7DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
8
9LIBART_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libart-compiler$(HOST_SHLIB_SUFFIX)
10LIBARTD_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libartd-compiler$(HOST_SHLIB_SUFFIX)
11
12# By default, do not run rerun dex2oat if the tool changes.
13# Comment out the | to force dex2oat to rerun on after all changes.
14DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
15DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
16DEX2OAT_DEPENDENCY += |
17DEX2OAT_DEPENDENCY += $(DEX2OAT)
18DEX2OAT_DEPENDENCY += $(LIBART_COMPILER)
19
20DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
21DEX2OATD_DEPENDENCY += $(DEX2OATD)
22DEX2OATD_DEPENDENCY += $(LIBARTD_COMPILER)
23
24PRELOADED_CLASSES := frameworks/base/preloaded-classes
25
26# start of image reserved address space
27LIBART_IMG_HOST_BASE_ADDRESS   := 0x60000000
28
29ifeq ($(TARGET_ARCH),mips)
30LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
31else
32LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
33endif
34
35########################################################################
36# The full system boot classpath
37
38# Returns the path to the .odex file
39# $(1): the arch name.
40# $(2): the full path (including file name) of the corresponding .jar or .apk.
41define get-odex-file-path
42$(dir $(2))$(1)/$(basename $(notdir $(2))).odex
43endef
44
45# Returns the path to the image file (such as "/system/framework/<arch>/boot.art"
46# $(1): the arch name (such as "arm")
47# $(2): the image location (such as "/system/framework/boot.art")
48define get-image-file-path
49$(dir $(2))$(1)/$(notdir $(2))
50endef
51
52# note we use core-libart.jar in place of core.jar for ART.
53LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
54LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
55LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
56
57my_2nd_arch_prefix :=
58include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
59
60ifdef TARGET_2ND_ARCH
61my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
62include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
63my_2nd_arch_prefix :=
64endif
65
66
67########################################################################
68# For a single jar or APK
69
70# $(1): the input .jar or .apk file
71# $(2): the output .odex file
72define dex2oat-one-file
73$(hide) rm -f $(2)
74$(hide) mkdir -p $(dir $(2))
75$(hide) $(DEX2OATD) \
76	--runtime-arg -Xms64m --runtime-arg -Xmx64m \
77	--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
78	--dex-file=$(1) \
79	--dex-location=$(PRIVATE_DEX_LOCATION) \
80	--oat-file=$(2) \
81	--android-root=$(PRODUCT_OUT)/system \
82	--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
83	--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
84endef
85