1afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
2afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Copyright (C) 2011 The Android Open Source Project
3afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
4afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Licensed under the Apache License, Version 2.0 (the "License");
5afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# you may not use this file except in compliance with the License.
6afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# You may obtain a copy of the License at
7afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
8afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#      http://www.apache.org/licenses/LICENSE-2.0
9afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
10afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Unless required by applicable law or agreed to in writing, software
11afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# distributed under the License is distributed on an "AS IS" BASIS,
12afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# See the License for the specific language governing permissions and
14afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# limitations under the License.
15afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
16afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
173774335b08076117d6950cd472cdd59a167470b5Igor Murashkinifndef ART_ANDROID_COMMON_BUILD_MK
183774335b08076117d6950cd472cdd59a167470b5Igor MurashkinART_ANDROID_COMMON_BUILD_MK = true
19afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
20afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersinclude art/build/Android.common.mk
213774335b08076117d6950cd472cdd59a167470b5Igor Murashkininclude art/build/Android.common_utils.mk
22afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
23afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# These can be overridden via the environment or by editing to
24afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# enable/disable certain build configuration.
25afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
26afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# For example, to disable everything but the host debug build you use:
27afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
28afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...)
29afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
30afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Beware that tests may use the non-debug build for performance, notable 055-enum-performance
31afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
32afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_TARGET_NDEBUG ?= true
33afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_TARGET_DEBUG ?= true
34afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_HOST_NDEBUG ?= true
35afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_HOST_DEBUG ?= true
36676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravle
378069d9f1b587fef93252cd5135f59c038302f7fbAlex Light# Set this to change what opt level Art is built at.
388069d9f1b587fef93252cd5135f59c038302f7fbAlex LightART_DEBUG_OPT_FLAG ?= -O2
398069d9f1b587fef93252cd5135f59c038302f7fbAlex LightART_NDEBUG_OPT_FLAG ?= -O3
408069d9f1b587fef93252cd5135f59c038302f7fbAlex Light
41676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravle# Enable the static builds only for checkbuilds.
42676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravleifneq (,$(filter checkbuild,$(MAKECMDGOALS)))
43676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravle  ART_BUILD_HOST_STATIC ?= true
44676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravleelse
45676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravle  ART_BUILD_HOST_STATIC ?= false
46676ff8e35bf15a7551d264598cfaf1e97bcfa9aaCalin Juravleendif
47afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
484895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravle# Asan does not support static linkage
494895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravleifdef SANITIZE_HOST
504895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravle  ART_BUILD_HOST_STATIC := false
514895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravleendif
524895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravle
530e26f464d94eeb8cc09d881c46adfe35640c8d9aCalin Juravleifneq ($(HOST_OS),linux)
544895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravle  ART_BUILD_HOST_STATIC := false
554895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravleendif
564895ea4eb55a06003cc08cda55a6dca1c42a1794Calin Juravle
57afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_NDEBUG),false)
58afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_TARGET_NDEBUG)
59afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
60afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_DEBUG),false)
61afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_TARGET_DEBUG)
62afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
63afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_NDEBUG),false)
64afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_HOST_NDEBUG)
65afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
66afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_DEBUG),false)
67afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_HOST_DEBUG)
68afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
6965e069df6f864102b062fc04de8877f8230034a8Calin Juravleifeq ($(ART_BUILD_HOST_STATIC),true)
7065e069df6f864102b062fc04de8877f8230034a8Calin Juravle$(info Enabling ART_BUILD_HOST_STATIC)
7165e069df6f864102b062fc04de8877f8230034a8Calin Juravleendif
72afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
73093f1b4c3007d52a75186175d184ad7f58aaa0dfHiroshi Yamauchiifeq ($(ART_TEST_DEBUG_GC),true)
74093f1b4c3007d52a75186175d184ad7f58aaa0dfHiroshi Yamauchi  ART_DEFAULT_GC_TYPE := SS
75093f1b4c3007d52a75186175d184ad7f58aaa0dfHiroshi Yamauchi  ART_USE_TLAB := true
76093f1b4c3007d52a75186175d184ad7f58aaa0dfHiroshi Yamauchiendif
77093f1b4c3007d52a75186175d184ad7f58aaa0dfHiroshi Yamauchi
78afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
79e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier# Used to enable JIT
80e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier#
81e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu ChartierART_JIT := false
82e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartierifneq ($(wildcard art/JIT_ART),)
83e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier$(info Enabling ART_JIT because of existence of art/JIT_ART)
84e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu ChartierART_JIT := true
85e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartierendif
86e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartierifeq ($(WITH_ART_JIT), true)
87e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu ChartierART_JIT := true
88e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartierendif
89e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
90e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier#
91afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS.
92afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers#
933e781622a67e6d83e76e1bf765e9d84b3c718dc9Hiroshi YamauchiART_DEFAULT_GC_TYPE ?= CMS
943e781622a67e6d83e76e1bf765e9d84b3c718dc9Hiroshi Yamauchiart_default_gc_type_cflags := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE)
95afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
96ee0ebc81ba294710f90f0c8c934db1debae437aaAndreas GampeART_HOST_CFLAGS :=
97ee0ebc81ba294710f90f0c8c934db1debae437aaAndreas GampeART_TARGET_CFLAGS :=
98ee0ebc81ba294710f90f0c8c934db1debae437aaAndreas Gampe
9912bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland LevillainART_HOST_ASFLAGS :=
10012bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland LevillainART_TARGET_ASFLAGS :=
10112bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillain
102afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Clang build support.
103afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
104afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Host.
105afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_CLANG := false
106afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(WITHOUT_HOST_CLANG),true)
107afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  # By default, host builds use clang for better warnings.
108afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_HOST_CLANG := true
109afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
110afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
111ea521dccd5dea59bcdfda7cc61cdd413152a8890Sebastien Hertz# Clang on the target. Target builds use GCC by default.
11288c05693f090bc2562a530a4696082229de98840Bernhard Rosenkraenzerifneq ($(USE_CLANG_PLATFORM_BUILD),)
11388c05693f090bc2562a530a4696082229de98840Bernhard RosenkraenzerART_TARGET_CLANG := $(USE_CLANG_PLATFORM_BUILD)
11488c05693f090bc2562a530a4696082229de98840Bernhard Rosenkraenzerelse
115d642a91052cd28735bf38cc4a79421ec24d1ee72Ian RogersART_TARGET_CLANG := false
11688c05693f090bc2562a530a4696082229de98840Bernhard Rosenkraenzerendif
117a388c5a6291dbfb9a8366181a752050f4898d4ffStephen HinesART_TARGET_CLANG_arm :=
118ea521dccd5dea59bcdfda7cc61cdd413152a8890Sebastien HertzART_TARGET_CLANG_arm64 :=
11991ddd0d2db1f04368591d74505d8ea4c77c56030Duane SandART_TARGET_CLANG_mips :=
1201fdabe6dbe82eabc71d96b900d5a4ed4cb0a0a45Andreas GampeART_TARGET_CLANG_mips64 :=
121afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_x86 :=
122afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_x86_64 :=
123afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
124afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersdefine set-target-local-clang-vars
125afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers    LOCAL_CLANG := $(ART_TARGET_CLANG)
126afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers    $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
127afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers      ifneq ($$(ART_TARGET_CLANG_$(arch)),)
128afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers        LOCAL_CLANG_$(arch) := $$(ART_TARGET_CLANG_$(arch))
129afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers      endif)
130afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendef
131afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
1326f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_CLANG_CFLAGS :=
1336f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_CLANG_CFLAGS_arm :=
1346f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_CLANG_CFLAGS_arm64 :=
1356f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_CLANG_CFLAGS_mips :=
1361a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeART_TARGET_CLANG_CFLAGS_mips64 :=
1376f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_CLANG_CFLAGS_x86 :=
1386f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_CLANG_CFLAGS_x86_64 :=
1396f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
1406f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Warn about thread safety violations with clang.
14190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartierart_clang_cflags := -Wthread-safety -Wthread-safety-negative
1426f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
1436f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Warn if switch fallthroughs aren't annotated.
1446f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_clang_cflags += -Wimplicit-fallthrough
1456f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
1466f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Enable float equality warnings.
1476f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_clang_cflags += -Wfloat-equal
1486f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
149277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Enable warning of converting ints to void*.
150277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampeart_clang_cflags += -Wint-to-void-pointer-cast
151277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe
152ca71458862be8505330b7fd5649a062f31d143dcAndreas Gampe# Enable warning of wrong unused annotations.
153ca71458862be8505330b7fd5649a062f31d143dcAndreas Gampeart_clang_cflags += -Wused-but-marked-unused
154ca71458862be8505330b7fd5649a062f31d143dcAndreas Gampe
155758a801b66c134361a7b43f7e83f85d1fb800c4cAndreas Gampe# Enable warning for deprecated language features.
156758a801b66c134361a7b43f7e83f85d1fb800c4cAndreas Gampeart_clang_cflags += -Wdeprecated
157758a801b66c134361a7b43f7e83f85d1fb800c4cAndreas Gampe
158662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampe# Enable warning for unreachable break & return.
159662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampeart_clang_cflags += -Wunreachable-code-break -Wunreachable-code-return
160662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampe
161662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampe# Enable missing-noreturn only on non-Mac. As lots of things are not implemented for Apple, it's
162662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampe# a pain.
163662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampeifneq ($(HOST_OS),darwin)
164662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampe  art_clang_cflags += -Wmissing-noreturn
165662226652394d0388b0f6a3c9f79a317de273c8fAndreas Gampeendif
16665b798ea10dd716c1bb3dda029f9bf255435af72Andreas Gampe
167ca71458862be8505330b7fd5649a062f31d143dcAndreas Gampe
168277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# GCC-only warnings.
169277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampeart_gcc_cflags := -Wunused-but-set-parameter
170277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Suggest const: too many false positives, but good for a trial run.
171277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe#                  -Wsuggest-attribute=const
172277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Useless casts: too many, as we need to be 32/64 agnostic, but the compiler knows.
173277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe#                  -Wuseless-cast
174277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Zero-as-null: Have to convert all NULL and "diagnostic ignore" all includes like libnativehelper
175277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# that are still stuck pre-C++11.
176277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe#                  -Wzero-as-null-pointer-constant \
177277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Suggest final: Have to move to a more recent GCC.
178277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe#                  -Wsuggest-final-types
179277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe
180bced67d061049b607ce02a9813ef9dd0c87f8081Andreas GampeART_TARGET_CLANG_CFLAGS := $(art_clang_cflags)
1816f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersifeq ($(ART_HOST_CLANG),true)
1824ad5cd3e7d519484559ef778d96fb3f0be8919faIan Rogers  # Bug: 15446488. We don't omit the frame pointer to work around
1834ad5cd3e7d519484559ef778d96fb3f0be8919faIan Rogers  # clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
1844ad5cd3e7d519484559ef778d96fb3f0be8919faIan Rogers  ART_HOST_CFLAGS += $(art_clang_cflags) -fno-omit-frame-pointer
185277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampeelse
186277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe  ART_HOST_CFLAGS += $(art_gcc_cflags)
1876f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersendif
188bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampeifneq ($(ART_TARGET_CLANG),true)
189277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe  ART_TARGET_CFLAGS += $(art_gcc_cflags)
190bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampeelse
191bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe  # TODO: if we ever want to support GCC/Clang mix for multi-target products, this needs to be
192bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe  #       split up.
193bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe  ifeq ($(ART_TARGET_CLANG_$(TARGET_ARCH)),false)
194bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe    ART_TARGET_CFLAGS += $(art_gcc_cflags)
195bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe  endif
1966f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersendif
1976f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
198277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Clear local variables now their use has ended.
1996f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_clang_cflags :=
200277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampeart_gcc_cflags :=
2016f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
202afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_CPP_EXTENSION := .cc
203afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
204afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_C_INCLUDES := \
205afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  external/gtest/include \
206848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao  external/icu/icu4c/source/common \
207ceb07b3285eaab350a8cd12f7d74be3e40a255ddMathieu Chartier  external/lz4/lib \
2086130f739d8f35e01037ba5c3ec5e5a1057900479Dmitriy Ivanov  external/valgrind/include \
2096130f739d8f35e01037ba5c3ec5e5a1057900479Dmitriy Ivanov  external/valgrind \
210afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  external/vixl/src \
211afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  external/zlib \
212afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
2134382f1ef6ab2d6992d330cc8b43057d9139a1243Andreas Gampe# We optimize Thread::Current() with a direct TLS access. This requires access to a private
2144382f1ef6ab2d6992d330cc8b43057d9139a1243Andreas Gampe# Bionic header.
2154382f1ef6ab2d6992d330cc8b43057d9139a1243Andreas Gampe# Note: technically we only need this on device, but this avoids the duplication of the includes.
2164382f1ef6ab2d6992d330cc8b43057d9139a1243Andreas GampeART_C_INCLUDES += bionic/libc/private
2174382f1ef6ab2d6992d330cc8b43057d9139a1243Andreas Gampe
2186f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Base set of cflags used by all things ART.
219afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersart_cflags := \
220afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -fno-rtti \
221afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -std=gnu++11 \
222afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -ggdb3 \
223afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -Wall \
224afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -Werror \
225afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -Wextra \
226afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  -Wstrict-aliasing \
22729b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe  -fstrict-aliasing \
22807140838a3ee44a6056cacdc78f2930e019107daIan Rogers  -Wunreachable-code \
229277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe  -Wredundant-decls \
230277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe  -Wshadow \
2317c3952f423b8213083d60596a5f0bf4237ca3f7bAndreas Gampe  -Wunused \
2326f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers  -fvisibility=protected \
2336f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers  $(art_default_gc_type_cflags)
234afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
23550fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light# The architectures the compiled tools are able to run on. Setting this to 'all' will cause all
23650fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light# architectures to be included.
23750fa993d67f8a20322c27c1a77e7efcf826531fcAlex LightART_TARGET_CODEGEN_ARCHS ?= all
23850fa993d67f8a20322c27c1a77e7efcf826531fcAlex LightART_HOST_CODEGEN_ARCHS ?= all
23950fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light
24050fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifeq ($(ART_TARGET_CODEGEN_ARCHS),all)
24150fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH))
24250fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  # We need to handle the fact that some compiler tests mix code from different architectures.
24350fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_TARGET_COMPILER_TESTS ?= true
24450fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightelse
24550fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_TARGET_COMPILER_TESTS := false
24650fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ifeq ($(ART_TARGET_CODEGEN_ARCHS),svelte)
24750fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light    ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_ARCH_64) $(ART_TARGET_ARCH_32))
24850fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  endif
24950fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
25050fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifeq ($(ART_HOST_CODEGEN_ARCHS),all)
25150fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH))
25250fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_HOST_COMPILER_TESTS ?= true
25350fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightelse
25450fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_HOST_COMPILER_TESTS := false
25550fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ifeq ($(ART_HOST_CODEGEN_ARCHS),svelte)
25650fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light    ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS) $(ART_HOST_ARCH_64) $(ART_HOST_ARCH_32))
25750fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  endif
25850fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
25950fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light
26050fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifneq (,$(filter arm64,$(ART_TARGET_CODEGEN_ARCHS)))
26150fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_TARGET_CODEGEN_ARCHS += arm
26250fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
26350fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifneq (,$(filter mips64,$(ART_TARGET_CODEGEN_ARCHS)))
26450fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_TARGET_CODEGEN_ARCHS += mips
26550fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
26650fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifneq (,$(filter x86_64,$(ART_TARGET_CODEGEN_ARCHS)))
26750fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_TARGET_CODEGEN_ARCHS += x86
26850fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
26950fa993d67f8a20322c27c1a77e7efcf826531fcAlex LightART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS))
27050fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifneq (,$(filter arm64,$(ART_HOST_CODEGEN_ARCHS)))
27150fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_HOST_CODEGEN_ARCHS += arm
27250fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
27350fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifneq (,$(filter mips64,$(ART_HOST_CODEGEN_ARCHS)))
27450fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_HOST_CODEGEN_ARCHS += mips
27550fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
27650fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightifneq (,$(filter x86_64,$(ART_HOST_CODEGEN_ARCHS)))
27750fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  ART_HOST_CODEGEN_ARCHS += x86
27850fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightendif
27950fa993d67f8a20322c27c1a77e7efcf826531fcAlex LightART_HOST_CODEGEN_ARCHS := $(sort $(ART_HOST_CODEGEN_ARCHS))
28050fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light
28150fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light# Base set of cflags used by target build only
28250fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightart_target_cflags := \
28350fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  $(foreach target_arch,$(strip $(ART_TARGET_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(target_arch))
28450fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light# Base set of cflags used by host build only
28550fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightart_host_cflags := \
28650fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light  $(foreach host_arch,$(strip $(ART_HOST_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(host_arch))
28750fa993d67f8a20322c27c1a77e7efcf826531fcAlex Light
28812bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillain# Base set of asflags used by all things ART.
28912bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillainart_asflags :=
29012bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillain
291277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe# Missing declarations: too many at the moment, as we use "extern" quite a bit.
292277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe#  -Wmissing-declarations \
293277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe
294277ccbd200ea43590dfc06a93ae184a765327ad0Andreas Gampe
295cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartier
296cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartierifdef ART_IMT_SIZE
297cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartier  art_cflags += -DIMT_SIZE=$(ART_IMT_SIZE)
298cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartierelse
299cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartier  # Default is 64
300cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartier  art_cflags += -DIMT_SIZE=64
301cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartierendif
302cd195fe131842ad9ca7909203d479d325feaf9ddMathieu Chartier
303b0d22f178c0a8d1ee7d3692f282bb46c53cc2036Hiroshi Yamauchiifeq ($(ART_HEAP_POISONING),true)
304b0d22f178c0a8d1ee7d3692f282bb46c53cc2036Hiroshi Yamauchi  art_cflags += -DART_HEAP_POISONING=1
30512bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillain  art_asflags += -DART_HEAP_POISONING=1
306b0d22f178c0a8d1ee7d3692f282bb46c53cc2036Hiroshi Yamauchiendif
307b0d22f178c0a8d1ee7d3692f282bb46c53cc2036Hiroshi Yamauchi
3082e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi#
3092e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi# Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP.
3102e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi# The default is BAKER.
3112e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi#
3122e287754fcc0f3ecd10fcc9623800d935618360aHiroshi YamauchiART_READ_BARRIER_TYPE ?= BAKER
3132e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi
314c23f0d88bee65433a94f84c7cabe50be863905a5Hiroshi Yamauchiifeq ($(ART_USE_READ_BARRIER),true)
315c23f0d88bee65433a94f84c7cabe50be863905a5Hiroshi Yamauchi  art_cflags += -DART_USE_READ_BARRIER=1
3162e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi  art_cflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1
31712bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillain  art_asflags += -DART_USE_READ_BARRIER=1
3182e287754fcc0f3ecd10fcc9623800d935618360aHiroshi Yamauchi  art_asflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1
31937ba27acc3bb0937ee75f1215b86c3b5b872a356Hiroshi Yamauchi
32037ba27acc3bb0937ee75f1215b86c3b5b872a356Hiroshi Yamauchi  # Temporarily override -fstack-protector-strong with -fstack-protector to avoid a major
32137ba27acc3bb0937ee75f1215b86c3b5b872a356Hiroshi Yamauchi  # slowdown with the read barrier config. b/26744236.
32237ba27acc3bb0937ee75f1215b86c3b5b872a356Hiroshi Yamauchi  art_cflags += -fstack-protector
323c23f0d88bee65433a94f84c7cabe50be863905a5Hiroshi Yamauchiendif
324c23f0d88bee65433a94f84c7cabe50be863905a5Hiroshi Yamauchi
32579bd2bfa8f1602067fd381834206ed6b7e73a9beHiroshi Yamauchiifeq ($(ART_USE_TLAB),true)
32679bd2bfa8f1602067fd381834206ed6b7e73a9beHiroshi Yamauchi  art_cflags += -DART_USE_TLAB=1
32779bd2bfa8f1602067fd381834206ed6b7e73a9beHiroshi Yamauchiendif
32879bd2bfa8f1602067fd381834206ed6b7e73a9beHiroshi Yamauchi
3296f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Cflags for non-debug ART and ART tools.
330afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersart_non_debug_cflags := \
3318069d9f1b587fef93252cd5135f59c038302f7fbAlex Light  $(ART_NDEBUG_OPT_FLAG)
332afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
3336f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Cflags for debug ART and ART tools.
3346f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_debug_cflags := \
3358069d9f1b587fef93252cd5135f59c038302f7fbAlex Light  $(ART_DEBUG_OPT_FLAG) \
3366f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers  -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
33750fe6daa14e4f1f43ccacce9f03003570ea8c09fIan Rogers  -UNDEBUG
33867a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines
3396f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_host_non_debug_cflags := $(art_non_debug_cflags)
3406f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_target_non_debug_cflags := $(art_non_debug_cflags)
34167a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines
342afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(HOST_OS),linux)
34367a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines  # Larger frame-size for host clang builds today
34431fb26054349db03b3f1627fe975ed099ade69ddDan Albert  ifneq ($(ART_COVERAGE),true)
34531fb26054349db03b3f1627fe975ed099ade69ddDan Albert    ifneq ($(NATIVE_COVERAGE),true)
3461e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov      art_host_non_debug_cflags += -Wframe-larger-than=2700
3471e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov      ifdef SANITIZE_TARGET
348f54cde646bbf5df7c506b42fce53a24ce7d8a2e9Ivan Krasin        art_target_non_debug_cflags += -Wframe-larger-than=6400
3491e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov      else
350e1b6e974ad2e5695bc166cb363050208d77ded45Evgenii Stepanov        art_target_non_debug_cflags += -Wframe-larger-than=1728
351e1b6e974ad2e5695bc166cb363050208d77ded45Evgenii Stepanov      endif
35231fb26054349db03b3f1627fe975ed099ade69ddDan Albert    endif
35398b8bcf433e7bd8f1a447f7bf8d6cf80ec505c5eDan Albert  endif
354afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
355afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
356a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying Wangifndef LIBART_IMG_HOST_BASE_ADDRESS
357a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying Wang  $(error LIBART_IMG_HOST_BASE_ADDRESS unset)
358a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying Wangendif
359a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying WangART_HOST_CFLAGS += $(art_cflags) -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
36050fa993d67f8a20322c27c1a77e7efcf826531fcAlex LightART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default $(art_host_cflags)
36112bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland LevillainART_HOST_ASFLAGS += $(art_asflags)
362afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
363a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying Wangifndef LIBART_IMG_TARGET_BASE_ADDRESS
364a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying Wang  $(error LIBART_IMG_TARGET_BASE_ADDRESS unset)
365afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
366a28ff0f8a4df47a53041a69e611b841d8d38b3a1Ying WangART_TARGET_CFLAGS += $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS)
36750fa993d67f8a20322c27c1a77e7efcf826531fcAlex LightART_TARGET_CFLAGS += $(art_target_cflags)
36812bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland LevillainART_TARGET_ASFLAGS += $(art_asflags)
369a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
3706f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_HOST_NON_DEBUG_CFLAGS := $(art_host_non_debug_cflags)
3716f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_NON_DEBUG_CFLAGS := $(art_target_non_debug_cflags)
3726f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_HOST_DEBUG_CFLAGS := $(art_debug_cflags)
3736f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags)
3746f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers
375a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA
376a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA=-0x1000000
377a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif
378a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA
379a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA=0x1000000
380a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif
381a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_HOST_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
382a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_HOST_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)
383a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
384a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA
385a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA=-0x1000000
386a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif
387a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA
388a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA=0x1000000
389a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif
390a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA)
391a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA)
392a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
393afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
394afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
395afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
3966f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Clear locals now they've served their purpose.
3976f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_cflags :=
39812bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillainart_asflags :=
39950fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightart_host_cflags :=
40050fa993d67f8a20322c27c1a77e7efcf826531fcAlex Lightart_target_cflags :=
4016f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_debug_cflags :=
4026f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_non_debug_cflags :=
4036f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_host_non_debug_cflags :=
4046f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_target_non_debug_cflags :=
4056f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersart_default_gc_type_cflags :=
406afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
4076f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_HOST_LDLIBS :=
4086f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogersifneq ($(ART_HOST_CLANG),true)
4096f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers  # GCC lacks libc++ assumed atomic operations, grab via libatomic.
4106f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers  ART_HOST_LDLIBS += -latomic
411afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
412afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
4136f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian RogersART_TARGET_LDFLAGS :=
414afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
415afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# $(1): ndebug_or_debug
416afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersdefine set-target-local-cflags-vars
417afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
418afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86)
41912bd7210bb2f5738e33dfa3f2f1cba2e0aab4955Roland Levillain  LOCAL_ASFLAGS += $(ART_TARGET_ASFLAGS)
420997660dec8b10bba56276f35a9ee8d7ce9d62fc2Dehao Chen  LOCAL_LDFLAGS += $(ART_TARGET_LDFLAGS)
421afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  art_target_cflags_ndebug_or_debug := $(1)
422afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ifeq ($$(art_target_cflags_ndebug_or_debug),debug)
423afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers    LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
424afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  else
425afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers    LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
426afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  endif
427afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
428bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe  LOCAL_CLANG_CFLAGS := $(ART_TARGET_CLANG_CFLAGS)
429bc0d79be56b258b87064e94d3a34f45207ad8f32Dan Albert  $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
430bced67d061049b607ce02a9813ef9dd0c87f8081Andreas Gampe    LOCAL_CLANG_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch)))
431afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
432afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  # Clear locally used variables.
433afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  art_target_cflags_ndebug_or_debug :=
434afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendef
435afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
4366f3dbbadf4ce66982eb3d400e0a74cb73eb034f3Ian Rogers# Support for disabling certain builds.
437afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_TARGET := false
438afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_HOST := false
439afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_NDEBUG := false
440afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_DEBUG := false
441afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_NDEBUG),true)
442afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_TARGET := true
443afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_NDEBUG := true
444afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
445afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_DEBUG),true)
446afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_TARGET := true
447afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_DEBUG := true
448afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
449afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_NDEBUG),true)
450afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_HOST := true
451afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_NDEBUG := true
452afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
453afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_DEBUG),true)
454afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_HOST := true
455afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers  ART_BUILD_DEBUG := true
456afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif
457afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers
4583774335b08076117d6950cd472cdd59a167470b5Igor Murashkinendif # ART_ANDROID_COMMON_BUILD_MK
459