blob: 5468e7328d0ece5b0e8ea6e2025b3814997fb898 [file] [log] [blame]
Brian Carlstrom16192862011-09-12 17:50:06 -07001#
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
Brian Carlstrom04941d92012-02-19 01:47:51 -080017# DEX2OAT defined in build/core/config.mk
Brian Carlstrom16192862011-09-12 17:50:06 -070018DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
19# TODO: for now, override with debug version for better error reporting
20DEX2OAT := $(DEX2OATD)
21
Brian Carlstrom03a20ba2011-10-13 10:24:13 -070022# TODO: change DEX2OAT_DEPENDENCY to order-only prerequisite when output is stable
Brian Carlstromb7bbba42011-10-13 14:58:47 -070023# DEX2OAT_DEPENDENCY := | $(DEX2OAT) # only build dex2oat if needed to build oat files
Brian Carlstrom03a20ba2011-10-13 10:24:13 -070024DEX2OAT_DEPENDENCY := $(DEX2OAT) # when dex2oat changes, rebuild all oat files
Brian Carlstrom03a20ba2011-10-13 10:24:13 -070025
Brian Carlstrom78128a62011-09-15 17:21:19 -070026OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX)
27OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX)
28# TODO: for now, override with debug version for better error reporting
29OATDUMP := $(OATDUMPD)
30
Brian Carlstrome24fa612011-09-29 00:53:55 -070031# start of image reserved address space
32IMG_HOST_BASE_ADDRESS := 0x60000000
33IMG_TARGET_BASE_ADDRESS := 0x60000000
Brian Carlstrom16192862011-09-12 17:50:06 -070034
Brian Carlstromae826982011-11-09 01:33:42 -080035PRELOADED_CLASSES := frameworks/base/preloaded-classes
36
Brian Carlstrom27ec9612011-09-19 20:20:38 -070037########################################################################
38# A smaller libcore only oat file
Brian Carlstrom87587cb2012-03-08 11:42:50 -080039TARGET_CORE_JARS := core core-junit bouncycastle
40HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
Brian Carlstrom16192862011-09-12 17:50:06 -070041
Brian Carlstroma004aa92012-02-08 18:05:09 -080042HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
43TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
44
45HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar)
46TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar)
Brian Carlstrom16192862011-09-12 17:50:06 -070047
Brian Carlstrom27ec9612011-09-19 20:20:38 -070048HOST_CORE_OAT := $(HOST_OUT_JAVA_LIBRARIES)/core.oat
Brian Carlstroma004aa92012-02-08 18:05:09 -080049TARGET_CORE_OAT := $(ART_TEST_DIR)/core.oat
Brian Carlstrom16192862011-09-12 17:50:06 -070050
Brian Carlstroma004aa92012-02-08 18:05:09 -080051HOST_CORE_OAT_OUT := $(HOST_OUT_JAVA_LIBRARIES)/core.oat
52TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/core.oat
Brian Carlstrome24fa612011-09-29 00:53:55 -070053
Brian Carlstroma004aa92012-02-08 18:05:09 -080054HOST_CORE_IMG_OUT := $(HOST_OUT_JAVA_LIBRARIES)/core.art
55TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/core.art
56
57$(HOST_CORE_OAT_OUT): $(HOST_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY)
Brian Carlstrom31edec52011-10-16 17:10:24 -070058 @echo "host dex2oat: $@ ($?)"
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -070059 @mkdir -p $(dir $@)
Brian Carlstroma004aa92012-02-08 18:05:09 -080060 $(hide) $(DEX2OAT) --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=$@ --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(IMG_HOST_BASE_ADDRESS)
Brian Carlstrom27ec9612011-09-19 20:20:38 -070061
Brian Carlstroma004aa92012-02-08 18:05:09 -080062$(TARGET_CORE_OAT_OUT): $(TARGET_CORE_DEX) $(DEX2OAT_DEPENDENCY)
Brian Carlstrom31edec52011-10-16 17:10:24 -070063 @echo "target dex2oat: $@ ($?)"
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -070064 @mkdir -p $(dir $@)
Brian Carlstroma004aa92012-02-08 18:05:09 -080065 $(hide) $(DEX2OAT) --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=$@ --oat-location=$(TARGET_CORE_OAT) --image=$(TARGET_CORE_IMG_OUT) --base=$(IMG_TARGET_BASE_ADDRESS) --host-prefix=$(PRODUCT_OUT)
Brian Carlstrom27ec9612011-09-19 20:20:38 -070066
Brian Carlstroma004aa92012-02-08 18:05:09 -080067$(HOST_CORE_IMG_OUT): $(HOST_CORE_OAT_OUT)
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070068
Brian Carlstroma004aa92012-02-08 18:05:09 -080069$(TARGET_CORE_IMG_OUT): $(TARGET_CORE_OAT_OUT)
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070070
Brian Carlstrom27ec9612011-09-19 20:20:38 -070071########################################################################
72# The full system boot classpath
73TARGET_BOOT_JARS := $(subst :, ,$(DEXPREOPT_BOOT_JARS))
Brian Carlstroma004aa92012-02-08 18:05:09 -080074TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
75TARGET_BOOT_DEX_FILES := $(foreach jar,$(TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
Brian Carlstrom04941d92012-02-19 01:47:51 -080076
77TARGET_BOOT_IMG_OUT := $(DEFAULT_DEX_PREOPT_IMAGE)
78TARGET_BOOT_OAT_OUT := $(patsubst %.art,%.oat,$(TARGET_BOOT_IMG_OUT))
79TARGET_BOOT_OAT := $(subst $(PRODUCT_OUT),,$(TARGET_BOOT_OAT_OUT))
Brian Carlstrom16192862011-09-12 17:50:06 -070080
Brian Carlstroma004aa92012-02-08 18:05:09 -080081$(TARGET_BOOT_OAT_OUT): $(TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY)
Brian Carlstrom31edec52011-10-16 17:10:24 -070082 @echo "target dex2oat: $@ ($?)"
Brian Carlstromb8233d12011-10-13 11:40:38 -070083 @mkdir -p $(dir $@)
Brian Carlstroma004aa92012-02-08 18:05:09 -080084 $(hide) $(DEX2OAT) --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-file=$@ --oat-location=$(TARGET_BOOT_OAT) --image=$(TARGET_BOOT_IMG_OUT) --base=$(IMG_TARGET_BASE_ADDRESS) --host-prefix=$(PRODUCT_OUT)
Brian Carlstromb8233d12011-10-13 11:40:38 -070085
Brian Carlstroma004aa92012-02-08 18:05:09 -080086$(TARGET_BOOT_IMG_OUT): $(TARGET_BOOT_OAT_OUT)
Brian Carlstrom29e7ac72011-12-05 23:42:57 -080087
88include $(CLEAR_VARS)
89LOCAL_MODULE := boot.art
90LOCAL_MODULE_TAGS := optional
Brian Carlstroma004aa92012-02-08 18:05:09 -080091LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_BOOT_IMG_OUT)
Brian Carlstrom29e7ac72011-12-05 23:42:57 -080092include $(BUILD_PHONY_PACKAGE)