Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 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 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 17 | ######################################################################## |
Brian Carlstrom | 7ab763c | 2013-12-09 00:38:02 -0800 | [diff] [blame] | 18 | # 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 Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 23 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 24 | include art/build/Android.common_path.mk |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 25 | |
Nicolas Geoffray | 1db132d | 2014-03-26 10:56:24 +0000 | [diff] [blame] | 26 | # Use dex2oat debug version for better error reporting |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 27 | # $(1): 2ND_ or undefined, 2ND_ for 32-bit host builds. |
Alex Light | 1ef4ce8 | 2014-08-27 11:13:47 -0700 | [diff] [blame] | 28 | # 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 Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 30 | define create-core-oat-host-rules |
Alex Light | 1ef4ce8 | 2014-08-27 11:13:47 -0700 | [diff] [blame] | 31 | $$($(1)HOST_CORE_IMG_OUT): $$(HOST_CORE_DEX_LOCATIONS) $$(DEX2OATD_DEPENDENCY) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 32 | @echo "host dex2oat: $$@ ($$?)" |
| 33 | @mkdir -p $$(dir $$@) |
Colin Cross | 44a3c19 | 2014-07-09 22:14:12 -0700 | [diff] [blame] | 34 | $$(hide) $$(DEX2OATD) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 35 | --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 Light | 53cb16b | 2014-06-12 11:26:29 -0700 | [diff] [blame] | 40 | --host --android-root=$$(HOST_OUT) --include-patch-information |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 41 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 42 | # This "renaming" eases declaration in art/Android.mk |
| 43 | HOST_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) |
| 46 | endef # create-core-oat-host-rules |
| 47 | |
| 48 | $(eval $(call create-core-oat-host-rules,)) |
| 49 | ifneq ($(HOST_PREFER_32_BIT),true) |
| 50 | $(eval $(call create-core-oat-host-rules,2ND_)) |
| 51 | endif |
Brian Carlstrom | 2b7cdf4 | 2011-10-13 11:18:28 -0700 | [diff] [blame] | 52 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 53 | define create-core-oat-target-rules |
Brian Carlstrom | 3d4e684 | 2014-07-28 23:12:58 +0000 | [diff] [blame] | 54 | $$($(1)TARGET_CORE_IMG_OUT): $$($(1)TARGET_CORE_DEX_FILES) $$(DEX2OATD_DEPENDENCY) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 55 | @echo "target dex2oat: $$@ ($$?)" |
| 56 | @mkdir -p $$(dir $$@) |
Colin Cross | 44a3c19 | 2014-07-09 22:14:12 -0700 | [diff] [blame] | 57 | $$(hide) $$(DEX2OATD) --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 58 | --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 Light | 53cb16b | 2014-06-12 11:26:29 -0700 | [diff] [blame] | 63 | --android-root=$$(PRODUCT_OUT)/system --include-patch-information |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 64 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 65 | # This "renaming" eases declaration in art/Android.mk |
| 66 | TARGET_CORE_IMG_OUT$($(1)ART_PHONY_TEST_TARGET_SUFFIX) := $($(1)TARGET_CORE_IMG_OUT) |
| 67 | |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 68 | $$($(1)TARGET_CORE_OAT_OUT): $$($(1)TARGET_CORE_IMG_OUT) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 69 | endef # create-core-oat-target-rules |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 70 | |
| 71 | ifdef TARGET_2ND_ARCH |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 72 | $(eval $(call create-core-oat-target-rules,2ND_)) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 73 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 74 | $(eval $(call create-core-oat-target-rules,)) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 75 | |
Brian Carlstrom | 2b7cdf4 | 2011-10-13 11:18:28 -0700 | [diff] [blame] | 76 | |
Brian Carlstrom | cb91f1a | 2013-02-01 12:55:09 -0800 | [diff] [blame] | 77 | ifeq ($(ART_BUILD_HOST),true) |
Brian Carlstrom | 85545cd | 2012-06-27 14:28:06 -0700 | [diff] [blame] | 78 | include $(CLEAR_VARS) |
| 79 | LOCAL_MODULE := core.art-host |
| 80 | LOCAL_MODULE_TAGS := optional |
Brian Carlstrom | c0ee650 | 2013-07-12 18:09:50 -0700 | [diff] [blame] | 81 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
| 82 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 83 | LOCAL_ADDITIONAL_DEPENDENCIES += $(HOST_CORE_IMG_OUT) |
Brian Carlstrom | 85545cd | 2012-06-27 14:28:06 -0700 | [diff] [blame] | 84 | include $(BUILD_PHONY_PACKAGE) |
Brian Carlstrom | 660f8f0 | 2014-01-28 16:05:27 -0800 | [diff] [blame] | 85 | endif # ART_BUILD_HOST |
Brian Carlstrom | 85545cd | 2012-06-27 14:28:06 -0700 | [diff] [blame] | 86 | |
Brian Carlstrom | 2b07096 | 2013-10-29 13:35:25 -0700 | [diff] [blame] | 87 | # If we aren't building the host toolchain, skip building the target core.art. |
Brian Carlstrom | dc959ea | 2013-10-28 00:44:49 -0700 | [diff] [blame] | 88 | ifeq ($(ART_BUILD_TARGET),true) |
| 89 | include $(CLEAR_VARS) |
| 90 | LOCAL_MODULE := core.art |
| 91 | LOCAL_MODULE_TAGS := optional |
| 92 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
| 93 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk |
| 94 | LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_CORE_IMG_OUT) |
| 95 | include $(BUILD_PHONY_PACKAGE) |
Brian Carlstrom | 660f8f0 | 2014-01-28 16:05:27 -0800 | [diff] [blame] | 96 | endif # ART_BUILD_TARGET |