blob: b61b1803227283e6ca5b18d850346ee7cac3e431 [file] [log] [blame]
Brian Carlstromced4bff2013-11-14 23:44:56 -08001####################################
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
Brian Carlstromced4bff2013-11-14 23:44:56 -08009# By default, do not run rerun dex2oat if the tool changes.
10# Comment out the | to force dex2oat to rerun on after all changes.
11DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
12DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
13DEX2OAT_DEPENDENCY += |
14DEX2OAT_DEPENDENCY += $(DEX2OAT)
Brian Carlstromced4bff2013-11-14 23:44:56 -080015
Nicolas Geoffrayed154c32014-03-25 11:14:26 +000016DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
17DEX2OATD_DEPENDENCY += $(DEX2OATD)
Nicolas Geoffrayed154c32014-03-25 11:14:26 +000018
Brian Carlstromced4bff2013-11-14 23:44:56 -080019PRELOADED_CLASSES := frameworks/base/preloaded-classes
20
Nicolas Geoffray75c08b22014-10-06 14:53:59 +010021# Default to debug version to help find bugs.
22# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
23ifneq ($(USE_DEX2OAT_DEBUG), false)
24DEX2OAT = $(DEX2OATD)
Nicolas Geoffray4c0c3902014-10-07 11:17:09 +010025DEX2OAT_DEPENDENCY = $(DEX2OATD_DEPENDENCY)
Nicolas Geoffray75c08b22014-10-06 14:53:59 +010026endif
27
Brian Carlstromced4bff2013-11-14 23:44:56 -080028# start of image reserved address space
29LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
Mathieu Chartier3408ca02014-03-05 14:45:18 -080030LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
Brian Carlstromced4bff2013-11-14 23:44:56 -080031
Colin Crossdd2ff552014-07-09 22:09:50 -070032define get-product-default-property
33$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
Brian Carlstromcffe2892014-07-08 10:35:29 -070034endef
35
Colin Crossdd2ff552014-07-09 22:09:50 -070036DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
37DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
38DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
39DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
Brian Carlstromcffe2892014-07-08 10:35:29 -070040
Ian Rogers7d70f832014-07-16 18:06:02 -070041ifeq ($(TARGET_ARCH),mips)
42# MIPS specific overrides.
43# For MIPS the ART image is loaded at a lower address. This causes issues
44# with the image overlapping with memory on the host cross-compiling and
45# building the image. We therefore limit the Xmx value. This isn't done
46# via a property as we want the larger Xmx value if we're running on a
47# MIPS device.
48LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
Ian Rogers87f0d002014-07-16 22:25:35 -070049DEX2OAT_XMX := 128m
Ian Rogers7d70f832014-07-16 18:06:02 -070050endif
51
Brian Carlstromced4bff2013-11-14 23:44:56 -080052########################################################################
53# The full system boot classpath
54
Ying Wangb9aa5d42014-05-13 13:57:28 -070055# Returns the path to the .odex file
56# $(1): the arch name.
57# $(2): the full path (including file name) of the corresponding .jar or .apk.
58define get-odex-file-path
59$(dir $(2))$(1)/$(basename $(notdir $(2))).odex
60endef
61
62# Returns the path to the image file (such as "/system/framework/<arch>/boot.art"
63# $(1): the arch name (such as "arm")
64# $(2): the image location (such as "/system/framework/boot.art")
65define get-image-file-path
66$(dir $(2))$(1)/$(notdir $(2))
67endef
68
Brian Carlstromced4bff2013-11-14 23:44:56 -080069# note we use core-libart.jar in place of core.jar for ART.
70LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
71LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
72LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
73
Ying Wangb9aa5d42014-05-13 13:57:28 -070074my_2nd_arch_prefix :=
75include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
Brian Carlstromced4bff2013-11-14 23:44:56 -080076
Ying Wangb9aa5d42014-05-13 13:57:28 -070077ifdef TARGET_2ND_ARCH
78my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
79include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
80my_2nd_arch_prefix :=
81endif
Brian Carlstromced4bff2013-11-14 23:44:56 -080082
83
84########################################################################
85# For a single jar or APK
86
Ying Wangb9aa5d42014-05-13 13:57:28 -070087# $(1): the input .jar or .apk file
88# $(2): the output .odex file
Brian Carlstromced4bff2013-11-14 23:44:56 -080089define dex2oat-one-file
Ying Wangb9aa5d42014-05-13 13:57:28 -070090$(hide) rm -f $(2)
91$(hide) mkdir -p $(dir $(2))
Nicolas Geoffray75c08b22014-10-06 14:53:59 +010092$(hide) $(DEX2OAT) \
Colin Crossdd2ff552014-07-09 22:09:50 -070093 --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
Ying Wangb9aa5d42014-05-13 13:57:28 -070094 --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
95 --dex-file=$(1) \
96 --dex-location=$(PRIVATE_DEX_LOCATION) \
97 --oat-file=$(2) \
Brian Carlstromced4bff2013-11-14 23:44:56 -080098 --android-root=$(PRODUCT_OUT)/system \
Ying Wangb9aa5d42014-05-13 13:57:28 -070099 --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
Alex Lightce090d32014-07-24 16:26:13 -0700100 --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
Ying Wang20ebd2e2014-10-07 18:07:23 -0700101 --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \
102 $(PRIVATE_DEX_PREOPT_FLAGS)
Brian Carlstromced4bff2013-11-14 23:44:56 -0800103endef