blob: fbb7eb36c6d9e41778fdbcd0ec2f7b2a51be6b16 [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 Carlstrom27ec9612011-09-19 20:20:38 -070017########################################################################
Brian Carlstrom7ab763c2013-12-09 00:38:02 -080018# Rules to build a smaller "core" image to support core libraries
19# (that is, non-Android frameworks) testing on the host and target
20#
21# The main rules to build the default "boot" image are in
22# build/core/dex_preopt_libart.mk
Brian Carlstrom3b010aa2013-06-25 23:06:36 -070023TARGET_CORE_JARS := core-libart conscrypt okhttp core-junit bouncycastle
Brian Carlstrom87587cb2012-03-08 11:42:50 -080024HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
Brian Carlstrom16192862011-09-12 17:50:06 -070025
Brian Carlstroma004aa92012-02-08 18:05:09 -080026HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
27TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
28
29HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar)
30TARGET_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 -070031
Dave Allison70202782013-10-22 17:52:19 -070032TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
33
Nicolas Geoffray1db132d2014-03-26 10:56:24 +000034# Use dex2oat debug version for better error reporting
35$(HOST_CORE_IMG_OUT): $(HOST_CORE_DEX_FILES) $(DEX2OATD_DEPENDENCY)
Shih-wei Liao8cfa8822012-04-21 01:54:10 -070036 @echo "host dex2oat: $@ ($?)"
37 @mkdir -p $(dir $@)
Nicolas Geoffray1db132d2014-03-26 10:56:24 +000038 $(hide) $(DEX2OATD) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix \
Dave Allison70202782013-10-22 17:52:19 -070039 --dex-file=,$(HOST_CORE_DEX_FILES)) $(addprefix --dex-location=,$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$(HOST_CORE_OAT_OUT) \
Brian Carlstrom7ab763c2013-12-09 00:38:02 -080040 --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(LIBART_IMG_HOST_BASE_ADDRESS) \
Andreas Gampe922141a2014-03-12 10:59:26 -070041 --instruction-set=$(ART_HOST_ARCH) --host --android-root=$(HOST_OUT)
Brian Carlstrom27ec9612011-09-19 20:20:38 -070042
Brian Carlstrom73666be2012-03-10 20:25:10 -080043$(HOST_CORE_OAT_OUT): $(HOST_CORE_IMG_OUT)
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070044
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070045define create-oat-target-targets
Nicolas Geoffray668e9d82014-04-02 11:33:28 +010046$$($(1)TARGET_CORE_IMG_OUT): $$($(1)TARGET_CORE_DEX_FILES) $$(DEX2OATD_DEPENDENCY)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070047 @echo "target dex2oat: $$@ ($$?)"
48 @mkdir -p $$(dir $$@)
Nicolas Geoffray668e9d82014-04-02 11:33:28 +010049 $$(hide) $$(DEX2OATD) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$$(PRELOADED_CLASSES) $$(addprefix \
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070050 --dex-file=,$$(TARGET_CORE_DEX_FILES)) $$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$($(1)TARGET_CORE_OAT_OUT) \
51 --oat-location=$$($(1)TARGET_CORE_OAT) --image=$$($(1)TARGET_CORE_IMG_OUT) --base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) \
52 --instruction-set=$$($(1)TARGET_ARCH) --instruction-set-features=$$(TARGET_INSTRUCTION_SET_FEATURES) --android-root=$$(PRODUCT_OUT)/system
53
Andreas Gampe2fe07922014-04-21 07:50:39 -070054# This "renaming" eases declaration in art/Android.mk
55TARGET_CORE_IMG_OUT$($(1)ART_PHONY_TEST_TARGET_SUFFIX) := $($(1)TARGET_CORE_IMG_OUT)
56
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070057$$($(1)TARGET_CORE_OAT_OUT): $$($(1)TARGET_CORE_IMG_OUT)
58endef
59
60ifdef TARGET_2ND_ARCH
61$(eval $(call create-oat-target-targets,2ND_))
62endif
63$(eval $(call create-oat-target-targets,))
64
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070065
Brian Carlstromcb91f1a2013-02-01 12:55:09 -080066ifeq ($(ART_BUILD_HOST),true)
Brian Carlstrom85545cd2012-06-27 14:28:06 -070067include $(CLEAR_VARS)
68LOCAL_MODULE := core.art-host
69LOCAL_MODULE_TAGS := optional
Brian Carlstromc0ee6502013-07-12 18:09:50 -070070LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
71LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk
Brian Carlstrom51c24672013-07-11 16:00:56 -070072LOCAL_ADDITIONAL_DEPENDENCIES += $(HOST_CORE_IMG_OUT)
Brian Carlstrom85545cd2012-06-27 14:28:06 -070073include $(BUILD_PHONY_PACKAGE)
Brian Carlstrom660f8f02014-01-28 16:05:27 -080074endif # ART_BUILD_HOST
Brian Carlstrom85545cd2012-06-27 14:28:06 -070075
Brian Carlstrom2b070962013-10-29 13:35:25 -070076# If we aren't building the host toolchain, skip building the target core.art.
Brian Carlstromdc959ea2013-10-28 00:44:49 -070077ifeq ($(ART_BUILD_TARGET),true)
78include $(CLEAR_VARS)
79LOCAL_MODULE := core.art
80LOCAL_MODULE_TAGS := optional
81LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
82LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk
83LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_CORE_IMG_OUT)
84include $(BUILD_PHONY_PACKAGE)
Brian Carlstrom660f8f02014-01-28 16:05:27 -080085endif # ART_BUILD_TARGET