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