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