blob: 823ef7df530584a614e573c96013029430e53dd2 [file] [log] [blame]
Brian Carlstrom16192862011-09-12 17:50:06 -07001#
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 Carlstrom27ec9612011-09-19 20:20:38 -070017########################################################################
Brian Carlstrom7ab763c2013-12-09 00:38:02 -080018# 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 Carlstrom16192862011-09-12 17:50:06 -070023
Nicolas Geoffray611e1db2014-10-09 17:34:45 +010024include art/build/Android.common_build.mk
Dave Allison70202782013-10-22 17:52:19 -070025
Nicolas Geoffray1db132d2014-03-26 10:56:24 +000026# Use dex2oat debug version for better error reporting
Andreas Gampe63fc30e2014-10-24 21:58:16 -070027# $(1): compiler
28# $(2): 2ND_ or undefined, 2ND_ for 32-bit host builds.
Alex Light1ef4ce82014-08-27 11:13:47 -070029# 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 Rogersafd9acc2014-06-17 08:21:54 -070031define create-core-oat-host-rules
Andreas Gampe63fc30e2014-10-24 21:58:16 -070032 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 Rogersafd9acc2014-06-17 08:21:54 -070068 @echo "host dex2oat: $$@ ($$?)"
69 @mkdir -p $$(dir $$@)
Andreas Gampe63fc30e2014-10-24 21:58:16 -070070 $$(hide) $$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
Ian Rogersafd9acc2014-06-17 08:21:54 -070071 --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(HOST_CORE_DEX_FILES)) \
Andreas Gampe63fc30e2014-10-24 21:58:16 -070072 $$(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 Carlstrom27ec9612011-09-19 20:20:38 -070078
Andreas Gampe63fc30e2014-10-24 21:58:16 -070079$$(core_oat_name): $$(core_image_name)
Ian Rogersafd9acc2014-06-17 08:21:54 -070080
Andreas Gampe63fc30e2014-10-24 21:58:16 -070081 # Clean up locally used variables.
82 core_compile_options :=
83 core_image_name :=
84 core_oat_name :=
85 core_infix :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070086endef # create-core-oat-host-rules
87
Andreas Gampe63fc30e2014-10-24 21:58:16 -070088$(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 Rogersafd9acc2014-06-17 08:21:54 -070091ifneq ($(HOST_PREFER_32_BIT),true)
Andreas Gampe63fc30e2014-10-24 21:58:16 -070092$(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 Rogersafd9acc2014-06-17 08:21:54 -070095endif
Brian Carlstrom2b7cdf42011-10-13 11:18:28 -070096
Ian Rogersafd9acc2014-06-17 08:21:54 -070097define create-core-oat-target-rules
Andreas Gampe63fc30e2014-10-24 21:58:16 -070098 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 Gampeafbaa1a2014-03-25 18:09:32 -0700134 @echo "target dex2oat: $$@ ($$?)"
135 @mkdir -p $$(dir $$@)
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700136 $$(hide) $$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700137 --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(TARGET_CORE_DEX_FILES)) \
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700138 $$(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 Gampeafbaa1a2014-03-25 18:09:32 -0700144
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700145$$(core_oat_name): $$(core_image_name)
Andreas Gampe2fe07922014-04-21 07:50:39 -0700146
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700147 # Clean up locally used variables.
148 core_compile_options :=
149 core_image_name :=
150 core_oat_name :=
151 core_infix :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700152endef # create-core-oat-target-rules
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700153
154ifdef TARGET_2ND_ARCH
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700155$(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 Gampeafbaa1a2014-03-25 18:09:32 -0700158endif
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700159$(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,))