Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 1 | # |
| 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 Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame] | 17 | ifndef ART_ANDROID_COMMON_BUILD_MK |
| 18 | ART_ANDROID_COMMON_BUILD_MK = true |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 19 | |
| 20 | include art/build/Android.common.mk |
Igor Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame] | 21 | include art/build/Android.common_utils.mk |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 22 | |
| 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 | # |
| 32 | ART_BUILD_TARGET_NDEBUG ?= true |
| 33 | ART_BUILD_TARGET_DEBUG ?= true |
| 34 | ART_BUILD_HOST_NDEBUG ?= true |
| 35 | ART_BUILD_HOST_DEBUG ?= true |
Calin Juravle | 676ff8e | 2015-07-24 16:45:26 +0100 | [diff] [blame] | 36 | |
Alex Light | 8069d9f | 2015-10-14 16:21:17 -0700 | [diff] [blame] | 37 | # Set this to change what opt level Art is built at. |
| 38 | ART_DEBUG_OPT_FLAG ?= -O2 |
| 39 | ART_NDEBUG_OPT_FLAG ?= -O3 |
| 40 | |
Calin Juravle | 676ff8e | 2015-07-24 16:45:26 +0100 | [diff] [blame] | 41 | # Enable the static builds only for checkbuilds. |
| 42 | ifneq (,$(filter checkbuild,$(MAKECMDGOALS))) |
| 43 | ART_BUILD_HOST_STATIC ?= true |
| 44 | else |
| 45 | ART_BUILD_HOST_STATIC ?= false |
| 46 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 47 | |
Calin Juravle | 4895ea4 | 2015-07-02 18:21:14 +0100 | [diff] [blame] | 48 | # Asan does not support static linkage |
| 49 | ifdef SANITIZE_HOST |
| 50 | ART_BUILD_HOST_STATIC := false |
| 51 | endif |
| 52 | |
Calin Juravle | 0e26f46 | 2015-07-09 15:48:03 +0100 | [diff] [blame] | 53 | ifneq ($(HOST_OS),linux) |
Calin Juravle | 4895ea4 | 2015-07-02 18:21:14 +0100 | [diff] [blame] | 54 | ART_BUILD_HOST_STATIC := false |
| 55 | endif |
| 56 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 57 | ifeq ($(ART_BUILD_TARGET_NDEBUG),false) |
| 58 | $(info Disabling ART_BUILD_TARGET_NDEBUG) |
| 59 | endif |
| 60 | ifeq ($(ART_BUILD_TARGET_DEBUG),false) |
| 61 | $(info Disabling ART_BUILD_TARGET_DEBUG) |
| 62 | endif |
| 63 | ifeq ($(ART_BUILD_HOST_NDEBUG),false) |
| 64 | $(info Disabling ART_BUILD_HOST_NDEBUG) |
| 65 | endif |
| 66 | ifeq ($(ART_BUILD_HOST_DEBUG),false) |
| 67 | $(info Disabling ART_BUILD_HOST_DEBUG) |
| 68 | endif |
Calin Juravle | 65e069d | 2015-06-08 10:35:24 +0100 | [diff] [blame] | 69 | ifeq ($(ART_BUILD_HOST_STATIC),true) |
| 70 | $(info Enabling ART_BUILD_HOST_STATIC) |
| 71 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 72 | |
Hiroshi Yamauchi | 093f1b4 | 2015-07-14 12:20:30 -0700 | [diff] [blame] | 73 | ifeq ($(ART_TEST_DEBUG_GC),true) |
| 74 | ART_DEFAULT_GC_TYPE := SS |
| 75 | ART_USE_TLAB := true |
| 76 | endif |
| 77 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 78 | # |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 79 | # Used to enable JIT |
| 80 | # |
| 81 | ART_JIT := false |
| 82 | ifneq ($(wildcard art/JIT_ART),) |
| 83 | $(info Enabling ART_JIT because of existence of art/JIT_ART) |
| 84 | ART_JIT := true |
| 85 | endif |
| 86 | ifeq ($(WITH_ART_JIT), true) |
| 87 | ART_JIT := true |
| 88 | endif |
| 89 | |
| 90 | # |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 91 | # Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS. |
| 92 | # |
Hiroshi Yamauchi | 3e78162 | 2015-02-25 12:52:34 -0800 | [diff] [blame] | 93 | ART_DEFAULT_GC_TYPE ?= CMS |
| 94 | art_default_gc_type_cflags := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 95 | |
Andreas Gampe | ee0ebc8 | 2014-10-21 21:07:28 -0700 | [diff] [blame] | 96 | ART_HOST_CFLAGS := |
| 97 | ART_TARGET_CFLAGS := |
| 98 | |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 99 | ART_HOST_ASFLAGS := |
| 100 | ART_TARGET_ASFLAGS := |
| 101 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 102 | # Clang build support. |
| 103 | |
| 104 | # Host. |
| 105 | ART_HOST_CLANG := false |
| 106 | ifneq ($(WITHOUT_HOST_CLANG),true) |
| 107 | # By default, host builds use clang for better warnings. |
| 108 | ART_HOST_CLANG := true |
| 109 | endif |
| 110 | |
Sebastien Hertz | ea521dc | 2014-06-25 18:50:01 +0200 | [diff] [blame] | 111 | # Clang on the target. Target builds use GCC by default. |
Bernhard Rosenkraenzer | 88c0569 | 2014-10-04 19:02:06 +0200 | [diff] [blame] | 112 | ifneq ($(USE_CLANG_PLATFORM_BUILD),) |
| 113 | ART_TARGET_CLANG := $(USE_CLANG_PLATFORM_BUILD) |
| 114 | else |
Ian Rogers | d642a91 | 2014-10-02 09:41:44 -0700 | [diff] [blame] | 115 | ART_TARGET_CLANG := false |
Bernhard Rosenkraenzer | 88c0569 | 2014-10-04 19:02:06 +0200 | [diff] [blame] | 116 | endif |
Andreas Gampe | 5295bc2 | 2015-10-20 22:10:26 -0700 | [diff] [blame] | 117 | # b/25130937 |
| 118 | ART_TARGET_CLANG_arm := false |
Sebastien Hertz | ea521dc | 2014-06-25 18:50:01 +0200 | [diff] [blame] | 119 | ART_TARGET_CLANG_arm64 := |
Duane Sand | 91ddd0d | 2015-05-01 11:34:51 -0700 | [diff] [blame] | 120 | ART_TARGET_CLANG_mips := |
Lazar Trsic | 610a142 | 2015-11-27 14:33:06 +0100 | [diff] [blame^] | 121 | # b/25928358, illegal instruction on mips64r6 with -O0 |
| 122 | ART_TARGET_CLANG_mips64 := false |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 123 | ART_TARGET_CLANG_x86 := |
| 124 | ART_TARGET_CLANG_x86_64 := |
| 125 | |
| 126 | define 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) |
| 132 | endef |
| 133 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 134 | ART_TARGET_CLANG_CFLAGS := |
| 135 | ART_TARGET_CLANG_CFLAGS_arm := |
| 136 | ART_TARGET_CLANG_CFLAGS_arm64 := |
| 137 | ART_TARGET_CLANG_CFLAGS_mips := |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 138 | ART_TARGET_CLANG_CFLAGS_mips64 := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 139 | ART_TARGET_CLANG_CFLAGS_x86 := |
| 140 | ART_TARGET_CLANG_CFLAGS_x86_64 := |
| 141 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 142 | # Warn about thread safety violations with clang. |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 143 | art_clang_cflags := -Wthread-safety -Wthread-safety-negative |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 144 | |
| 145 | # Warn if switch fallthroughs aren't annotated. |
| 146 | art_clang_cflags += -Wimplicit-fallthrough |
| 147 | |
| 148 | # Enable float equality warnings. |
| 149 | art_clang_cflags += -Wfloat-equal |
| 150 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 151 | # Enable warning of converting ints to void*. |
| 152 | art_clang_cflags += -Wint-to-void-pointer-cast |
| 153 | |
Andreas Gampe | ca71458 | 2015-04-03 19:41:34 -0700 | [diff] [blame] | 154 | # Enable warning of wrong unused annotations. |
| 155 | art_clang_cflags += -Wused-but-marked-unused |
| 156 | |
Andreas Gampe | 758a801 | 2015-04-03 21:28:42 -0700 | [diff] [blame] | 157 | # Enable warning for deprecated language features. |
| 158 | art_clang_cflags += -Wdeprecated |
| 159 | |
Andreas Gampe | 6622266 | 2015-04-06 19:50:46 -0700 | [diff] [blame] | 160 | # Enable warning for unreachable break & return. |
| 161 | art_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. |
| 165 | ifneq ($(HOST_OS),darwin) |
| 166 | art_clang_cflags += -Wmissing-noreturn |
| 167 | endif |
Andreas Gampe | 65b798e | 2015-04-06 09:35:22 -0700 | [diff] [blame] | 168 | |
Andreas Gampe | ca71458 | 2015-04-03 19:41:34 -0700 | [diff] [blame] | 169 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 170 | # GCC-only warnings. |
| 171 | art_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 Gampe | bced67d | 2015-01-07 14:35:44 -0800 | [diff] [blame] | 182 | ART_TARGET_CLANG_CFLAGS := $(art_clang_cflags) |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 183 | ifeq ($(ART_HOST_CLANG),true) |
Ian Rogers | 4ad5cd3 | 2014-11-11 23:08:07 -0800 | [diff] [blame] | 184 | # 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 Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 187 | else |
| 188 | ART_HOST_CFLAGS += $(art_gcc_cflags) |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 189 | endif |
Andreas Gampe | bced67d | 2015-01-07 14:35:44 -0800 | [diff] [blame] | 190 | ifneq ($(ART_TARGET_CLANG),true) |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 191 | ART_TARGET_CFLAGS += $(art_gcc_cflags) |
Andreas Gampe | bced67d | 2015-01-07 14:35:44 -0800 | [diff] [blame] | 192 | else |
| 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 Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 198 | endif |
| 199 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 200 | # Clear local variables now their use has ended. |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 201 | art_clang_cflags := |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 202 | art_gcc_cflags := |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 203 | |
| 204 | ART_CPP_EXTENSION := .cc |
| 205 | |
| 206 | ART_C_INCLUDES := \ |
| 207 | external/gtest/include \ |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 208 | external/icu/icu4c/source/common \ |
Dmitriy Ivanov | 6130f73 | 2015-05-27 15:34:38 -0700 | [diff] [blame] | 209 | external/valgrind/include \ |
| 210 | external/valgrind \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 211 | external/vixl/src \ |
| 212 | external/zlib \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 213 | |
Andreas Gampe | 4382f1e | 2015-08-05 01:08:53 +0000 | [diff] [blame] | 214 | # We optimize Thread::Current() with a direct TLS access. This requires access to a private |
| 215 | # Bionic header. |
| 216 | # Note: technically we only need this on device, but this avoids the duplication of the includes. |
| 217 | ART_C_INCLUDES += bionic/libc/private |
| 218 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 219 | # Base set of cflags used by all things ART. |
| 220 | art_cflags := \ |
| 221 | -fno-rtti \ |
| 222 | -std=gnu++11 \ |
| 223 | -ggdb3 \ |
| 224 | -Wall \ |
| 225 | -Werror \ |
| 226 | -Wextra \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 227 | -Wstrict-aliasing \ |
| 228 | -fstrict-aliasing \ |
| 229 | -Wunreachable-code \ |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 230 | -Wredundant-decls \ |
| 231 | -Wshadow \ |
Andreas Gampe | 7c3952f | 2015-02-19 18:21:24 -0800 | [diff] [blame] | 232 | -Wunused \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 233 | -fvisibility=protected \ |
| 234 | $(art_default_gc_type_cflags) |
| 235 | |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 236 | # The architectures the compiled tools are able to run on. Setting this to 'all' will cause all |
| 237 | # architectures to be included. |
| 238 | ART_TARGET_CODEGEN_ARCHS ?= all |
| 239 | ART_HOST_CODEGEN_ARCHS ?= all |
| 240 | |
| 241 | ifeq ($(ART_TARGET_CODEGEN_ARCHS),all) |
| 242 | ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH)) |
| 243 | # We need to handle the fact that some compiler tests mix code from different architectures. |
| 244 | ART_TARGET_COMPILER_TESTS ?= true |
| 245 | else |
| 246 | ART_TARGET_COMPILER_TESTS := false |
| 247 | ifeq ($(ART_TARGET_CODEGEN_ARCHS),svelte) |
| 248 | ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_ARCH_64) $(ART_TARGET_ARCH_32)) |
| 249 | endif |
| 250 | endif |
| 251 | ifeq ($(ART_HOST_CODEGEN_ARCHS),all) |
| 252 | ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH)) |
| 253 | ART_HOST_COMPILER_TESTS ?= true |
| 254 | else |
| 255 | ART_HOST_COMPILER_TESTS := false |
| 256 | ifeq ($(ART_HOST_CODEGEN_ARCHS),svelte) |
| 257 | ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS) $(ART_HOST_ARCH_64) $(ART_HOST_ARCH_32)) |
| 258 | endif |
| 259 | endif |
| 260 | |
| 261 | ifneq (,$(filter arm64,$(ART_TARGET_CODEGEN_ARCHS))) |
| 262 | ART_TARGET_CODEGEN_ARCHS += arm |
| 263 | endif |
| 264 | ifneq (,$(filter mips64,$(ART_TARGET_CODEGEN_ARCHS))) |
| 265 | ART_TARGET_CODEGEN_ARCHS += mips |
| 266 | endif |
| 267 | ifneq (,$(filter x86_64,$(ART_TARGET_CODEGEN_ARCHS))) |
| 268 | ART_TARGET_CODEGEN_ARCHS += x86 |
| 269 | endif |
| 270 | ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS)) |
| 271 | ifneq (,$(filter arm64,$(ART_HOST_CODEGEN_ARCHS))) |
| 272 | ART_HOST_CODEGEN_ARCHS += arm |
| 273 | endif |
| 274 | ifneq (,$(filter mips64,$(ART_HOST_CODEGEN_ARCHS))) |
| 275 | ART_HOST_CODEGEN_ARCHS += mips |
| 276 | endif |
| 277 | ifneq (,$(filter x86_64,$(ART_HOST_CODEGEN_ARCHS))) |
| 278 | ART_HOST_CODEGEN_ARCHS += x86 |
| 279 | endif |
| 280 | ART_HOST_CODEGEN_ARCHS := $(sort $(ART_HOST_CODEGEN_ARCHS)) |
| 281 | |
| 282 | # Base set of cflags used by target build only |
| 283 | art_target_cflags := \ |
| 284 | $(foreach target_arch,$(strip $(ART_TARGET_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(target_arch)) |
| 285 | # Base set of cflags used by host build only |
| 286 | art_host_cflags := \ |
| 287 | $(foreach host_arch,$(strip $(ART_HOST_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(host_arch)) |
| 288 | |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 289 | # Base set of asflags used by all things ART. |
| 290 | art_asflags := |
| 291 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 292 | # Missing declarations: too many at the moment, as we use "extern" quite a bit. |
| 293 | # -Wmissing-declarations \ |
| 294 | |
| 295 | |
Mathieu Chartier | cd195fe | 2014-11-25 18:36:01 -0800 | [diff] [blame] | 296 | |
| 297 | ifdef ART_IMT_SIZE |
| 298 | art_cflags += -DIMT_SIZE=$(ART_IMT_SIZE) |
| 299 | else |
| 300 | # Default is 64 |
| 301 | art_cflags += -DIMT_SIZE=64 |
| 302 | endif |
| 303 | |
Hiroshi Yamauchi | b0d22f1 | 2014-12-08 12:08:46 -0800 | [diff] [blame] | 304 | ifeq ($(ART_HEAP_POISONING),true) |
| 305 | art_cflags += -DART_HEAP_POISONING=1 |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 306 | art_asflags += -DART_HEAP_POISONING=1 |
Hiroshi Yamauchi | b0d22f1 | 2014-12-08 12:08:46 -0800 | [diff] [blame] | 307 | endif |
| 308 | |
Hiroshi Yamauchi | 2e28775 | 2015-10-02 13:41:34 -0700 | [diff] [blame] | 309 | # |
| 310 | # Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP. |
| 311 | # The default is BAKER. |
| 312 | # |
| 313 | ART_READ_BARRIER_TYPE ?= BAKER |
| 314 | |
Hiroshi Yamauchi | c23f0d8 | 2015-01-23 17:23:42 -0800 | [diff] [blame] | 315 | ifeq ($(ART_USE_READ_BARRIER),true) |
| 316 | art_cflags += -DART_USE_READ_BARRIER=1 |
Hiroshi Yamauchi | 2e28775 | 2015-10-02 13:41:34 -0700 | [diff] [blame] | 317 | art_cflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1 |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 318 | art_asflags += -DART_USE_READ_BARRIER=1 |
Hiroshi Yamauchi | 2e28775 | 2015-10-02 13:41:34 -0700 | [diff] [blame] | 319 | art_asflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1 |
Hiroshi Yamauchi | c23f0d8 | 2015-01-23 17:23:42 -0800 | [diff] [blame] | 320 | endif |
| 321 | |
Hiroshi Yamauchi | 79bd2bf | 2015-03-20 10:28:34 -0700 | [diff] [blame] | 322 | ifeq ($(ART_USE_TLAB),true) |
| 323 | art_cflags += -DART_USE_TLAB=1 |
| 324 | endif |
| 325 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 326 | # Cflags for non-debug ART and ART tools. |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 327 | art_non_debug_cflags := \ |
Alex Light | 8069d9f | 2015-10-14 16:21:17 -0700 | [diff] [blame] | 328 | $(ART_NDEBUG_OPT_FLAG) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 329 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 330 | # Cflags for debug ART and ART tools. |
| 331 | art_debug_cflags := \ |
Alex Light | 8069d9f | 2015-10-14 16:21:17 -0700 | [diff] [blame] | 332 | $(ART_DEBUG_OPT_FLAG) \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 333 | -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ |
Serban Constantinescu | 32f5b4d | 2014-11-25 20:05:46 +0000 | [diff] [blame] | 334 | -DVIXL_DEBUG \ |
Ian Rogers | 50fe6da | 2014-10-17 01:18:08 -0700 | [diff] [blame] | 335 | -UNDEBUG |
Stephen Hines | 67a4338 | 2014-07-17 01:49:18 -0700 | [diff] [blame] | 336 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 337 | art_host_non_debug_cflags := $(art_non_debug_cflags) |
| 338 | art_target_non_debug_cflags := $(art_non_debug_cflags) |
Stephen Hines | 67a4338 | 2014-07-17 01:49:18 -0700 | [diff] [blame] | 339 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 340 | ifeq ($(HOST_OS),linux) |
Stephen Hines | 67a4338 | 2014-07-17 01:49:18 -0700 | [diff] [blame] | 341 | # Larger frame-size for host clang builds today |
Dan Albert | 31fb260 | 2014-09-30 22:10:10 -0700 | [diff] [blame] | 342 | ifneq ($(ART_COVERAGE),true) |
| 343 | ifneq ($(NATIVE_COVERAGE),true) |
Evgenii Stepanov | 1e13374 | 2015-05-20 12:30:59 -0700 | [diff] [blame] | 344 | art_host_non_debug_cflags += -Wframe-larger-than=2700 |
| 345 | ifdef SANITIZE_TARGET |
Ivan Krasin | f54cde6 | 2015-09-02 11:34:36 -0700 | [diff] [blame] | 346 | art_target_non_debug_cflags += -Wframe-larger-than=6400 |
Evgenii Stepanov | 1e13374 | 2015-05-20 12:30:59 -0700 | [diff] [blame] | 347 | else |
Evgenii Stepanov | e1b6e97 | 2015-06-15 15:55:22 -0700 | [diff] [blame] | 348 | art_target_non_debug_cflags += -Wframe-larger-than=1728 |
| 349 | endif |
Dan Albert | 31fb260 | 2014-09-30 22:10:10 -0700 | [diff] [blame] | 350 | endif |
Dan Albert | 98b8bcf | 2014-11-14 19:56:21 -0800 | [diff] [blame] | 351 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 352 | endif |
| 353 | |
Ying Wang | a28ff0f | 2014-12-08 14:29:34 -0800 | [diff] [blame] | 354 | ifndef LIBART_IMG_HOST_BASE_ADDRESS |
| 355 | $(error LIBART_IMG_HOST_BASE_ADDRESS unset) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 356 | endif |
Ying Wang | a28ff0f | 2014-12-08 14:29:34 -0800 | [diff] [blame] | 357 | ART_HOST_CFLAGS += $(art_cflags) -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS) |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 358 | ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default $(art_host_cflags) |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 359 | ART_HOST_ASFLAGS += $(art_asflags) |
Ying Wang | a28ff0f | 2014-12-08 14:29:34 -0800 | [diff] [blame] | 360 | |
Dan Albert | bc0d79b | 2015-08-17 10:14:51 -0700 | [diff] [blame] | 361 | # The latest clang update trips over many of the files in art and never finishes |
| 362 | # compiling for aarch64 with -O3 (or -O2). Drop back to -O1 while we investigate |
| 363 | # to stop punishing the build server. |
| 364 | # Bug: http://b/23256622 |
| 365 | ART_TARGET_CLANG_CFLAGS_arm64 += -O1 |
| 366 | |
Ying Wang | a28ff0f | 2014-12-08 14:29:34 -0800 | [diff] [blame] | 367 | ifndef LIBART_IMG_TARGET_BASE_ADDRESS |
| 368 | $(error LIBART_IMG_TARGET_BASE_ADDRESS unset) |
| 369 | endif |
| 370 | ART_TARGET_CFLAGS += $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS) |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 371 | ART_TARGET_CFLAGS += $(art_target_cflags) |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 372 | ART_TARGET_ASFLAGS += $(art_asflags) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 373 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 374 | ART_HOST_NON_DEBUG_CFLAGS := $(art_host_non_debug_cflags) |
| 375 | ART_TARGET_NON_DEBUG_CFLAGS := $(art_target_non_debug_cflags) |
| 376 | ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) |
| 377 | ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags) |
| 378 | |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 379 | ifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA |
| 380 | LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA=-0x1000000 |
| 381 | endif |
| 382 | ifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA |
| 383 | LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA=0x1000000 |
| 384 | endif |
| 385 | ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA) |
| 386 | ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA) |
| 387 | |
| 388 | ifndef LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA |
| 389 | LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA=-0x1000000 |
| 390 | endif |
| 391 | ifndef LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA |
| 392 | LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA=0x1000000 |
| 393 | endif |
| 394 | ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA) |
| 395 | ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA) |
| 396 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 397 | # To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16" |
| 398 | # ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs |
| 399 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 400 | # Clear locals now they've served their purpose. |
| 401 | art_cflags := |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 402 | art_asflags := |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 403 | art_host_cflags := |
| 404 | art_target_cflags := |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 405 | art_debug_cflags := |
| 406 | art_non_debug_cflags := |
| 407 | art_host_non_debug_cflags := |
| 408 | art_target_non_debug_cflags := |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 409 | art_default_gc_type_cflags := |
| 410 | |
| 411 | ART_HOST_LDLIBS := |
| 412 | ifneq ($(ART_HOST_CLANG),true) |
| 413 | # GCC lacks libc++ assumed atomic operations, grab via libatomic. |
| 414 | ART_HOST_LDLIBS += -latomic |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 415 | endif |
| 416 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 417 | ART_TARGET_LDFLAGS := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 418 | |
| 419 | # $(1): ndebug_or_debug |
| 420 | define set-target-local-cflags-vars |
| 421 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
| 422 | LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86) |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 423 | LOCAL_ASFLAGS += $(ART_TARGET_ASFLAGS) |
Dehao Chen | 997660d | 2014-07-08 10:00:56 -0700 | [diff] [blame] | 424 | LOCAL_LDFLAGS += $(ART_TARGET_LDFLAGS) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 425 | art_target_cflags_ndebug_or_debug := $(1) |
| 426 | ifeq ($$(art_target_cflags_ndebug_or_debug),debug) |
| 427 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
| 428 | else |
| 429 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 430 | endif |
| 431 | |
Andreas Gampe | bced67d | 2015-01-07 14:35:44 -0800 | [diff] [blame] | 432 | LOCAL_CLANG_CFLAGS := $(ART_TARGET_CLANG_CFLAGS) |
Dan Albert | bc0d79b | 2015-08-17 10:14:51 -0700 | [diff] [blame] | 433 | $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH), |
Andreas Gampe | bced67d | 2015-01-07 14:35:44 -0800 | [diff] [blame] | 434 | LOCAL_CLANG_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch))) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 435 | |
| 436 | # Clear locally used variables. |
| 437 | art_target_cflags_ndebug_or_debug := |
| 438 | endef |
| 439 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 440 | # Support for disabling certain builds. |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 441 | ART_BUILD_TARGET := false |
| 442 | ART_BUILD_HOST := false |
| 443 | ART_BUILD_NDEBUG := false |
| 444 | ART_BUILD_DEBUG := false |
| 445 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 446 | ART_BUILD_TARGET := true |
| 447 | ART_BUILD_NDEBUG := true |
| 448 | endif |
| 449 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 450 | ART_BUILD_TARGET := true |
| 451 | ART_BUILD_DEBUG := true |
| 452 | endif |
| 453 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 454 | ART_BUILD_HOST := true |
| 455 | ART_BUILD_NDEBUG := true |
| 456 | endif |
| 457 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 458 | ART_BUILD_HOST := true |
| 459 | ART_BUILD_DEBUG := true |
| 460 | endif |
| 461 | |
Igor Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame] | 462 | endif # ART_ANDROID_COMMON_BUILD_MK |