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 | |
Nicolas Geoffray | 611e1db | 2014-10-09 17:34:45 +0100 | [diff] [blame] | 24 | include art/build/Android.common_build.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 |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 27 | # $(1): compiler |
| 28 | # $(2): 2ND_ or undefined, 2ND_ for 32-bit host builds. |
Alex Light | 1ef4ce8 | 2014-08-27 11:13:47 -0700 | [diff] [blame] | 29 | # NB depending on HOST_CORE_DEX_LOCATIONS so we are sure to have the dex files in frameworks for |
| 30 | # run-test --no-image |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 31 | define create-core-oat-host-rules |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 32 | core_compile_options := |
| 33 | core_image_name := |
| 34 | core_oat_name := |
| 35 | core_infix := |
| 36 | |
| 37 | ifeq ($(1),optimizing) |
| 38 | core_compile_options += --compiler-backend=optimizing |
| 39 | core_infix := -optimizing |
| 40 | endif |
| 41 | ifeq ($(1),interpreter) |
| 42 | core_compile_options += --compiler-filter=interpret-only |
| 43 | core_infix := -interpreter |
| 44 | endif |
| 45 | ifeq ($(1),default) |
| 46 | # Default has no infix, no compile options. |
| 47 | endif |
| 48 | ifneq ($(filter-out default interpreter optimizing,$(1)),) |
| 49 | #Technically this test is not precise, but hopefully good enough. |
| 50 | $$(error found $(1) expected default, interpreter or optimizing) |
| 51 | endif |
| 52 | core_image_name := $($(2)HOST_CORE_IMG_OUT_BASE)$$(core_infix)$(CORE_IMG_SUFFIX) |
| 53 | core_oat_name := $($(2)HOST_CORE_OAT_OUT_BASE)$$(core_infix)$(CORE_OAT_SUFFIX) |
| 54 | |
| 55 | # Using the bitness suffix makes it easier to add as a dependency for the run-test mk. |
| 56 | ifeq ($(2),) |
| 57 | HOST_CORE_IMAGE_$(1)_64 := $$(core_image_name) |
| 58 | else |
| 59 | HOST_CORE_IMAGE_$(1)_32 := $$(core_image_name) |
| 60 | endif |
| 61 | HOST_CORE_IMG_OUTS += $$(core_image_name) |
| 62 | HOST_CORE_OAT_OUTS += $$(core_oat_name) |
| 63 | |
| 64 | $$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options) |
| 65 | $$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name) |
| 66 | $$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name) |
| 67 | $$(core_image_name): $$(HOST_CORE_DEX_LOCATIONS) $$(DEX2OAT_DEPENDENCY) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 68 | @echo "host dex2oat: $$@ ($$?)" |
| 69 | @mkdir -p $$(dir $$@) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 70 | $$(hide) $$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 71 | --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(HOST_CORE_DEX_FILES)) \ |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 72 | $$(addprefix --dex-location=,$$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \ |
| 73 | --oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \ |
| 74 | --base=$$(LIBART_IMG_HOST_BASE_ADDRESS) --instruction-set=$$($(2)ART_HOST_ARCH) \ |
| 75 | --instruction-set-features=$$($(2)HOST_INSTRUCTION_SET_FEATURES) \ |
| 76 | --host --android-root=$$(HOST_OUT) --include-patch-information \ |
| 77 | $$(PRIVATE_CORE_COMPILE_OPTIONS) |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 78 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 79 | $$(core_oat_name): $$(core_image_name) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 80 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 81 | # Clean up locally used variables. |
| 82 | core_compile_options := |
| 83 | core_image_name := |
| 84 | core_oat_name := |
| 85 | core_infix := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 86 | endef # create-core-oat-host-rules |
| 87 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 88 | $(eval $(call create-core-oat-host-rules,default,)) |
| 89 | $(eval $(call create-core-oat-host-rules,optimizing,)) |
| 90 | $(eval $(call create-core-oat-host-rules,interpreter,)) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 91 | ifneq ($(HOST_PREFER_32_BIT),true) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 92 | $(eval $(call create-core-oat-host-rules,default,2ND_)) |
| 93 | $(eval $(call create-core-oat-host-rules,optimizing,2ND_)) |
| 94 | $(eval $(call create-core-oat-host-rules,interpreter,2ND_)) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 95 | endif |
Brian Carlstrom | 2b7cdf4 | 2011-10-13 11:18:28 -0700 | [diff] [blame] | 96 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 97 | define create-core-oat-target-rules |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 98 | core_compile_options := |
| 99 | core_image_name := |
| 100 | core_oat_name := |
| 101 | core_infix := |
| 102 | |
| 103 | ifeq ($(1),optimizing) |
| 104 | core_compile_options += --compiler-backend=optimizing |
| 105 | core_infix := -optimizing |
| 106 | endif |
| 107 | ifeq ($(1),interpreter) |
| 108 | core_compile_options += --compiler-filter=interpret-only |
| 109 | core_infix := -interpreter |
| 110 | endif |
| 111 | ifeq ($(1),default) |
| 112 | # Default has no infix, no compile options. |
| 113 | endif |
| 114 | ifneq ($(filter-out default interpreter optimizing,$(1)),) |
| 115 | #Technically this test is not precise, but hopefully good enough. |
| 116 | $$(error found $(1) expected default, interpreter or optimizing) |
| 117 | endif |
| 118 | core_image_name := $($(2)TARGET_CORE_IMG_OUT_BASE)$$(core_infix)$(CORE_IMG_SUFFIX) |
| 119 | core_oat_name := $($(2)TARGET_CORE_OAT_OUT_BASE)$$(core_infix)$(CORE_OAT_SUFFIX) |
| 120 | |
| 121 | # Using the bitness suffix makes it easier to add as a dependency for the run-test mk. |
| 122 | ifeq ($(2),) |
| 123 | TARGET_CORE_IMAGE_$(1)_64 := $$(core_image_name) |
| 124 | else |
| 125 | TARGET_CORE_IMAGE_$(1)_32 := $$(core_image_name) |
| 126 | endif |
| 127 | TARGET_CORE_IMG_OUTS += $$(core_image_name) |
| 128 | TARGET_CORE_OAT_OUTS += $$(core_oat_name) |
| 129 | |
| 130 | $$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options) |
| 131 | $$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name) |
| 132 | $$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name) |
| 133 | $$(core_image_name): $$(TARGET_CORE_DEX_FILES) $$(DEX2OAT_DEPENDENCY) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 134 | @echo "target dex2oat: $$@ ($$?)" |
| 135 | @mkdir -p $$(dir $$@) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 136 | $$(hide) $$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 137 | --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(TARGET_CORE_DEX_FILES)) \ |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 138 | $$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \ |
| 139 | --oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \ |
| 140 | --base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) --instruction-set=$$($(2)TARGET_ARCH) \ |
| 141 | --instruction-set-features=$$($(2)TARGET_INSTRUCTION_SET_FEATURES) \ |
| 142 | --android-root=$$(PRODUCT_OUT)/system --include-patch-information \ |
| 143 | $$(PRIVATE_CORE_COMPILE_OPTIONS) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 144 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 145 | $$(core_oat_name): $$(core_image_name) |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 146 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 147 | # Clean up locally used variables. |
| 148 | core_compile_options := |
| 149 | core_image_name := |
| 150 | core_oat_name := |
| 151 | core_infix := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 152 | endef # create-core-oat-target-rules |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 153 | |
| 154 | ifdef TARGET_2ND_ARCH |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 155 | $(eval $(call create-core-oat-target-rules,default,2ND_)) |
| 156 | $(eval $(call create-core-oat-target-rules,optimizing,2ND_)) |
| 157 | $(eval $(call create-core-oat-target-rules,interpreter,2ND_)) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 158 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 159 | $(eval $(call create-core-oat-target-rules,default,)) |
| 160 | $(eval $(call create-core-oat-target-rules,optimizing,)) |
| 161 | $(eval $(call create-core-oat-target-rules,interpreter,)) |