blob: aa167b266ab880b7c5b9cf8d24a2af5f602b868b [file] [log] [blame]
Carl Shapiro7b216702011-06-17 15:09:26 -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
Dragos Sbirlea37c19bc2013-07-29 09:38:31 -070017ifndef ANDROID_COMMON_MK
18ANDROID_COMMON_MK = true
19
Stuart Monteithb95a5342014-03-12 13:32:32 +000020ART_SUPPORTED_ARCH := arm arm64 mips x86 x86_64
Colin Crossdc781a12014-02-04 16:22:03 -080021
22ifeq (,$(filter $(TARGET_ARCH),$(ART_SUPPORTED_ARCH)))
23$(warning unsupported TARGET_ARCH=$(TARGET_ARCH))
24endif
25
Brian Carlstrom7940e442013-07-12 13:46:57 -070026# These can be overridden via the environment or by editing to
27# enable/disable certain build configuration.
28#
29# For example, to disable everything but the host debug build you use:
30#
31# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...)
32#
33# Beware that tests may use the non-debug build for performance, notable 055-enum-performance
34#
35ART_BUILD_TARGET_NDEBUG ?= true
36ART_BUILD_TARGET_DEBUG ?= true
Brian Carlstrom19e776c2013-07-23 12:16:44 -070037ART_BUILD_HOST_NDEBUG ?= $(WITH_HOST_DALVIK)
38ART_BUILD_HOST_DEBUG ?= $(WITH_HOST_DALVIK)
Brian Carlstrom7940e442013-07-12 13:46:57 -070039
Ying Wangc6585b72014-04-23 18:19:44 -070040ART_HOST_ARCH := $(HOST_ARCH)
Andreas Gampe922141a2014-03-12 10:59:26 -070041
Brian Carlstrom7940e442013-07-12 13:46:57 -070042ifeq ($(ART_BUILD_TARGET_NDEBUG),false)
43$(info Disabling ART_BUILD_TARGET_NDEBUG)
44endif
45ifeq ($(ART_BUILD_TARGET_DEBUG),false)
46$(info Disabling ART_BUILD_TARGET_DEBUG)
47endif
48ifeq ($(ART_BUILD_HOST_NDEBUG),false)
49$(info Disabling ART_BUILD_HOST_NDEBUG)
50endif
51ifeq ($(ART_BUILD_HOST_DEBUG),false)
52$(info Disabling ART_BUILD_HOST_DEBUG)
53endif
54
55#
56# Used to enable smart mode
57#
Anwar Ghuloum8447d842013-04-30 17:27:40 -070058ART_SMALL_MODE := false
59ifneq ($(wildcard art/SMALL_ART),)
60$(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART)
61ART_SMALL_MODE := true
Ian Rogersf3e98552013-03-20 15:49:49 -070062endif
Anwar Ghulouma72dd8b2013-06-03 17:01:15 -070063ifeq ($(WITH_ART_SMALL_MODE), true)
64ART_SMALL_MODE := true
65endif
Ian Rogersf3e98552013-03-20 15:49:49 -070066
Brian Carlstrom7940e442013-07-12 13:46:57 -070067#
68# Used to enable SEA mode
69#
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070070ART_SEA_IR_MODE := false
71ifneq ($(wildcard art/SEA_IR_ART),)
72$(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART)
73ART_SEA_IR_MODE := true
74endif
75ifeq ($(WITH_ART_SEA_IR_MODE), true)
76ART_SEA_IR_MODE := true
77endif
78
Brian Carlstrom7940e442013-07-12 13:46:57 -070079#
80# Used to enable portable mode
81#
Brian Carlstrom06809ed2012-09-17 14:19:20 -070082ART_USE_PORTABLE_COMPILER := false
83ifneq ($(wildcard art/USE_PORTABLE_COMPILER),)
84$(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER)
85ART_USE_PORTABLE_COMPILER := true
86endif
87ifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true)
88$(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true)
89ART_USE_PORTABLE_COMPILER := true
90endif
Shih-wei Liaod1fec812012-02-13 09:51:10 -080091
Nicolas Geoffrayb34f69a2014-03-07 15:28:39 +000092#
93# Used to enable optimizing compiler
94#
95ART_USE_OPTIMIZING_COMPILER := false
96ifneq ($(wildcard art/USE_OPTIMIZING_COMPILER),)
97$(info Enabling ART_USE_OPTIMIZING_COMPILER because of existence of art/USE_OPTIMIZING_COMPILER)
98ART_USE_OPTIMIZING_COMPILER := true
99endif
100ifeq ($(WITH_ART_USE_OPTIMIZING_COMPILER), true)
101ART_USE_OPTIMIZING_COMPILER := true
102endif
103
104ifeq ($(ART_USE_OPTIMIZING_COMPILER),true)
105DEX2OAT_FLAGS := --compiler-backend=Optimizing
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700106DALVIKVM_FLAGS += -Xcompiler-option --compiler-backend=Optimizing
Nicolas Geoffrayb34f69a2014-03-07 15:28:39 +0000107endif
108
Hiroshi Yamauchi1dda0602014-05-12 12:32:32 -0700109#
110# Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS.
111#
112ART_DEFAULT_GC_TYPE ?= CMS
113ART_DEFAULT_GC_TYPE_CFLAGS := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE)
114
Ian Rogers28f5c092014-05-15 09:03:20 -0700115ifeq ($(ART_USE_PORTABLE_COMPILER),true)
116 LLVM_ROOT_PATH := external/llvm
117 # Don't fail a dalvik minimal host build.
118 -include $(LLVM_ROOT_PATH)/llvm.mk
119endif
Shih-wei Liaod1fec812012-02-13 09:51:10 -0800120
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700121# Clang build support.
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700122
123# Host.
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700124ART_HOST_CLANG := false
Ying Wangd858c962014-03-10 18:27:10 -0700125ifneq ($(WITHOUT_HOST_CLANG),true)
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700126 # By default, host builds use clang for better warnings.
Ian Rogers35df1f32014-03-08 23:48:23 -0800127 ART_HOST_CLANG := true
Ian Rogers35df1f32014-03-08 23:48:23 -0800128endif
Ian Rogerscd5d0422013-05-17 15:54:01 -0700129
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700130# Clang on the target: only enabled for ARM64. Target builds use GCC by default.
131ART_TARGET_CLANG :=
132ART_TARGET_CLANG_arm :=
133ART_TARGET_CLANG_arm64 := true
134ART_TARGET_CLANG_mips :=
135ART_TARGET_CLANG_x86 :=
136ART_TARGET_CLANG_x86_64 :=
137
138define set-target-local-clang-vars
139 LOCAL_CLANG := $(ART_TARGET_CLANG)
140 $(foreach arch,$(ART_SUPPORTED_ARCH),
141 ifneq ($$(ART_TARGET_CLANG_$(arch)),)
142 LOCAL_CLANG_$(arch) := $$(ART_TARGET_CLANG_$(arch))
143 endif)
144endef
Tim Murraya7e7c2a2014-04-30 14:09:31 -0700145
Brian Carlstromb32a3ad2014-01-20 14:48:07 -0800146# directory used for dalvik-cache on device
147ART_DALVIK_CACHE_DIR := /data/dalvik-cache
148
Brian Carlstrom32b4b2a2012-01-31 16:21:40 -0800149# directory used for gtests on device
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700150ART_NATIVETEST_DIR := /data/nativetest/art
151ART_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art
Brian Carlstrom32b4b2a2012-01-31 16:21:40 -0800152
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700153# directory used for oat tests on device
154ART_TEST_DIR := /data/art-test
155ART_TEST_OUT := $(TARGET_OUT_DATA)/art-test
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700156
157# Primary vs. secondary
1582ND_TARGET_ARCH := $(TARGET_2ND_ARCH)
159ART_PHONY_TEST_TARGET_SUFFIX :=
1602ND_ART_PHONY_TEST_TARGET_SUFFIX :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700161ifdef TARGET_2ND_ARCH
162 art_test_primary_suffix :=
163 art_test_secondary_suffix :=
164 ifneq ($(filter %64,$(TARGET_ARCH)),)
165 art_test_primary_suffix := 64
166 ART_PHONY_TEST_TARGET_SUFFIX := 64
167 2ND_ART_PHONY_TEST_TARGET_SUFFIX := 32
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700168 ART_TARGET_ARCH_32 := $(TARGET_2ND_ARCH)
169 ART_TARGET_ARCH_64 := $(TARGET_ARCH)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700170 else
171 # TODO: ???
172 $(error Do not know what to do with this multi-target configuration!)
173 endif
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700174else
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700175 ART_TARGET_ARCH_32 := $(TARGET_ARCH)
176 ART_TARGET_ARCH_64 :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700177endif
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700178
Brian Carlstromcdc8de42011-07-19 14:23:17 -0700179ART_CPP_EXTENSION := .cc
Carl Shapiro9bf84fd2011-06-17 17:05:25 -0700180
Brian Carlstrom7940e442013-07-12 13:46:57 -0700181ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX)
182ART_HOST_SHLIB_EXTENSION ?= .so
183
Elliott Hughes0af55432011-08-17 18:37:28 -0700184ART_C_INCLUDES := \
185 external/gtest/include \
Ian Rogers1d54e732013-05-02 21:10:01 -0700186 external/valgrind/main/include \
Mathieu Chartier75165d02013-09-12 14:00:31 -0700187 external/valgrind/main \
Serban Constantinescued8dd492014-02-11 14:15:10 +0000188 external/vixl/src \
buzbeec143c552011-08-20 17:38:58 -0700189 external/zlib \
Brian Carlstrom7940e442013-07-12 13:46:57 -0700190 frameworks/compile/mclinker/include
Brian Carlstromb0460ea2011-07-29 10:08:05 -0700191
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700192art_cflags := \
Ian Rogers637c65b2013-05-31 11:46:00 -0700193 -fno-rtti \
Mathieu Chartier9b3c3cd2013-08-12 17:41:54 -0700194 -std=gnu++11 \
Carl Shapiro1fb86202011-06-27 17:43:13 -0700195 -ggdb3 \
196 -Wall \
197 -Werror \
198 -Wextra \
Nicolas Geoffrayf3e2cc42014-02-18 18:37:26 +0000199 -Wno-sign-promo \
200 -Wno-unused-parameter \
Mark Mendell3f2d0312014-01-20 17:20:27 -0800201 -Wstrict-aliasing \
Tim Murraya7e7c2a2014-04-30 14:09:31 -0700202 -fstrict-aliasing
203
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700204ART_TARGET_CLANG_CFLAGS :=
205ART_TARGET_CLANG_CFLAGS_arm :=
206ART_TARGET_CLANG_CFLAGS_arm64 :=
207ART_TARGET_CLANG_CFLAGS_mips :=
208ART_TARGET_CLANG_CFLAGS_x86 :=
209ART_TARGET_CLANG_CFLAGS_x86_64 :=
210
Tim Murraya7e7c2a2014-04-30 14:09:31 -0700211# these are necessary for Clang ARM64 ART builds
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700212ART_TARGET_CLANG_CFLAGS_arm64 += \
Tim Murray4a0047a2014-04-30 13:40:58 -0700213 -Wno-implicit-exception-spec-mismatch \
214 -DNVALGRIND \
215 -Wno-unused-value
Carl Shapiro1fb86202011-06-27 17:43:13 -0700216
Anwar Ghuloumc44f68f2013-05-10 13:24:54 -0700217ifeq ($(ART_SMALL_MODE),true)
218 art_cflags += -DART_SMALL_MODE=1
Ian Rogersf3e98552013-03-20 15:49:49 -0700219endif
220
Dragos Sbirlea7467ee02013-06-21 09:20:34 -0700221ifeq ($(ART_SEA_IR_MODE),true)
222 art_cflags += -DART_SEA_IR_MODE=1
223endif
224
Ian Rogers8d11af52013-08-15 14:24:29 -0700225art_non_debug_cflags := \
Tim Murray4a0047a2014-04-30 13:40:58 -0700226 -O3
227
Sebastien Hertz278ff9e2014-05-27 15:27:58 +0200228ifeq ($(HOST_OS),linux)
229 art_non_debug_cflags += \
230 -Wframe-larger-than=1728
231endif
232
Tim Murray4a0047a2014-04-30 13:40:58 -0700233# FIXME: upstream LLVM has a vectorizer bug that needs to be fixed
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700234ART_TARGET_CLANG_CFLAGS_arm64 += \
235 -fno-vectorize
Ian Rogers8d11af52013-08-15 14:24:29 -0700236
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700237art_debug_cflags := \
Ian Rogers8d11af52013-08-15 14:24:29 -0700238 -O1 \
Elliott Hughes06e3ad42012-02-07 14:51:57 -0800239 -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700240 -UNDEBUG
241
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700242ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
Brian Carlstrom1bd2ceb2013-11-06 00:29:48 -0800243ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default
Hiroshi Yamauchi1dda0602014-05-12 12:32:32 -0700244ART_HOST_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700245
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800246ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700247ifeq ($(TARGET_CPU_SMP),true)
248 ART_TARGET_CFLAGS += -DANDROID_SMP=1
249else
Andreas Gampeb14329f2014-05-15 11:16:06 -0700250 ifeq ($(TARGET_CPU_SMP),false)
251 ART_TARGET_CFLAGS += -DANDROID_SMP=0
252 else
Andreas Gampeef5113d2014-05-15 13:54:25 -0700253 $(warning TARGET_CPU_SMP should be (true|false), found $(TARGET_CPU_SMP))
254 # Make sure we emit barriers for the worst case.
255 ART_TARGET_CFLAGS += -DANDROID_SMP=1
Andreas Gampeb14329f2014-05-15 11:16:06 -0700256 endif
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700257endif
Hiroshi Yamauchi1dda0602014-05-12 12:32:32 -0700258ART_TARGET_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700259
Brian Carlstrom1bd2ceb2013-11-06 00:29:48 -0800260# DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is set in ../build/core/dex_preopt.mk based on
261# the TARGET_CPU_VARIANT
262ifeq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
263$(error Required DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is not set)
264endif
265ART_TARGET_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
266
Ian Rogers719d1a32014-03-06 12:13:39 -0800267# Enable thread-safety for GCC 4.6, and clang, but not for GCC 4.7 or later where this feature was
268# removed. Warn when -Wthread-safety is not used.
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700269ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),)
270 ART_TARGET_CFLAGS += -Wthread-safety
271else
Tim Murray4a0047a2014-04-30 13:40:58 -0700272 # FIXME: add -Wthread-safety when the problem is fixed
Ian Rogers719d1a32014-03-06 12:13:39 -0800273 ifeq ($(ART_TARGET_CLANG),true)
Tim Murray4a0047a2014-04-30 13:40:58 -0700274 ART_TARGET_CFLAGS +=
Ian Rogers719d1a32014-03-06 12:13:39 -0800275 else
276 # Warn if -Wthread-safety is not suport and not doing a top-level or 'mma' build.
277 ifneq ($(ONE_SHOT_MAKEFILE),)
278 # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6
279 $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.)
280 endif
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700281 endif
282endif
Ian Rogers719d1a32014-03-06 12:13:39 -0800283# We compile with GCC 4.6 or clang on the host, both of which support -Wthread-safety.
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700284ART_HOST_CFLAGS += -Wthread-safety
285
Brian Carlstrom89521892011-12-07 22:05:07 -0800286# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
287# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
288
Ian Rogersa9844542014-04-21 17:01:02 -0700289# Addition CPU specific CFLAGS.
290ifeq ($(TARGET_ARCH),arm)
291 ifneq ($(filter cortex-a15, $(TARGET_CPU_VARIANT)),)
292 # Fake a ARM feature for LPAE support.
293 ART_TARGET_CFLAGS += -D__ARM_FEATURE_LPAE=1
294 endif
295endif
296
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700297ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
298ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
299
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700300# TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4 (and -lsupc++)
Elliott Hughes1ba27142012-01-20 15:32:00 -0800301ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700302ART_HOST_DEBUG_LDLIBS := -lsupc++
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800303
304ifneq ($(HOST_OS),linux)
305 # Some Mac OS pthread header files are broken with -fkeep-inline-functions.
Elliott Hughes34cf5142012-01-20 16:39:13 -0800306 ART_HOST_DEBUG_CFLAGS := $(filter-out -fkeep-inline-functions,$(ART_HOST_DEBUG_CFLAGS))
Elliott Hughes60234562012-06-01 12:25:59 -0700307 # Mac OS doesn't have libsupc++.
308 ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS))
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800309endif
310
Brian Carlstrom86927212011-09-15 11:31:11 -0700311ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700312
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700313# $(1): ndebug_or_debug
314define set-target-local-cflags-vars
315 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
316 LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86)
317 art_target_cflags_ndebug_or_debug := $(1)
318 ifeq ($$(art_target_cflags_ndebug_or_debug),debug)
319 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
320 else
321 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
322 endif
323
324 # TODO: Also set when ART_TARGET_CLANG_$(arch)!=false and ART_TARGET_CLANG==true
325 $(foreach arch,$(ART_SUPPORTED_ARCH),
326 ifeq ($$(ART_TARGET_CLANG_$(arch)),true)
327 LOCAL_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch))
328 endif)
329endef
330
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700331ART_BUILD_TARGET := false
332ART_BUILD_HOST := false
Brian Carlstrom265091e2013-01-30 14:08:26 -0800333ART_BUILD_NDEBUG := false
334ART_BUILD_DEBUG := false
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700335ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
336 ART_BUILD_TARGET := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800337 ART_BUILD_NDEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700338endif
339ifeq ($(ART_BUILD_TARGET_DEBUG),true)
340 ART_BUILD_TARGET := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800341 ART_BUILD_DEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700342endif
343ifeq ($(ART_BUILD_HOST_NDEBUG),true)
344 ART_BUILD_HOST := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800345 ART_BUILD_NDEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700346endif
347ifeq ($(ART_BUILD_HOST_DEBUG),true)
348 ART_BUILD_HOST := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800349 ART_BUILD_DEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700350endif
Dragos Sbirlea37c19bc2013-07-29 09:38:31 -0700351
Andreas Gampe2fe07922014-04-21 07:50:39 -0700352# Helper function to call a function twice with a target suffix
353# $(1): The generator function for the rules
354# Has one argument, the suffix
355define call-art-multi-target
356 $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700357
Andreas Gampe2fe07922014-04-21 07:50:39 -0700358 ifdef TARGET_2ND_ARCH
359 $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
360 endif
361endef
362
363# Helper function to combine two variables with suffixes together.
364# $(1): The base name.
365define combine-art-multi-target-var
366 ifdef TARGET_2ND_ARCH
367 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
368 ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),)
369$(1) := $($(1)$(ART_PHONY_TEST_TARGET_SUFFIX)) $($(1)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
370 endif
371 endif
372 endif
373endef
374
375
376# Helper function to define a variable twice with a target suffix. Assume the name generated is
377# derived from $(2) so we can create a combined var.
378# $(1): The generator function for the rules
379# Has one argument, the suffix
380define call-art-multi-target-var
381 $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700382
Andreas Gampe2fe07922014-04-21 07:50:39 -0700383 ifdef TARGET_2ND_ARCH
384 $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700385
Andreas Gampe2fe07922014-04-21 07:50:39 -0700386 # Link both together, if it makes sense
387 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
388 ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),)
389$(2) := $(2)$(ART_PHONY_TEST_TARGET_SUFFIX) $(2)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
390 endif
391 endif
392
393 endif
394endef
395
396# Helper function to call a function twice with a target suffix. Assume it generates make rules
397# with the given name, and link them.
398# $(1): The generator function for the rules
399# Has one argument, the suffix
400# $(2): The base rule name, necessary for the link
401# We assume we can link the names together easily...
402define call-art-multi-target-rule
403 $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700404
Andreas Gampe2fe07922014-04-21 07:50:39 -0700405 ifdef TARGET_2ND_ARCH
406 $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700407
Andreas Gampe2fe07922014-04-21 07:50:39 -0700408 # Link both together, if it makes sense
409 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
410 ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),)
411.PHONY: $(2)
412$(2): $(2)$(ART_PHONY_TEST_TARGET_SUFFIX) $(2)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
413 endif
414 endif
415 endif
416endef
417
Brian Carlstromf662e062014-05-19 16:09:42 -0700418HOST_CORE_OAT := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core.oat
419TARGET_CORE_OAT := $(ART_TEST_DIR)/$(DEX2OAT_TARGET_ARCH)/core.oat
420ifdef TARGET_2ND_ARCH
4212ND_TARGET_CORE_OAT := $(2ND_ART_TEST_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.oat
422endif
423
424HOST_CORE_OAT_OUT := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core.oat
425TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/$(DEX2OAT_TARGET_ARCH)/core.oat
426ifdef TARGET_2ND_ARCH
4272ND_TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.oat
428endif
429
430HOST_CORE_IMG_OUT := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core.art
431TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/$(DEX2OAT_TARGET_ARCH)/core.art
432ifdef TARGET_2ND_ARCH
4332ND_TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.art
434endif
435
436HOST_CORE_IMG_LOCATION := $(HOST_OUT_JAVA_LIBRARIES)/core.art
Brian Carlstrom0f5baa02014-05-22 11:54:18 -0700437TARGET_CORE_IMG_LOCATION := $(ART_TEST_OUT)/core.art
Andreas Gampe2fe07922014-04-21 07:50:39 -0700438
Dragos Sbirlea37c19bc2013-07-29 09:38:31 -0700439endif # ANDROID_COMMON_MK