1# 2# Copyright (C) 2011 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# DEX2OAT defined in build/core/config.mk 18DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX) 19 20LIBART_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libart-compiler$(HOST_SHLIB_SUFFIX) 21LIBARTD_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libartd-compiler$(HOST_SHLIB_SUFFIX) 22 23# TODO: for now, override with debug version for better error reporting 24DEX2OAT := $(DEX2OATD) 25LIBART_COMPILER := $(LIBARTD_COMPILER) 26 27# By default, do not run rerun dex2oat if the tool changes. 28# Comment out the | to force dex2oat to rerun on after all changes. 29DEX2OAT_DEPENDENCY := | 30DEX2OAT_DEPENDENCY += $(DEX2OAT) 31DEX2OAT_DEPENDENCY += $(LIBART_COMPILER) 32 33OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX) 34OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX) 35# TODO: for now, override with debug version for better error reporting 36OATDUMP := $(OATDUMPD) 37 38PRELOADED_CLASSES := frameworks/base/preloaded-classes 39 40######################################################################## 41# A smaller libcore only oat file 42TARGET_CORE_JARS := core-libart conscrypt okhttp core-junit bouncycastle 43HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS)) 44 45HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) 46TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) 47 48HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar) 49TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar) 50 51HOST_CORE_OAT := $(HOST_OUT_JAVA_LIBRARIES)/core.oat 52TARGET_CORE_OAT := $(ART_TEST_DIR)/core.oat 53 54HOST_CORE_OAT_OUT := $(HOST_OUT_JAVA_LIBRARIES)/core.oat 55TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/core.oat 56 57HOST_CORE_IMG_OUT := $(HOST_OUT_JAVA_LIBRARIES)/core.art 58TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/core.art 59 60$(HOST_CORE_IMG_OUT): $(HOST_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY) 61 @echo "host dex2oat: $@ ($?)" 62 @mkdir -p $(dir $@) 63 $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(HOST_CORE_DEX_FILES)) $(addprefix --dex-location=,$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$(HOST_CORE_OAT_OUT) --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(IMG_HOST_BASE_ADDRESS) --instruction-set=$(HOST_ARCH) --host --android-root=$(HOST_OUT) 64 65$(TARGET_CORE_IMG_OUT): $(TARGET_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY) 66 @echo "target dex2oat: $@ ($?)" 67 @mkdir -p $(dir $@) 68 $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(TARGET_CORE_DEX_FILES)) $(addprefix --dex-location=,$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$(TARGET_CORE_OAT_OUT) --oat-location=$(TARGET_CORE_OAT) --image=$(TARGET_CORE_IMG_OUT) --base=$(IMG_TARGET_BASE_ADDRESS) --instruction-set=$(TARGET_ARCH) --host-prefix=$(PRODUCT_OUT) --android-root=$(PRODUCT_OUT)/system 69 70$(HOST_CORE_OAT_OUT): $(HOST_CORE_IMG_OUT) 71 72$(TARGET_CORE_OAT_OUT): $(TARGET_CORE_IMG_OUT) 73 74ifeq ($(ART_BUILD_HOST),true) 75include $(CLEAR_VARS) 76LOCAL_MODULE := core.art-host 77LOCAL_MODULE_TAGS := optional 78LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk 79LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk 80LOCAL_ADDITIONAL_DEPENDENCIES += $(HOST_CORE_IMG_OUT) 81include $(BUILD_PHONY_PACKAGE) 82endif 83 84######################################################################## 85# The full system boot classpath 86TARGET_BOOT_JARS := $(subst :, ,$(DEXPREOPT_BOOT_JARS)) 87TARGET_BOOT_JARS := $(foreach jar,$(TARGET_BOOT_JARS),$(patsubst core, core-libart,$(jar))) 88TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) 89TARGET_BOOT_DEX_FILES := $(foreach jar,$(TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar) 90 91TARGET_BOOT_IMG_OUT := $(DEFAULT_DEX_PREOPT_IMAGE) 92TARGET_BOOT_OAT_OUT := $(patsubst %.art,%.oat,$(TARGET_BOOT_IMG_OUT)) 93TARGET_BOOT_OAT := $(subst $(PRODUCT_OUT),,$(TARGET_BOOT_OAT_OUT)) 94TARGET_BOOT_OAT_UNSTRIPPED_OUT := $(TARGET_OUT_UNSTRIPPED)$(TARGET_BOOT_OAT) 95 96$(TARGET_BOOT_IMG_OUT): $(TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY) 97 @echo "target dex2oat: $@ ($?)" 98 @mkdir -p $(dir $@) 99 @mkdir -p $(dir $(TARGET_BOOT_OAT_UNSTRIPPED_OUT)) 100 $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(TARGET_BOOT_DEX_FILES)) $(addprefix --dex-location=,$(TARGET_BOOT_DEX_LOCATIONS)) --oat-symbols=$(TARGET_BOOT_OAT_UNSTRIPPED_OUT) --oat-file=$(TARGET_BOOT_OAT_OUT) --oat-location=$(TARGET_BOOT_OAT) --image=$(TARGET_BOOT_IMG_OUT) --base=$(IMG_TARGET_BASE_ADDRESS) --instruction-set=$(TARGET_ARCH) --host-prefix=$(PRODUCT_OUT) --android-root=$(PRODUCT_OUT)/system 101 102$(TARGET_BOOT_OAT_UNSTRIPPED_OUT): $(TARGET_BOOT_IMG_OUT) 103 104$(TARGET_BOOT_OAT_OUT): $(TARGET_BOOT_OAT_UNSTRIPPED_OUT) 105 106ifeq ($(ART_BUILD_TARGET_NDEBUG),true) 107include $(CLEAR_VARS) 108LOCAL_MODULE := boot.art 109LOCAL_MODULE_TAGS := optional 110LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk 111LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk 112LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_BOOT_IMG_OUT) $(TARGET_BOOT_OAT_OUT) 113include $(BUILD_PHONY_PACKAGE) 114endif 115