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 | |
Andreas Gampe | 4d2ef33 | 2015-08-05 09:24:45 -0700 | [diff] [blame] | 26 | LOCAL_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 27 | ifeq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),) |
Andreas Gampe | 4d2ef33 | 2015-08-05 09:24:45 -0700 | [diff] [blame] | 28 | LOCAL_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=default |
| 29 | else |
| 30 | LOCAL_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=$(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES) |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 31 | endif |
Andreas Gampe | 4d2ef33 | 2015-08-05 09:24:45 -0700 | [diff] [blame] | 32 | LOCAL_$(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 33 | ifeq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),) |
Andreas Gampe | 4d2ef33 | 2015-08-05 09:24:45 -0700 | [diff] [blame] | 34 | LOCAL_$(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=default |
| 35 | else |
| 36 | LOCAL_$(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=$($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES) |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 37 | endif |
| 38 | |
Nicolas Geoffray | 1db132d | 2014-03-26 10:56:24 +0000 | [diff] [blame] | 39 | # Use dex2oat debug version for better error reporting |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 40 | # $(1): compiler - default, optimizing, jit, interpreter or interpreter-access-checks. |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 41 | # $(2): pic/no-pic |
| 42 | # $(3): 2ND_ or undefined, 2ND_ for 32-bit host builds. |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 43 | # $(4): wrapper, e.g., valgrind. |
| 44 | # $(5): dex2oat suffix, e.g, valgrind requires 32 right now. |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 45 | # $(6): multi-image. |
Alex Light | 1ef4ce8 | 2014-08-27 11:13:47 -0700 | [diff] [blame] | 46 | # NB depending on HOST_CORE_DEX_LOCATIONS so we are sure to have the dex files in frameworks for |
| 47 | # run-test --no-image |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 48 | define create-core-oat-host-rules |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 49 | core_compile_options := |
| 50 | core_image_name := |
| 51 | core_oat_name := |
| 52 | core_infix := |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 53 | core_pic_infix := |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 54 | core_dex2oat_dependency := $(DEX2OAT_DEPENDENCY) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 55 | |
Nicolas Geoffray | 6427df1 | 2014-12-17 12:34:15 +0000 | [diff] [blame] | 56 | ifeq ($(1),default) |
| 57 | core_compile_options += --compiler-backend=Quick |
| 58 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 59 | ifeq ($(1),optimizing) |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 60 | core_compile_options += --compiler-backend=Optimizing |
Nicolas Geoffray | c13f13a | 2015-10-06 12:39:17 +0100 | [diff] [blame] | 61 | core_dex2oat_dependency := $(DEX2OAT) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 62 | core_infix := -optimizing |
| 63 | endif |
| 64 | ifeq ($(1),interpreter) |
| 65 | core_compile_options += --compiler-filter=interpret-only |
| 66 | core_infix := -interpreter |
| 67 | endif |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 68 | ifeq ($(1),interp-ac) |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 69 | core_compile_options += --compiler-filter=verify-at-runtime --runtime-arg -Xverify:softfail |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 70 | core_infix := -interp-ac |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 71 | endif |
Andreas Gampe | 8a159fd | 2015-09-21 15:14:38 -0700 | [diff] [blame] | 72 | ifeq ($(1),jit) |
| 73 | core_compile_options += --compiler-filter=verify-at-runtime |
| 74 | core_infix := -jit |
| 75 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 76 | ifeq ($(1),default) |
| 77 | # Default has no infix, no compile options. |
| 78 | endif |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 79 | ifneq ($(filter-out default interpreter interp-ac jit optimizing,$(1)),) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 80 | #Technically this test is not precise, but hopefully good enough. |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 81 | $$(error found $(1) expected default, interpreter, interpreter-access-checks, jit or optimizing) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 82 | endif |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 83 | |
| 84 | ifeq ($(2),pic) |
| 85 | core_compile_options += --compile-pic |
| 86 | core_pic_infix := -pic |
| 87 | endif |
| 88 | ifeq ($(2),no-pic) |
| 89 | # No change for non-pic |
| 90 | endif |
| 91 | ifneq ($(filter-out pic no-pic,$(2)),) |
| 92 | # Technically this test is not precise, but hopefully good enough. |
| 93 | $$(error found $(2) expected pic or no-pic) |
| 94 | endif |
| 95 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 96 | # If $(6) is true, generate a multi-image. |
| 97 | ifeq ($(6),true) |
| 98 | core_multi_infix := -multi |
| 99 | core_multi_param := --multi-image --no-inline-from=core-oj-hostdex.jar |
| 100 | core_multi_group := _multi |
| 101 | else |
| 102 | core_multi_infix := |
| 103 | core_multi_param := |
| 104 | core_multi_group := |
| 105 | endif |
| 106 | |
| 107 | core_image_name := $($(3)HOST_CORE_IMG_OUT_BASE)$$(core_infix)$$(core_pic_infix)$$(core_multi_infix)$(4)$(CORE_IMG_SUFFIX) |
| 108 | core_oat_name := $($(3)HOST_CORE_OAT_OUT_BASE)$$(core_infix)$$(core_pic_infix)$$(core_multi_infix)$(4)$(CORE_OAT_SUFFIX) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 109 | |
| 110 | # 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] | 111 | ifeq ($(3),) |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 112 | $(4)HOST_CORE_IMAGE_$(1)_$(2)$$(core_multi_group)_64 := $$(core_image_name) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 113 | else |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 114 | $(4)HOST_CORE_IMAGE_$(1)_$(2)$$(core_multi_group)_32 := $$(core_image_name) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 115 | endif |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 116 | $(4)HOST_CORE_IMG_OUTS += $$(core_image_name) |
| 117 | $(4)HOST_CORE_OAT_OUTS += $$(core_oat_name) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 118 | |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 119 | # If we have a wrapper, make the target phony. |
| 120 | ifneq ($(4),) |
| 121 | .PHONY: $$(core_image_name) |
| 122 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 123 | $$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options) |
| 124 | $$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name) |
| 125 | $$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name) |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 126 | $$(core_image_name): PRIVATE_CORE_MULTI_PARAM := $$(core_multi_param) |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 127 | $$(core_image_name): $$(HOST_CORE_DEX_LOCATIONS) $$(core_dex2oat_dependency) |
Shinichiro Hamaji | c5d2905 | 2015-12-18 15:51:51 +0900 | [diff] [blame] | 128 | @echo "host dex2oat: $$@" |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 129 | @mkdir -p $$(dir $$@) |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 130 | $$(hide) $(4) $$(DEX2OAT)$(5) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \ |
| 131 | --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 132 | --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(HOST_CORE_DEX_FILES)) \ |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 133 | $$(addprefix --dex-location=,$$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \ |
| 134 | --oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \ |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 135 | --base=$$(LIBART_IMG_HOST_BASE_ADDRESS) --instruction-set=$$($(3)ART_HOST_ARCH) \ |
Andreas Gampe | 4d2ef33 | 2015-08-05 09:24:45 -0700 | [diff] [blame] | 136 | $$(LOCAL_$(3)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION) \ |
David Srbecky | 461d72a | 2015-06-11 01:27:56 +0100 | [diff] [blame] | 137 | --host --android-root=$$(HOST_OUT) --include-patch-information --generate-debug-info \ |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 138 | $$(PRIVATE_CORE_MULTI_PARAM) $$(PRIVATE_CORE_COMPILE_OPTIONS) |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 139 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 140 | $$(core_oat_name): $$(core_image_name) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 141 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 142 | # Clean up locally used variables. |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 143 | core_dex2oat_dependency := |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 144 | core_compile_options := |
| 145 | core_image_name := |
| 146 | core_oat_name := |
| 147 | core_infix := |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 148 | core_pic_infix := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 149 | endef # create-core-oat-host-rules |
| 150 | |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 151 | # $(1): compiler - default, optimizing, jit, interpreter or interpreter-access-checks. |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 152 | # $(2): wrapper. |
| 153 | # $(3): dex2oat suffix. |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 154 | # $(4): multi-image. |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 155 | define create-core-oat-host-rule-combination |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 156 | $(call create-core-oat-host-rules,$(1),no-pic,,$(2),$(3),$(4)) |
| 157 | $(call create-core-oat-host-rules,$(1),pic,,$(2),$(3),$(4)) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 158 | |
| 159 | ifneq ($(HOST_PREFER_32_BIT),true) |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 160 | $(call create-core-oat-host-rules,$(1),no-pic,2ND_,$(2),$(3),$(4)) |
| 161 | $(call create-core-oat-host-rules,$(1),pic,2ND_,$(2),$(3),$(4)) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 162 | endif |
| 163 | endef |
| 164 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 165 | $(eval $(call create-core-oat-host-rule-combination,default,,,false)) |
| 166 | $(eval $(call create-core-oat-host-rule-combination,optimizing,,,false)) |
| 167 | $(eval $(call create-core-oat-host-rule-combination,interpreter,,,false)) |
| 168 | $(eval $(call create-core-oat-host-rule-combination,interp-ac,,,false)) |
| 169 | $(eval $(call create-core-oat-host-rule-combination,jit,,,false)) |
| 170 | $(eval $(call create-core-oat-host-rule-combination,default,,,true)) |
| 171 | $(eval $(call create-core-oat-host-rule-combination,optimizing,,,true)) |
| 172 | $(eval $(call create-core-oat-host-rule-combination,interpreter,,,true)) |
| 173 | $(eval $(call create-core-oat-host-rule-combination,interp-ac,,,true)) |
| 174 | $(eval $(call create-core-oat-host-rule-combination,jit,,,true)) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 175 | |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 176 | valgrindHOST_CORE_IMG_OUTS := |
| 177 | valgrindHOST_CORE_OAT_OUTS := |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 178 | $(eval $(call create-core-oat-host-rule-combination,default,valgrind,32,false)) |
| 179 | $(eval $(call create-core-oat-host-rule-combination,optimizing,valgrind,32,false)) |
| 180 | $(eval $(call create-core-oat-host-rule-combination,interpreter,valgrind,32,false)) |
| 181 | $(eval $(call create-core-oat-host-rule-combination,interp-ac,valgrind,32,false)) |
| 182 | $(eval $(call create-core-oat-host-rule-combination,jit,valgrind,32,false)) |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 183 | |
| 184 | valgrind-test-art-host-dex2oat-host: $(valgrindHOST_CORE_IMG_OUTS) |
Brian Carlstrom | 2b7cdf4 | 2011-10-13 11:18:28 -0700 | [diff] [blame] | 185 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 186 | test-art-host-dex2oat-host: $(HOST_CORE_IMG_OUTS) |
| 187 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 188 | define create-core-oat-target-rules |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 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 := |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 194 | core_dex2oat_dependency := $(DEX2OAT_DEPENDENCY) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 195 | |
Nicolas Geoffray | 6427df1 | 2014-12-17 12:34:15 +0000 | [diff] [blame] | 196 | ifeq ($(1),default) |
| 197 | core_compile_options += --compiler-backend=Quick |
| 198 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 199 | ifeq ($(1),optimizing) |
Serban Constantinescu | 010cf91 | 2014-12-04 18:12:21 +0000 | [diff] [blame] | 200 | core_compile_options += --compiler-backend=Optimizing |
Nicolas Geoffray | 7701d10 | 2015-10-05 09:51:36 +0100 | [diff] [blame] | 201 | # With the optimizing compiler, we want to rerun dex2oat whenever there is |
| 202 | # a dex2oat change to catch regressions early. |
| 203 | core_dex2oat_dependency := $(DEX2OAT) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 204 | core_infix := -optimizing |
| 205 | endif |
| 206 | ifeq ($(1),interpreter) |
| 207 | core_compile_options += --compiler-filter=interpret-only |
| 208 | core_infix := -interpreter |
| 209 | endif |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 210 | ifeq ($(1),interp-ac) |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 211 | core_compile_options += --compiler-filter=verify-at-runtime --runtime-arg -Xverify:softfail |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 212 | core_infix := -interp-ac |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 213 | endif |
Andreas Gampe | 8a159fd | 2015-09-21 15:14:38 -0700 | [diff] [blame] | 214 | ifeq ($(1),jit) |
| 215 | core_compile_options += --compiler-filter=verify-at-runtime |
| 216 | core_infix := -jit |
| 217 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 218 | ifeq ($(1),default) |
| 219 | # Default has no infix, no compile options. |
| 220 | endif |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 221 | ifneq ($(filter-out default interpreter interp-ac jit optimizing,$(1)),) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 222 | # Technically this test is not precise, but hopefully good enough. |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 223 | $$(error found $(1) expected default, interpreter, interpreter-access-checks, jit or optimizing) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 224 | endif |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 225 | |
| 226 | ifeq ($(2),pic) |
| 227 | core_compile_options += --compile-pic |
| 228 | core_pic_infix := -pic |
| 229 | endif |
| 230 | ifeq ($(2),no-pic) |
| 231 | # No change for non-pic |
| 232 | endif |
| 233 | ifneq ($(filter-out pic no-pic,$(2)),) |
| 234 | #Technically this test is not precise, but hopefully good enough. |
| 235 | $$(error found $(2) expected pic or no-pic) |
| 236 | endif |
| 237 | |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 238 | core_image_name := $($(3)TARGET_CORE_IMG_OUT_BASE)$$(core_infix)$$(core_pic_infix)$(4)$(CORE_IMG_SUFFIX) |
| 239 | core_oat_name := $($(3)TARGET_CORE_OAT_OUT_BASE)$$(core_infix)$$(core_pic_infix)$(4)$(CORE_OAT_SUFFIX) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 240 | |
| 241 | # 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] | 242 | ifeq ($(3),) |
| 243 | ifdef TARGET_2ND_ARCH |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 244 | $(4)TARGET_CORE_IMAGE_$(1)_$(2)_64 := $$(core_image_name) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 245 | else |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 246 | $(4)TARGET_CORE_IMAGE_$(1)_$(2)_32 := $$(core_image_name) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 247 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 248 | else |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 249 | $(4)TARGET_CORE_IMAGE_$(1)_$(2)_32 := $$(core_image_name) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 250 | endif |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 251 | $(4)TARGET_CORE_IMG_OUTS += $$(core_image_name) |
| 252 | $(4)TARGET_CORE_OAT_OUTS += $$(core_oat_name) |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 253 | |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 254 | # If we have a wrapper, make the target phony. |
| 255 | ifneq ($(4),) |
| 256 | .PHONY: $$(core_image_name) |
| 257 | endif |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 258 | $$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options) |
| 259 | $$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name) |
| 260 | $$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name) |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 261 | $$(core_image_name): $$(TARGET_CORE_DEX_FILES) $$(core_dex2oat_dependency) |
Shinichiro Hamaji | c5d2905 | 2015-12-18 15:51:51 +0900 | [diff] [blame] | 262 | @echo "target dex2oat: $$@" |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 263 | @mkdir -p $$(dir $$@) |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 264 | $$(hide) $(4) $$(DEX2OAT)$(5) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \ |
| 265 | --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 266 | --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(TARGET_CORE_DEX_FILES)) \ |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 267 | $$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \ |
| 268 | --oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \ |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 269 | --base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) --instruction-set=$$($(3)TARGET_ARCH) \ |
Douglas Leung | 3d12ead | 2015-03-18 11:29:14 -0700 | [diff] [blame] | 270 | --instruction-set-variant=$$($(3)DEX2OAT_TARGET_CPU_VARIANT) \ |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 271 | --instruction-set-features=$$($(3)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ |
David Srbecky | 461d72a | 2015-06-11 01:27:56 +0100 | [diff] [blame] | 272 | --android-root=$$(PRODUCT_OUT)/system --include-patch-information --generate-debug-info \ |
Nicolas Geoffray | 130bd1b | 2014-11-03 16:23:48 +0000 | [diff] [blame] | 273 | $$(PRIVATE_CORE_COMPILE_OPTIONS) || (rm $$(PRIVATE_CORE_OAT_NAME); exit 1) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 274 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 275 | $$(core_oat_name): $$(core_image_name) |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 276 | |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 277 | # Clean up locally used variables. |
Nicolas Geoffray | a136ab5 | 2014-10-31 10:48:25 +0000 | [diff] [blame] | 278 | core_dex2oat_dependency := |
Andreas Gampe | 63fc30e | 2014-10-24 21:58:16 -0700 | [diff] [blame] | 279 | core_compile_options := |
| 280 | core_image_name := |
| 281 | core_oat_name := |
| 282 | core_infix := |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 283 | core_pic_infix := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 284 | endef # create-core-oat-target-rules |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 285 | |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 286 | # $(1): compiler - default, optimizing, jit, interpreter or interpreter-access-checks. |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 287 | # $(2): wrapper. |
| 288 | # $(3): dex2oat suffix. |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 289 | define create-core-oat-target-rule-combination |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 290 | $(call create-core-oat-target-rules,$(1),no-pic,,$(2),$(3)) |
| 291 | $(call create-core-oat-target-rules,$(1),pic,,$(2),$(3)) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 292 | |
| 293 | ifdef TARGET_2ND_ARCH |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 294 | $(call create-core-oat-target-rules,$(1),no-pic,2ND_,$(2),$(3)) |
| 295 | $(call create-core-oat-target-rules,$(1),pic,2ND_,$(2),$(3)) |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 296 | endif |
| 297 | endef |
| 298 | |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 299 | $(eval $(call create-core-oat-target-rule-combination,default,,)) |
| 300 | $(eval $(call create-core-oat-target-rule-combination,optimizing,,)) |
| 301 | $(eval $(call create-core-oat-target-rule-combination,interpreter,,)) |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 302 | $(eval $(call create-core-oat-target-rule-combination,interp-ac,,)) |
Andreas Gampe | 8a159fd | 2015-09-21 15:14:38 -0700 | [diff] [blame] | 303 | $(eval $(call create-core-oat-target-rule-combination,jit,,)) |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 304 | |
| 305 | valgrindTARGET_CORE_IMG_OUTS := |
| 306 | valgrindTARGET_CORE_OAT_OUTS := |
| 307 | $(eval $(call create-core-oat-target-rule-combination,default,valgrind,32)) |
| 308 | $(eval $(call create-core-oat-target-rule-combination,optimizing,valgrind,32)) |
| 309 | $(eval $(call create-core-oat-target-rule-combination,interpreter,valgrind,32)) |
Andreas Gampe | 825570c | 2015-07-26 10:26:03 -0700 | [diff] [blame] | 310 | $(eval $(call create-core-oat-target-rule-combination,interp-ac,valgrind,32)) |
Andreas Gampe | 8a159fd | 2015-09-21 15:14:38 -0700 | [diff] [blame] | 311 | $(eval $(call create-core-oat-target-rule-combination,jit,valgrind,32)) |
Andreas Gampe | 088b16e | 2014-12-03 21:59:27 -0800 | [diff] [blame] | 312 | |
| 313 | valgrind-test-art-host-dex2oat-target: $(valgrindTARGET_CORE_IMG_OUTS) |
| 314 | |
| 315 | valgrind-test-art-host-dex2oat: valgrind-test-art-host-dex2oat-host valgrind-test-art-host-dex2oat-target |