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