blob: dc5385309ac366dec6677b4321af7002af1d694e [file] [log] [blame]
Ian Rogersafd9acc2014-06-17 08:21:54 -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
Igor Murashkin37743352014-11-13 14:38:00 -080017ifndef ART_ANDROID_COMMON_BUILD_MK
18ART_ANDROID_COMMON_BUILD_MK = true
Ian Rogersafd9acc2014-06-17 08:21:54 -070019
20include art/build/Android.common.mk
Igor Murashkin37743352014-11-13 14:38:00 -080021include art/build/Android.common_utils.mk
Ian Rogersafd9acc2014-06-17 08:21:54 -070022
23# These can be overridden via the environment or by editing to
24# enable/disable certain build configuration.
25#
26# For example, to disable everything but the host debug build you use:
27#
28# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...)
29#
30# Beware that tests may use the non-debug build for performance, notable 055-enum-performance
31#
32ART_BUILD_TARGET_NDEBUG ?= true
33ART_BUILD_TARGET_DEBUG ?= true
34ART_BUILD_HOST_NDEBUG ?= true
35ART_BUILD_HOST_DEBUG ?= true
Calin Juravle676ff8e2015-07-24 16:45:26 +010036
Alex Light8069d9f2015-10-14 16:21:17 -070037# Set this to change what opt level Art is built at.
38ART_DEBUG_OPT_FLAG ?= -O2
39ART_NDEBUG_OPT_FLAG ?= -O3
40
Calin Juravle676ff8e2015-07-24 16:45:26 +010041# Enable the static builds only for checkbuilds.
42ifneq (,$(filter checkbuild,$(MAKECMDGOALS)))
43 ART_BUILD_HOST_STATIC ?= true
44else
45 ART_BUILD_HOST_STATIC ?= false
46endif
Ian Rogersafd9acc2014-06-17 08:21:54 -070047
Calin Juravle4895ea42015-07-02 18:21:14 +010048# Asan does not support static linkage
49ifdef SANITIZE_HOST
50 ART_BUILD_HOST_STATIC := false
51endif
52
Calin Juravle0e26f462015-07-09 15:48:03 +010053ifneq ($(HOST_OS),linux)
Calin Juravle4895ea42015-07-02 18:21:14 +010054 ART_BUILD_HOST_STATIC := false
55endif
56
Ian Rogersafd9acc2014-06-17 08:21:54 -070057ifeq ($(ART_BUILD_TARGET_NDEBUG),false)
58$(info Disabling ART_BUILD_TARGET_NDEBUG)
59endif
60ifeq ($(ART_BUILD_TARGET_DEBUG),false)
61$(info Disabling ART_BUILD_TARGET_DEBUG)
62endif
63ifeq ($(ART_BUILD_HOST_NDEBUG),false)
64$(info Disabling ART_BUILD_HOST_NDEBUG)
65endif
66ifeq ($(ART_BUILD_HOST_DEBUG),false)
67$(info Disabling ART_BUILD_HOST_DEBUG)
68endif
Calin Juravle65e069d2015-06-08 10:35:24 +010069ifeq ($(ART_BUILD_HOST_STATIC),true)
70$(info Enabling ART_BUILD_HOST_STATIC)
71endif
Ian Rogersafd9acc2014-06-17 08:21:54 -070072
Hiroshi Yamauchi093f1b42015-07-14 12:20:30 -070073ifeq ($(ART_TEST_DEBUG_GC),true)
74 ART_DEFAULT_GC_TYPE := SS
75 ART_USE_TLAB := true
76endif
77
Ian Rogersafd9acc2014-06-17 08:21:54 -070078#
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080079# Used to enable JIT
80#
81ART_JIT := false
82ifneq ($(wildcard art/JIT_ART),)
83$(info Enabling ART_JIT because of existence of art/JIT_ART)
84ART_JIT := true
85endif
86ifeq ($(WITH_ART_JIT), true)
87ART_JIT := true
88endif
89
90#
Ian Rogersafd9acc2014-06-17 08:21:54 -070091# Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS.
92#
Hiroshi Yamauchi3e781622015-02-25 12:52:34 -080093ART_DEFAULT_GC_TYPE ?= CMS
94art_default_gc_type_cflags := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE)
Ian Rogersafd9acc2014-06-17 08:21:54 -070095
Andreas Gampeee0ebc82014-10-21 21:07:28 -070096ART_HOST_CFLAGS :=
97ART_TARGET_CFLAGS :=
98
Roland Levillain12bd7212015-06-04 17:50:27 +010099ART_HOST_ASFLAGS :=
100ART_TARGET_ASFLAGS :=
101
Ian Rogersafd9acc2014-06-17 08:21:54 -0700102# Clang build support.
103
104# Host.
105ART_HOST_CLANG := false
106ifneq ($(WITHOUT_HOST_CLANG),true)
107 # By default, host builds use clang for better warnings.
108 ART_HOST_CLANG := true
109endif
110
Sebastien Hertzea521dc2014-06-25 18:50:01 +0200111# Clang on the target. Target builds use GCC by default.
Bernhard Rosenkraenzer88c05692014-10-04 19:02:06 +0200112ifneq ($(USE_CLANG_PLATFORM_BUILD),)
113ART_TARGET_CLANG := $(USE_CLANG_PLATFORM_BUILD)
114else
Ian Rogersd642a912014-10-02 09:41:44 -0700115ART_TARGET_CLANG := false
Bernhard Rosenkraenzer88c05692014-10-04 19:02:06 +0200116endif
Andreas Gampe5295bc22015-10-20 22:10:26 -0700117# b/25130937
118ART_TARGET_CLANG_arm := false
Sebastien Hertzea521dc2014-06-25 18:50:01 +0200119ART_TARGET_CLANG_arm64 :=
Duane Sand91ddd0d2015-05-01 11:34:51 -0700120ART_TARGET_CLANG_mips :=
Lazar Trsic610a1422015-11-27 14:33:06 +0100121# b/25928358, illegal instruction on mips64r6 with -O0
122ART_TARGET_CLANG_mips64 := false
Ian Rogersafd9acc2014-06-17 08:21:54 -0700123ART_TARGET_CLANG_x86 :=
124ART_TARGET_CLANG_x86_64 :=
125
126define set-target-local-clang-vars
127 LOCAL_CLANG := $(ART_TARGET_CLANG)
128 $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
129 ifneq ($$(ART_TARGET_CLANG_$(arch)),)
130 LOCAL_CLANG_$(arch) := $$(ART_TARGET_CLANG_$(arch))
131 endif)
132endef
133
Ian Rogersafd9acc2014-06-17 08:21:54 -0700134ART_TARGET_CLANG_CFLAGS :=
135ART_TARGET_CLANG_CFLAGS_arm :=
136ART_TARGET_CLANG_CFLAGS_arm64 :=
137ART_TARGET_CLANG_CFLAGS_mips :=
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800138ART_TARGET_CLANG_CFLAGS_mips64 :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700139ART_TARGET_CLANG_CFLAGS_x86 :=
140ART_TARGET_CLANG_CFLAGS_x86_64 :=
141
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700142# Warn about thread safety violations with clang.
Mathieu Chartier90443472015-07-16 20:32:27 -0700143art_clang_cflags := -Wthread-safety -Wthread-safety-negative
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700144
145# Warn if switch fallthroughs aren't annotated.
146art_clang_cflags += -Wimplicit-fallthrough
147
148# Enable float equality warnings.
149art_clang_cflags += -Wfloat-equal
150
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800151# Enable warning of converting ints to void*.
152art_clang_cflags += -Wint-to-void-pointer-cast
153
Andreas Gampeca714582015-04-03 19:41:34 -0700154# Enable warning of wrong unused annotations.
155art_clang_cflags += -Wused-but-marked-unused
156
Andreas Gampe758a8012015-04-03 21:28:42 -0700157# Enable warning for deprecated language features.
158art_clang_cflags += -Wdeprecated
159
Andreas Gampe66222662015-04-06 19:50:46 -0700160# Enable warning for unreachable break & return.
161art_clang_cflags += -Wunreachable-code-break -Wunreachable-code-return
162
163# Enable missing-noreturn only on non-Mac. As lots of things are not implemented for Apple, it's
164# a pain.
165ifneq ($(HOST_OS),darwin)
166 art_clang_cflags += -Wmissing-noreturn
167endif
Andreas Gampe65b798e2015-04-06 09:35:22 -0700168
Andreas Gampeca714582015-04-03 19:41:34 -0700169
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800170# GCC-only warnings.
171art_gcc_cflags := -Wunused-but-set-parameter
172# Suggest const: too many false positives, but good for a trial run.
173# -Wsuggest-attribute=const
174# Useless casts: too many, as we need to be 32/64 agnostic, but the compiler knows.
175# -Wuseless-cast
176# Zero-as-null: Have to convert all NULL and "diagnostic ignore" all includes like libnativehelper
177# that are still stuck pre-C++11.
178# -Wzero-as-null-pointer-constant \
179# Suggest final: Have to move to a more recent GCC.
180# -Wsuggest-final-types
181
Andreas Gampebced67d2015-01-07 14:35:44 -0800182ART_TARGET_CLANG_CFLAGS := $(art_clang_cflags)
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700183ifeq ($(ART_HOST_CLANG),true)
Ian Rogers4ad5cd32014-11-11 23:08:07 -0800184 # Bug: 15446488. We don't omit the frame pointer to work around
185 # clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
186 ART_HOST_CFLAGS += $(art_clang_cflags) -fno-omit-frame-pointer
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800187else
188 ART_HOST_CFLAGS += $(art_gcc_cflags)
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700189endif
Andreas Gampebced67d2015-01-07 14:35:44 -0800190ifneq ($(ART_TARGET_CLANG),true)
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800191 ART_TARGET_CFLAGS += $(art_gcc_cflags)
Andreas Gampebced67d2015-01-07 14:35:44 -0800192else
193 # TODO: if we ever want to support GCC/Clang mix for multi-target products, this needs to be
194 # split up.
195 ifeq ($(ART_TARGET_CLANG_$(TARGET_ARCH)),false)
196 ART_TARGET_CFLAGS += $(art_gcc_cflags)
197 endif
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700198endif
199
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800200# Clear local variables now their use has ended.
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700201art_clang_cflags :=
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800202art_gcc_cflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700203
204ART_CPP_EXTENSION := .cc
205
206ART_C_INCLUDES := \
207 external/gtest/include \
Jeff Hao848f70a2014-01-15 13:49:50 -0800208 external/icu/icu4c/source/common \
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800209 external/lz4/lib \
Dmitriy Ivanov6130f732015-05-27 15:34:38 -0700210 external/valgrind/include \
211 external/valgrind \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700212 external/vixl/src \
213 external/zlib \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700214
Andreas Gampe4382f1e2015-08-05 01:08:53 +0000215# We optimize Thread::Current() with a direct TLS access. This requires access to a private
216# Bionic header.
217# Note: technically we only need this on device, but this avoids the duplication of the includes.
218ART_C_INCLUDES += bionic/libc/private
219
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700220# Base set of cflags used by all things ART.
221art_cflags := \
222 -fno-rtti \
223 -std=gnu++11 \
224 -ggdb3 \
225 -Wall \
226 -Werror \
227 -Wextra \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700228 -Wstrict-aliasing \
229 -fstrict-aliasing \
230 -Wunreachable-code \
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800231 -Wredundant-decls \
232 -Wshadow \
Andreas Gampe7c3952f2015-02-19 18:21:24 -0800233 -Wunused \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700234 -fvisibility=protected \
235 $(art_default_gc_type_cflags)
236
Alex Light50fa9932015-08-10 15:30:07 -0700237# The architectures the compiled tools are able to run on. Setting this to 'all' will cause all
238# architectures to be included.
239ART_TARGET_CODEGEN_ARCHS ?= all
240ART_HOST_CODEGEN_ARCHS ?= all
241
242ifeq ($(ART_TARGET_CODEGEN_ARCHS),all)
243 ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH))
244 # We need to handle the fact that some compiler tests mix code from different architectures.
245 ART_TARGET_COMPILER_TESTS ?= true
246else
247 ART_TARGET_COMPILER_TESTS := false
248 ifeq ($(ART_TARGET_CODEGEN_ARCHS),svelte)
249 ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_ARCH_64) $(ART_TARGET_ARCH_32))
250 endif
251endif
252ifeq ($(ART_HOST_CODEGEN_ARCHS),all)
253 ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH))
254 ART_HOST_COMPILER_TESTS ?= true
255else
256 ART_HOST_COMPILER_TESTS := false
257 ifeq ($(ART_HOST_CODEGEN_ARCHS),svelte)
258 ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS) $(ART_HOST_ARCH_64) $(ART_HOST_ARCH_32))
259 endif
260endif
261
262ifneq (,$(filter arm64,$(ART_TARGET_CODEGEN_ARCHS)))
263 ART_TARGET_CODEGEN_ARCHS += arm
264endif
265ifneq (,$(filter mips64,$(ART_TARGET_CODEGEN_ARCHS)))
266 ART_TARGET_CODEGEN_ARCHS += mips
267endif
268ifneq (,$(filter x86_64,$(ART_TARGET_CODEGEN_ARCHS)))
269 ART_TARGET_CODEGEN_ARCHS += x86
270endif
271ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS))
272ifneq (,$(filter arm64,$(ART_HOST_CODEGEN_ARCHS)))
273 ART_HOST_CODEGEN_ARCHS += arm
274endif
275ifneq (,$(filter mips64,$(ART_HOST_CODEGEN_ARCHS)))
276 ART_HOST_CODEGEN_ARCHS += mips
277endif
278ifneq (,$(filter x86_64,$(ART_HOST_CODEGEN_ARCHS)))
279 ART_HOST_CODEGEN_ARCHS += x86
280endif
281ART_HOST_CODEGEN_ARCHS := $(sort $(ART_HOST_CODEGEN_ARCHS))
282
283# Base set of cflags used by target build only
284art_target_cflags := \
285 $(foreach target_arch,$(strip $(ART_TARGET_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(target_arch))
286# Base set of cflags used by host build only
287art_host_cflags := \
288 $(foreach host_arch,$(strip $(ART_HOST_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(host_arch))
289
Roland Levillain12bd7212015-06-04 17:50:27 +0100290# Base set of asflags used by all things ART.
291art_asflags :=
292
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800293# Missing declarations: too many at the moment, as we use "extern" quite a bit.
294# -Wmissing-declarations \
295
296
Mathieu Chartiercd195fe2014-11-25 18:36:01 -0800297
298ifdef ART_IMT_SIZE
299 art_cflags += -DIMT_SIZE=$(ART_IMT_SIZE)
300else
301 # Default is 64
302 art_cflags += -DIMT_SIZE=64
303endif
304
Hiroshi Yamauchib0d22f12014-12-08 12:08:46 -0800305ifeq ($(ART_HEAP_POISONING),true)
306 art_cflags += -DART_HEAP_POISONING=1
Roland Levillain12bd7212015-06-04 17:50:27 +0100307 art_asflags += -DART_HEAP_POISONING=1
Hiroshi Yamauchib0d22f12014-12-08 12:08:46 -0800308endif
309
Hiroshi Yamauchi2e287752015-10-02 13:41:34 -0700310#
311# Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP.
312# The default is BAKER.
313#
314ART_READ_BARRIER_TYPE ?= BAKER
315
Hiroshi Yamauchic23f0d82015-01-23 17:23:42 -0800316ifeq ($(ART_USE_READ_BARRIER),true)
317 art_cflags += -DART_USE_READ_BARRIER=1
Hiroshi Yamauchi2e287752015-10-02 13:41:34 -0700318 art_cflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1
Roland Levillain12bd7212015-06-04 17:50:27 +0100319 art_asflags += -DART_USE_READ_BARRIER=1
Hiroshi Yamauchi2e287752015-10-02 13:41:34 -0700320 art_asflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1
Hiroshi Yamauchi37ba27a2016-01-26 14:06:14 -0800321
322 # Temporarily override -fstack-protector-strong with -fstack-protector to avoid a major
323 # slowdown with the read barrier config. b/26744236.
324 art_cflags += -fstack-protector
Hiroshi Yamauchic23f0d82015-01-23 17:23:42 -0800325endif
326
Hiroshi Yamauchi79bd2bf2015-03-20 10:28:34 -0700327ifeq ($(ART_USE_TLAB),true)
328 art_cflags += -DART_USE_TLAB=1
329endif
330
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700331# Cflags for non-debug ART and ART tools.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700332art_non_debug_cflags := \
Alex Light8069d9f2015-10-14 16:21:17 -0700333 $(ART_NDEBUG_OPT_FLAG)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700334
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700335# Cflags for debug ART and ART tools.
336art_debug_cflags := \
Alex Light8069d9f2015-10-14 16:21:17 -0700337 $(ART_DEBUG_OPT_FLAG) \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700338 -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000339 -DVIXL_DEBUG \
Ian Rogers50fe6da2014-10-17 01:18:08 -0700340 -UNDEBUG
Stephen Hines67a43382014-07-17 01:49:18 -0700341
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700342art_host_non_debug_cflags := $(art_non_debug_cflags)
343art_target_non_debug_cflags := $(art_non_debug_cflags)
Stephen Hines67a43382014-07-17 01:49:18 -0700344
Ian Rogersafd9acc2014-06-17 08:21:54 -0700345ifeq ($(HOST_OS),linux)
Stephen Hines67a43382014-07-17 01:49:18 -0700346 # Larger frame-size for host clang builds today
Dan Albert31fb2602014-09-30 22:10:10 -0700347 ifneq ($(ART_COVERAGE),true)
348 ifneq ($(NATIVE_COVERAGE),true)
Evgenii Stepanov1e133742015-05-20 12:30:59 -0700349 art_host_non_debug_cflags += -Wframe-larger-than=2700
350 ifdef SANITIZE_TARGET
Ivan Krasinf54cde62015-09-02 11:34:36 -0700351 art_target_non_debug_cflags += -Wframe-larger-than=6400
Evgenii Stepanov1e133742015-05-20 12:30:59 -0700352 else
Evgenii Stepanove1b6e972015-06-15 15:55:22 -0700353 art_target_non_debug_cflags += -Wframe-larger-than=1728
354 endif
Dan Albert31fb2602014-09-30 22:10:10 -0700355 endif
Dan Albert98b8bcf2014-11-14 19:56:21 -0800356 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700357endif
358
Ying Wanga28ff0f2014-12-08 14:29:34 -0800359ifndef LIBART_IMG_HOST_BASE_ADDRESS
360 $(error LIBART_IMG_HOST_BASE_ADDRESS unset)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700361endif
Ying Wanga28ff0f2014-12-08 14:29:34 -0800362ART_HOST_CFLAGS += $(art_cflags) -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
Alex Light50fa9932015-08-10 15:30:07 -0700363ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default $(art_host_cflags)
Roland Levillain12bd7212015-06-04 17:50:27 +0100364ART_HOST_ASFLAGS += $(art_asflags)
Ying Wanga28ff0f2014-12-08 14:29:34 -0800365
366ifndef LIBART_IMG_TARGET_BASE_ADDRESS
367 $(error LIBART_IMG_TARGET_BASE_ADDRESS unset)
368endif
369ART_TARGET_CFLAGS += $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS)
Alex Light50fa9932015-08-10 15:30:07 -0700370ART_TARGET_CFLAGS += $(art_target_cflags)
Roland Levillain12bd7212015-06-04 17:50:27 +0100371ART_TARGET_ASFLAGS += $(art_asflags)
Alex Lighta59dd802014-07-02 16:28:08 -0700372
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700373ART_HOST_NON_DEBUG_CFLAGS := $(art_host_non_debug_cflags)
374ART_TARGET_NON_DEBUG_CFLAGS := $(art_target_non_debug_cflags)
375ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags)
376ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags)
377
Alex Lighta59dd802014-07-02 16:28:08 -0700378ifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA
379 LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA=-0x1000000
380endif
381ifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA
382 LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA=0x1000000
383endif
384ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
385ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)
386
387ifndef LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA
388 LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA=-0x1000000
389endif
390ifndef LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA
391 LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA=0x1000000
392endif
393ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA)
394ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA)
395
Ian Rogersafd9acc2014-06-17 08:21:54 -0700396# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
397# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
398
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700399# Clear locals now they've served their purpose.
400art_cflags :=
Roland Levillain12bd7212015-06-04 17:50:27 +0100401art_asflags :=
Alex Light50fa9932015-08-10 15:30:07 -0700402art_host_cflags :=
403art_target_cflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700404art_debug_cflags :=
405art_non_debug_cflags :=
406art_host_non_debug_cflags :=
407art_target_non_debug_cflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700408art_default_gc_type_cflags :=
409
410ART_HOST_LDLIBS :=
411ifneq ($(ART_HOST_CLANG),true)
412 # GCC lacks libc++ assumed atomic operations, grab via libatomic.
413 ART_HOST_LDLIBS += -latomic
Ian Rogersafd9acc2014-06-17 08:21:54 -0700414endif
415
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700416ART_TARGET_LDFLAGS :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700417
418# $(1): ndebug_or_debug
419define set-target-local-cflags-vars
420 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
421 LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86)
Roland Levillain12bd7212015-06-04 17:50:27 +0100422 LOCAL_ASFLAGS += $(ART_TARGET_ASFLAGS)
Dehao Chen997660d2014-07-08 10:00:56 -0700423 LOCAL_LDFLAGS += $(ART_TARGET_LDFLAGS)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700424 art_target_cflags_ndebug_or_debug := $(1)
425 ifeq ($$(art_target_cflags_ndebug_or_debug),debug)
426 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
427 else
428 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
429 endif
430
Andreas Gampebced67d2015-01-07 14:35:44 -0800431 LOCAL_CLANG_CFLAGS := $(ART_TARGET_CLANG_CFLAGS)
Dan Albertbc0d79b2015-08-17 10:14:51 -0700432 $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
Andreas Gampebced67d2015-01-07 14:35:44 -0800433 LOCAL_CLANG_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch)))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700434
435 # Clear locally used variables.
436 art_target_cflags_ndebug_or_debug :=
437endef
438
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700439# Support for disabling certain builds.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700440ART_BUILD_TARGET := false
441ART_BUILD_HOST := false
442ART_BUILD_NDEBUG := false
443ART_BUILD_DEBUG := false
444ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
445 ART_BUILD_TARGET := true
446 ART_BUILD_NDEBUG := true
447endif
448ifeq ($(ART_BUILD_TARGET_DEBUG),true)
449 ART_BUILD_TARGET := true
450 ART_BUILD_DEBUG := true
451endif
452ifeq ($(ART_BUILD_HOST_NDEBUG),true)
453 ART_BUILD_HOST := true
454 ART_BUILD_NDEBUG := true
455endif
456ifeq ($(ART_BUILD_HOST_DEBUG),true)
457 ART_BUILD_HOST := true
458 ART_BUILD_DEBUG := true
459endif
460
Igor Murashkin37743352014-11-13 14:38:00 -0800461endif # ART_ANDROID_COMMON_BUILD_MK