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