blob: e89a381840b9b0335a0a77fbd0878978b98fffbf [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
Roland Levillainb5390f72016-07-04 16:59:53 +010037# Set this to change what opt level ART is built at.
Alex Light8069d9f2015-10-14 16:21:17 -070038ART_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#
Ian Rogersafd9acc2014-06-17 08:21:54 -070079# Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS.
80#
Hiroshi Yamauchi3e781622015-02-25 12:52:34 -080081ART_DEFAULT_GC_TYPE ?= CMS
82art_default_gc_type_cflags := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE)
Ian Rogersafd9acc2014-06-17 08:21:54 -070083
Andreas Gampeee0ebc82014-10-21 21:07:28 -070084ART_HOST_CFLAGS :=
85ART_TARGET_CFLAGS :=
86
Roland Levillain12bd7212015-06-04 17:50:27 +010087ART_HOST_ASFLAGS :=
88ART_TARGET_ASFLAGS :=
89
Ian Rogersafd9acc2014-06-17 08:21:54 -070090# Clang build support.
91
92# Host.
93ART_HOST_CLANG := false
94ifneq ($(WITHOUT_HOST_CLANG),true)
95 # By default, host builds use clang for better warnings.
96 ART_HOST_CLANG := true
97endif
98
Sebastien Hertzea521dc2014-06-25 18:50:01 +020099# Clang on the target. Target builds use GCC by default.
Bernhard Rosenkraenzer88c05692014-10-04 19:02:06 +0200100ifneq ($(USE_CLANG_PLATFORM_BUILD),)
101ART_TARGET_CLANG := $(USE_CLANG_PLATFORM_BUILD)
102else
Ian Rogersd642a912014-10-02 09:41:44 -0700103ART_TARGET_CLANG := false
Bernhard Rosenkraenzer88c05692014-10-04 19:02:06 +0200104endif
Stephen Hinesa388c5a2016-03-02 18:26:29 -0800105ART_TARGET_CLANG_arm :=
Sebastien Hertzea521dc2014-06-25 18:50:01 +0200106ART_TARGET_CLANG_arm64 :=
Duane Sand91ddd0d2015-05-01 11:34:51 -0700107ART_TARGET_CLANG_mips :=
Andreas Gampe1fdabe62016-02-19 09:33:08 -0800108ART_TARGET_CLANG_mips64 :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700109ART_TARGET_CLANG_x86 :=
110ART_TARGET_CLANG_x86_64 :=
111
112define set-target-local-clang-vars
113 LOCAL_CLANG := $(ART_TARGET_CLANG)
114 $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
115 ifneq ($$(ART_TARGET_CLANG_$(arch)),)
116 LOCAL_CLANG_$(arch) := $$(ART_TARGET_CLANG_$(arch))
117 endif)
118endef
119
Ian Rogersafd9acc2014-06-17 08:21:54 -0700120ART_TARGET_CLANG_CFLAGS :=
121ART_TARGET_CLANG_CFLAGS_arm :=
122ART_TARGET_CLANG_CFLAGS_arm64 :=
123ART_TARGET_CLANG_CFLAGS_mips :=
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800124ART_TARGET_CLANG_CFLAGS_mips64 :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700125ART_TARGET_CLANG_CFLAGS_x86 :=
126ART_TARGET_CLANG_CFLAGS_x86_64 :=
127
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700128# Warn about thread safety violations with clang.
Mathieu Chartier90443472015-07-16 20:32:27 -0700129art_clang_cflags := -Wthread-safety -Wthread-safety-negative
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700130
131# Warn if switch fallthroughs aren't annotated.
132art_clang_cflags += -Wimplicit-fallthrough
133
134# Enable float equality warnings.
135art_clang_cflags += -Wfloat-equal
136
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800137# Enable warning of converting ints to void*.
138art_clang_cflags += -Wint-to-void-pointer-cast
139
Andreas Gampeca714582015-04-03 19:41:34 -0700140# Enable warning of wrong unused annotations.
141art_clang_cflags += -Wused-but-marked-unused
142
Andreas Gampe758a8012015-04-03 21:28:42 -0700143# Enable warning for deprecated language features.
144art_clang_cflags += -Wdeprecated
145
Andreas Gampe66222662015-04-06 19:50:46 -0700146# Enable warning for unreachable break & return.
147art_clang_cflags += -Wunreachable-code-break -Wunreachable-code-return
148
Pirama Arumuga Nainardf53be22016-06-28 10:51:10 -0700149# Bug: http://b/29823425 Disable -Wconstant-conversion and
150# -Wundefined-var-template for Clang update to r271374
151art_clang_cflags += -Wno-constant-conversion -Wno-undefined-var-template
152
Andreas Gampe66222662015-04-06 19:50:46 -0700153# Enable missing-noreturn only on non-Mac. As lots of things are not implemented for Apple, it's
154# a pain.
155ifneq ($(HOST_OS),darwin)
156 art_clang_cflags += -Wmissing-noreturn
157endif
Andreas Gampe65b798e2015-04-06 09:35:22 -0700158
Andreas Gampeca714582015-04-03 19:41:34 -0700159
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800160# GCC-only warnings.
161art_gcc_cflags := -Wunused-but-set-parameter
162# Suggest const: too many false positives, but good for a trial run.
163# -Wsuggest-attribute=const
164# Useless casts: too many, as we need to be 32/64 agnostic, but the compiler knows.
165# -Wuseless-cast
166# Zero-as-null: Have to convert all NULL and "diagnostic ignore" all includes like libnativehelper
167# that are still stuck pre-C++11.
168# -Wzero-as-null-pointer-constant \
169# Suggest final: Have to move to a more recent GCC.
170# -Wsuggest-final-types
171
Andreas Gampebced67d2015-01-07 14:35:44 -0800172ART_TARGET_CLANG_CFLAGS := $(art_clang_cflags)
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700173ifeq ($(ART_HOST_CLANG),true)
Ian Rogers4ad5cd32014-11-11 23:08:07 -0800174 # Bug: 15446488. We don't omit the frame pointer to work around
175 # clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
176 ART_HOST_CFLAGS += $(art_clang_cflags) -fno-omit-frame-pointer
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800177else
178 ART_HOST_CFLAGS += $(art_gcc_cflags)
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700179endif
Andreas Gampebced67d2015-01-07 14:35:44 -0800180ifneq ($(ART_TARGET_CLANG),true)
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800181 ART_TARGET_CFLAGS += $(art_gcc_cflags)
Andreas Gampebced67d2015-01-07 14:35:44 -0800182else
183 # TODO: if we ever want to support GCC/Clang mix for multi-target products, this needs to be
184 # split up.
185 ifeq ($(ART_TARGET_CLANG_$(TARGET_ARCH)),false)
186 ART_TARGET_CFLAGS += $(art_gcc_cflags)
187 endif
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700188endif
189
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800190# Clear local variables now their use has ended.
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700191art_clang_cflags :=
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800192art_gcc_cflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700193
194ART_CPP_EXTENSION := .cc
195
196ART_C_INCLUDES := \
197 external/gtest/include \
Jeff Hao848f70a2014-01-15 13:49:50 -0800198 external/icu/icu4c/source/common \
Mathieu Chartierceb07b32015-12-10 09:33:21 -0800199 external/lz4/lib \
Dmitriy Ivanov6130f732015-05-27 15:34:38 -0700200 external/valgrind/include \
201 external/valgrind \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700202 external/vixl/src \
203 external/zlib \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700204
Andreas Gampe4382f1e2015-08-05 01:08:53 +0000205# We optimize Thread::Current() with a direct TLS access. This requires access to a private
206# Bionic header.
207# Note: technically we only need this on device, but this avoids the duplication of the includes.
208ART_C_INCLUDES += bionic/libc/private
209
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700210# Base set of cflags used by all things ART.
211art_cflags := \
212 -fno-rtti \
213 -std=gnu++11 \
214 -ggdb3 \
215 -Wall \
216 -Werror \
217 -Wextra \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700218 -Wstrict-aliasing \
219 -fstrict-aliasing \
220 -Wunreachable-code \
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800221 -Wredundant-decls \
222 -Wshadow \
Andreas Gampe7c3952f2015-02-19 18:21:24 -0800223 -Wunused \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700224 -fvisibility=protected \
225 $(art_default_gc_type_cflags)
226
Alex Light50fa9932015-08-10 15:30:07 -0700227# The architectures the compiled tools are able to run on. Setting this to 'all' will cause all
228# architectures to be included.
229ART_TARGET_CODEGEN_ARCHS ?= all
230ART_HOST_CODEGEN_ARCHS ?= all
231
232ifeq ($(ART_TARGET_CODEGEN_ARCHS),all)
233 ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH))
234 # We need to handle the fact that some compiler tests mix code from different architectures.
235 ART_TARGET_COMPILER_TESTS ?= true
236else
237 ART_TARGET_COMPILER_TESTS := false
238 ifeq ($(ART_TARGET_CODEGEN_ARCHS),svelte)
239 ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_ARCH_64) $(ART_TARGET_ARCH_32))
240 endif
241endif
242ifeq ($(ART_HOST_CODEGEN_ARCHS),all)
243 ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH))
244 ART_HOST_COMPILER_TESTS ?= true
245else
246 ART_HOST_COMPILER_TESTS := false
247 ifeq ($(ART_HOST_CODEGEN_ARCHS),svelte)
248 ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS) $(ART_HOST_ARCH_64) $(ART_HOST_ARCH_32))
249 endif
250endif
251
252ifneq (,$(filter arm64,$(ART_TARGET_CODEGEN_ARCHS)))
253 ART_TARGET_CODEGEN_ARCHS += arm
254endif
255ifneq (,$(filter mips64,$(ART_TARGET_CODEGEN_ARCHS)))
256 ART_TARGET_CODEGEN_ARCHS += mips
257endif
258ifneq (,$(filter x86_64,$(ART_TARGET_CODEGEN_ARCHS)))
259 ART_TARGET_CODEGEN_ARCHS += x86
260endif
261ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS))
262ifneq (,$(filter arm64,$(ART_HOST_CODEGEN_ARCHS)))
263 ART_HOST_CODEGEN_ARCHS += arm
264endif
265ifneq (,$(filter mips64,$(ART_HOST_CODEGEN_ARCHS)))
266 ART_HOST_CODEGEN_ARCHS += mips
267endif
268ifneq (,$(filter x86_64,$(ART_HOST_CODEGEN_ARCHS)))
269 ART_HOST_CODEGEN_ARCHS += x86
270endif
271ART_HOST_CODEGEN_ARCHS := $(sort $(ART_HOST_CODEGEN_ARCHS))
272
273# Base set of cflags used by target build only
274art_target_cflags := \
275 $(foreach target_arch,$(strip $(ART_TARGET_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(target_arch))
276# Base set of cflags used by host build only
277art_host_cflags := \
278 $(foreach host_arch,$(strip $(ART_HOST_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(host_arch))
279
Roland Levillain12bd7212015-06-04 17:50:27 +0100280# Base set of asflags used by all things ART.
281art_asflags :=
282
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800283# Missing declarations: too many at the moment, as we use "extern" quite a bit.
284# -Wmissing-declarations \
285
286
Mathieu Chartiercd195fe2014-11-25 18:36:01 -0800287
288ifdef ART_IMT_SIZE
289 art_cflags += -DIMT_SIZE=$(ART_IMT_SIZE)
290else
Matthew Gharrity013e3f32016-06-16 11:49:23 -0700291 # Default is 43
292 art_cflags += -DIMT_SIZE=43
Mathieu Chartiercd195fe2014-11-25 18:36:01 -0800293endif
294
Hiroshi Yamauchib0d22f12014-12-08 12:08:46 -0800295ifeq ($(ART_HEAP_POISONING),true)
296 art_cflags += -DART_HEAP_POISONING=1
Roland Levillain12bd7212015-06-04 17:50:27 +0100297 art_asflags += -DART_HEAP_POISONING=1
Hiroshi Yamauchib0d22f12014-12-08 12:08:46 -0800298endif
299
Hiroshi Yamauchi2e287752015-10-02 13:41:34 -0700300#
301# Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP.
302# The default is BAKER.
303#
304ART_READ_BARRIER_TYPE ?= BAKER
305
Hiroshi Yamauchic23f0d82015-01-23 17:23:42 -0800306ifeq ($(ART_USE_READ_BARRIER),true)
307 art_cflags += -DART_USE_READ_BARRIER=1
Hiroshi Yamauchi2e287752015-10-02 13:41:34 -0700308 art_cflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1
Roland Levillain12bd7212015-06-04 17:50:27 +0100309 art_asflags += -DART_USE_READ_BARRIER=1
Hiroshi Yamauchi2e287752015-10-02 13:41:34 -0700310 art_asflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1
Hiroshi Yamauchi37ba27a2016-01-26 14:06:14 -0800311
312 # Temporarily override -fstack-protector-strong with -fstack-protector to avoid a major
313 # slowdown with the read barrier config. b/26744236.
314 art_cflags += -fstack-protector
Hiroshi Yamauchic23f0d82015-01-23 17:23:42 -0800315endif
316
Hiroshi Yamauchi79bd2bf2015-03-20 10:28:34 -0700317ifeq ($(ART_USE_TLAB),true)
318 art_cflags += -DART_USE_TLAB=1
319endif
320
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700321# Cflags for non-debug ART and ART tools.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700322art_non_debug_cflags := \
Alex Light8069d9f2015-10-14 16:21:17 -0700323 $(ART_NDEBUG_OPT_FLAG)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700324
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700325# Cflags for debug ART and ART tools.
326art_debug_cflags := \
Alex Light8069d9f2015-10-14 16:21:17 -0700327 $(ART_DEBUG_OPT_FLAG) \
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700328 -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
Ian Rogers50fe6da2014-10-17 01:18:08 -0700329 -UNDEBUG
Stephen Hines67a43382014-07-17 01:49:18 -0700330
Roland Levillainb5390f72016-07-04 16:59:53 +0100331# Assembler flags for non-debug ART and ART tools.
332art_non_debug_asflags :=
333
334# Assembler flags for debug ART and ART tools.
335art_debug_asflags := -UNDEBUG
336
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700337art_host_non_debug_cflags := $(art_non_debug_cflags)
338art_target_non_debug_cflags := $(art_non_debug_cflags)
Stephen Hines67a43382014-07-17 01:49:18 -0700339
Ian Rogersafd9acc2014-06-17 08:21:54 -0700340ifeq ($(HOST_OS),linux)
Stephen Hines67a43382014-07-17 01:49:18 -0700341 # Larger frame-size for host clang builds today
Dan Albert31fb2602014-09-30 22:10:10 -0700342 ifneq ($(ART_COVERAGE),true)
343 ifneq ($(NATIVE_COVERAGE),true)
Evgenii Stepanov1e133742015-05-20 12:30:59 -0700344 art_host_non_debug_cflags += -Wframe-larger-than=2700
345 ifdef SANITIZE_TARGET
Ivan Krasinf54cde62015-09-02 11:34:36 -0700346 art_target_non_debug_cflags += -Wframe-larger-than=6400
Evgenii Stepanov1e133742015-05-20 12:30:59 -0700347 else
Brian Carlstroma06481e2016-06-08 23:48:27 -0700348 art_target_non_debug_cflags += -Wframe-larger-than=1736
Evgenii Stepanove1b6e972015-06-15 15:55:22 -0700349 endif
Dan Albert31fb2602014-09-30 22:10:10 -0700350 endif
Dan Albert98b8bcf2014-11-14 19:56:21 -0800351 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700352endif
353
Ying Wanga28ff0f2014-12-08 14:29:34 -0800354ifndef LIBART_IMG_HOST_BASE_ADDRESS
355 $(error LIBART_IMG_HOST_BASE_ADDRESS unset)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700356endif
Ying Wanga28ff0f2014-12-08 14:29:34 -0800357ART_HOST_CFLAGS += $(art_cflags) -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
Alex Light50fa9932015-08-10 15:30:07 -0700358ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default $(art_host_cflags)
Roland Levillain12bd7212015-06-04 17:50:27 +0100359ART_HOST_ASFLAGS += $(art_asflags)
Ying Wanga28ff0f2014-12-08 14:29:34 -0800360
361ifndef LIBART_IMG_TARGET_BASE_ADDRESS
362 $(error LIBART_IMG_TARGET_BASE_ADDRESS unset)
363endif
Bilyan Borisov3071f802016-03-31 17:15:53 +0100364
365ART_TARGET_CFLAGS += $(art_cflags) -DART_TARGET \
366 -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS) \
367
368ifeq ($(ART_TARGET_LINUX),true)
369# Setting ART_TARGET_LINUX to true compiles art/ assuming that the target device
370# will be running linux rather than android.
371ART_TARGET_CFLAGS += -DART_TARGET_LINUX
372else
Bilyan Borisovbb661c02016-04-04 16:27:32 +0100373# The ART_TARGET_ANDROID macro is passed to target builds, which check
374# against it instead of against __ANDROID__ (which is provided by target
375# toolchains).
Bilyan Borisov3071f802016-03-31 17:15:53 +0100376ART_TARGET_CFLAGS += -DART_TARGET_ANDROID
377endif
Bilyan Borisovbb661c02016-04-04 16:27:32 +0100378
Alex Light50fa9932015-08-10 15:30:07 -0700379ART_TARGET_CFLAGS += $(art_target_cflags)
Roland Levillain12bd7212015-06-04 17:50:27 +0100380ART_TARGET_ASFLAGS += $(art_asflags)
Alex Lighta59dd802014-07-02 16:28:08 -0700381
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700382ART_HOST_NON_DEBUG_CFLAGS := $(art_host_non_debug_cflags)
383ART_TARGET_NON_DEBUG_CFLAGS := $(art_target_non_debug_cflags)
384ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags)
385ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags)
386
Roland Levillainb5390f72016-07-04 16:59:53 +0100387ART_HOST_NON_DEBUG_ASFLAGS := $(art_non_debug_asflags)
388ART_TARGET_NON_DEBUG_ASFLAGS := $(art_non_debug_asflags)
389ART_HOST_DEBUG_ASFLAGS := $(art_debug_asflags)
390ART_TARGET_DEBUG_ASFLAGS := $(art_debug_asflags)
391
Alex Lighta59dd802014-07-02 16:28:08 -0700392ifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA
393 LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA=-0x1000000
394endif
395ifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA
396 LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA=0x1000000
397endif
398ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
399ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)
400
401ifndef LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA
402 LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA=-0x1000000
403endif
404ifndef LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA
405 LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA=0x1000000
406endif
407ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA)
408ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA)
409
Ian Rogersafd9acc2014-06-17 08:21:54 -0700410# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
411# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
412
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700413# Clear locals now they've served their purpose.
414art_cflags :=
Roland Levillain12bd7212015-06-04 17:50:27 +0100415art_asflags :=
Alex Light50fa9932015-08-10 15:30:07 -0700416art_host_cflags :=
417art_target_cflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700418art_debug_cflags :=
419art_non_debug_cflags :=
Roland Levillainb5390f72016-07-04 16:59:53 +0100420art_debug_asflags :=
421art_non_debug_asflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700422art_host_non_debug_cflags :=
423art_target_non_debug_cflags :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700424art_default_gc_type_cflags :=
425
426ART_HOST_LDLIBS :=
427ifneq ($(ART_HOST_CLANG),true)
428 # GCC lacks libc++ assumed atomic operations, grab via libatomic.
429 ART_HOST_LDLIBS += -latomic
Ian Rogersafd9acc2014-06-17 08:21:54 -0700430endif
431
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700432ART_TARGET_LDFLAGS :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700433
434# $(1): ndebug_or_debug
435define set-target-local-cflags-vars
436 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
437 LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86)
Roland Levillain12bd7212015-06-04 17:50:27 +0100438 LOCAL_ASFLAGS += $(ART_TARGET_ASFLAGS)
Dehao Chen997660d2014-07-08 10:00:56 -0700439 LOCAL_LDFLAGS += $(ART_TARGET_LDFLAGS)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700440 art_target_cflags_ndebug_or_debug := $(1)
441 ifeq ($$(art_target_cflags_ndebug_or_debug),debug)
442 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Roland Levillainb5390f72016-07-04 16:59:53 +0100443 LOCAL_ASFLAGS += $(ART_TARGET_DEBUG_ASFLAGS)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700444 else
445 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
Roland Levillainb5390f72016-07-04 16:59:53 +0100446 LOCAL_ASFLAGS += $(ART_TARGET_NON_DEBUG_ASFLAGS)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700447 endif
448
Andreas Gampebced67d2015-01-07 14:35:44 -0800449 LOCAL_CLANG_CFLAGS := $(ART_TARGET_CLANG_CFLAGS)
Dan Albertbc0d79b2015-08-17 10:14:51 -0700450 $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
Andreas Gampebced67d2015-01-07 14:35:44 -0800451 LOCAL_CLANG_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch)))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700452
453 # Clear locally used variables.
454 art_target_cflags_ndebug_or_debug :=
455endef
456
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700457# Support for disabling certain builds.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700458ART_BUILD_TARGET := false
459ART_BUILD_HOST := false
460ART_BUILD_NDEBUG := false
461ART_BUILD_DEBUG := false
462ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
463 ART_BUILD_TARGET := true
464 ART_BUILD_NDEBUG := true
465endif
466ifeq ($(ART_BUILD_TARGET_DEBUG),true)
467 ART_BUILD_TARGET := true
468 ART_BUILD_DEBUG := true
469endif
470ifeq ($(ART_BUILD_HOST_NDEBUG),true)
471 ART_BUILD_HOST := true
472 ART_BUILD_NDEBUG := true
473endif
474ifeq ($(ART_BUILD_HOST_DEBUG),true)
475 ART_BUILD_HOST := true
476 ART_BUILD_DEBUG := true
477endif
478
Igor Murashkin37743352014-11-13 14:38:00 -0800479endif # ART_ANDROID_COMMON_BUILD_MK