blob: 1c462eb86e4aa379e80120a659f934906dafb18b [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 Carlstrom16192862011-09-12 17:50:06 -070023
Ian Rogersafd9acc2014-06-17 08:21:54 -070024include art/build/Android.common_path.mk
Dave Allison70202782013-10-22 17:52:19 -070025
Nicolas Geoffray1db132d2014-03-26 10:56:24 +000026# Use dex2oat debug version for better error reporting
Ian Rogersafd9acc2014-06-17 08:21:54 -070027# $(1): 2ND_ or undefined, 2ND_ for 32-bit host builds.
Alex Light1ef4ce82014-08-27 11:13:47 -070028# NB depending on HOST_CORE_DEX_LOCATIONS so we are sure to have the dex files in frameworks for
29# run-test --no-image
Ian Rogersafd9acc2014-06-17 08:21:54 -070030define create-core-oat-host-rules
Alex Light1ef4ce82014-08-27 11:13:47 -070031$$($(1)HOST_CORE_IMG_OUT): $$(HOST_CORE_DEX_LOCATIONS) $$(DEX2OATD_DEPENDENCY)
Ian Rogersafd9acc2014-06-17 08:21:54 -070032 @echo "host dex2oat: $$@ ($$?)"
33 @mkdir -p $$(dir $$@)
Colin Cross44a3c192014-07-09 22:14:12 -070034 $$(hide) $$(DEX2OATD) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
Ian Rogersafd9acc2014-06-17 08:21:54 -070035 --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(HOST_CORE_DEX_FILES)) \
36 $$(addprefix --dex-location=,$$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$$($(1)HOST_CORE_OAT_OUT) \
37 --oat-location=$$($(1)HOST_CORE_OAT) --image=$$($(1)HOST_CORE_IMG_OUT) \
38 --base=$$(LIBART_IMG_HOST_BASE_ADDRESS) --instruction-set=$$($(1)ART_HOST_ARCH) \
39 --instruction-set-features=$$($(1)HOST_INSTRUCTION_SET_FEATURES) \
Alex Light53cb16b2014-06-12 11:26:29 -070040 --host --android-root=$$(HOST_OUT) --include-patch-information
Brian Carlstrom27ec9612011-09-19 20:20:38 -070041
Ian Rogersafd9acc2014-06-17 08:21:54 -070042# This "renaming" eases declaration in art/Android.mk
43HOST_CORE_IMG_OUT$($(1)ART_PHONY_TEST_HOST_SUFFIX) := $($(1)HOST_CORE_IMG_OUT)
44
45$$($(1)HOST_CORE_OAT_OUT): $$($(1)HOST_CORE_IMG_OUT)
46endef # create-core-oat-host-rules
47
48$(eval $(call create-core-oat-host-rules,))
49ifneq ($(HOST_PREFER_32_BIT),true)
50$(eval $(call create-core-oat-host-rules,2ND_))
51endif
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070052
Ian Rogersafd9acc2014-06-17 08:21:54 -070053define create-core-oat-target-rules
Brian Carlstrom3d4e6842014-07-28 23:12:58 +000054$$($(1)TARGET_CORE_IMG_OUT): $$($(1)TARGET_CORE_DEX_FILES) $$(DEX2OATD_DEPENDENCY)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070055 @echo "target dex2oat: $$@ ($$?)"
56 @mkdir -p $$(dir $$@)
Colin Cross44a3c192014-07-09 22:14:12 -070057 $$(hide) $$(DEX2OATD) --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
Ian Rogersafd9acc2014-06-17 08:21:54 -070058 --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(TARGET_CORE_DEX_FILES)) \
59 $$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$($(1)TARGET_CORE_OAT_OUT) \
60 --oat-location=$$($(1)TARGET_CORE_OAT) --image=$$($(1)TARGET_CORE_IMG_OUT) \
61 --base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) --instruction-set=$$($(1)TARGET_ARCH) \
62 --instruction-set-features=$$($(1)TARGET_INSTRUCTION_SET_FEATURES) \
Alex Light53cb16b2014-06-12 11:26:29 -070063 --android-root=$$(PRODUCT_OUT)/system --include-patch-information
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070064
Andreas Gampe2fe07922014-04-21 07:50:39 -070065# This "renaming" eases declaration in art/Android.mk
66TARGET_CORE_IMG_OUT$($(1)ART_PHONY_TEST_TARGET_SUFFIX) := $($(1)TARGET_CORE_IMG_OUT)
67
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070068$$($(1)TARGET_CORE_OAT_OUT): $$($(1)TARGET_CORE_IMG_OUT)
Ian Rogersafd9acc2014-06-17 08:21:54 -070069endef # create-core-oat-target-rules
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070070
71ifdef TARGET_2ND_ARCH
Ian Rogersafd9acc2014-06-17 08:21:54 -070072$(eval $(call create-core-oat-target-rules,2ND_))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070073endif
Ian Rogersafd9acc2014-06-17 08:21:54 -070074$(eval $(call create-core-oat-target-rules,))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -070075
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070076
Brian Carlstromcb91f1a2013-02-01 12:55:09 -080077ifeq ($(ART_BUILD_HOST),true)
Brian Carlstrom85545cd2012-06-27 14:28:06 -070078include $(CLEAR_VARS)
79LOCAL_MODULE := core.art-host
80LOCAL_MODULE_TAGS := optional
Brian Carlstromc0ee6502013-07-12 18:09:50 -070081LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
82LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk
Brian Carlstrom51c24672013-07-11 16:00:56 -070083LOCAL_ADDITIONAL_DEPENDENCIES += $(HOST_CORE_IMG_OUT)
Brian Carlstrom85545cd2012-06-27 14:28:06 -070084include $(BUILD_PHONY_PACKAGE)
Brian Carlstrom660f8f02014-01-28 16:05:27 -080085endif # ART_BUILD_HOST
Brian Carlstrom85545cd2012-06-27 14:28:06 -070086
Brian Carlstrom2b070962013-10-29 13:35:25 -070087# If we aren't building the host toolchain, skip building the target core.art.
Brian Carlstromdc959ea2013-10-28 00:44:49 -070088ifeq ($(ART_BUILD_TARGET),true)
89include $(CLEAR_VARS)
90LOCAL_MODULE := core.art
91LOCAL_MODULE_TAGS := optional
92LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
93LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk
94LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_CORE_IMG_OUT)
95include $(BUILD_PHONY_PACKAGE)
Brian Carlstrom660f8f02014-01-28 16:05:27 -080096endif # ART_BUILD_TARGET