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 | |
Roland Levillain | b5390f7 | 2016-07-04 16:59:53 +0100 | [diff] [blame] | 37 | # Set this to change what opt level ART is built at. |
Alex Light | 8069d9f | 2015-10-14 16:21:17 -0700 | [diff] [blame] | 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 | # |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 79 | # Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS. |
| 80 | # |
Hiroshi Yamauchi | 3e78162 | 2015-02-25 12:52:34 -0800 | [diff] [blame] | 81 | ART_DEFAULT_GC_TYPE ?= CMS |
| 82 | 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] | 83 | |
Colin Cross | ecf75a6 | 2016-07-28 16:01:42 -0700 | [diff] [blame^] | 84 | ART_HOST_CLANG := true |
| 85 | ART_TARGET_CLANG := true |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 86 | |
| 87 | ART_CPP_EXTENSION := .cc |
| 88 | |
| 89 | ART_C_INCLUDES := \ |
| 90 | external/gtest/include \ |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 91 | external/icu/icu4c/source/common \ |
Mathieu Chartier | ceb07b3 | 2015-12-10 09:33:21 -0800 | [diff] [blame] | 92 | external/lz4/lib \ |
Dmitriy Ivanov | 6130f73 | 2015-05-27 15:34:38 -0700 | [diff] [blame] | 93 | external/valgrind/include \ |
| 94 | external/valgrind \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 95 | external/vixl/src \ |
| 96 | external/zlib \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 97 | |
Andreas Gampe | 4382f1e | 2015-08-05 01:08:53 +0000 | [diff] [blame] | 98 | # We optimize Thread::Current() with a direct TLS access. This requires access to a private |
| 99 | # Bionic header. |
| 100 | # Note: technically we only need this on device, but this avoids the duplication of the includes. |
| 101 | ART_C_INCLUDES += bionic/libc/private |
| 102 | |
Colin Cross | ecf75a6 | 2016-07-28 16:01:42 -0700 | [diff] [blame^] | 103 | art_cflags := |
| 104 | |
| 105 | # Warn about thread safety violations with clang. |
| 106 | art_cflags += -Wthread-safety -Wthread-safety-negative |
| 107 | |
| 108 | # Warn if switch fallthroughs aren't annotated. |
| 109 | art_cflags += -Wimplicit-fallthrough |
| 110 | |
| 111 | # Enable float equality warnings. |
| 112 | art_cflags += -Wfloat-equal |
| 113 | |
| 114 | # Enable warning of converting ints to void*. |
| 115 | art_cflags += -Wint-to-void-pointer-cast |
| 116 | |
| 117 | # Enable warning of wrong unused annotations. |
| 118 | art_cflags += -Wused-but-marked-unused |
| 119 | |
| 120 | # Enable warning for deprecated language features. |
| 121 | art_cflags += -Wdeprecated |
| 122 | |
| 123 | # Enable warning for unreachable break & return. |
| 124 | art_cflags += -Wunreachable-code-break -Wunreachable-code-return |
| 125 | |
| 126 | # Bug: http://b/29823425 Disable -Wconstant-conversion and |
| 127 | # -Wundefined-var-template for Clang update to r271374 |
| 128 | art_cflags += -Wno-constant-conversion -Wno-undefined-var-template |
| 129 | |
| 130 | # Enable missing-noreturn only on non-Mac. As lots of things are not implemented for Apple, it's |
| 131 | # a pain. |
| 132 | ifneq ($(HOST_OS),darwin) |
| 133 | art_cflags += -Wmissing-noreturn |
| 134 | endif |
| 135 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 136 | # Base set of cflags used by all things ART. |
Colin Cross | ecf75a6 | 2016-07-28 16:01:42 -0700 | [diff] [blame^] | 137 | art_cflags += \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 138 | -fno-rtti \ |
| 139 | -std=gnu++11 \ |
| 140 | -ggdb3 \ |
| 141 | -Wall \ |
| 142 | -Werror \ |
| 143 | -Wextra \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 144 | -Wstrict-aliasing \ |
| 145 | -fstrict-aliasing \ |
| 146 | -Wunreachable-code \ |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 147 | -Wredundant-decls \ |
| 148 | -Wshadow \ |
Andreas Gampe | 7c3952f | 2015-02-19 18:21:24 -0800 | [diff] [blame] | 149 | -Wunused \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 150 | -fvisibility=protected \ |
| 151 | $(art_default_gc_type_cflags) |
| 152 | |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 153 | # The architectures the compiled tools are able to run on. Setting this to 'all' will cause all |
| 154 | # architectures to be included. |
| 155 | ART_TARGET_CODEGEN_ARCHS ?= all |
| 156 | ART_HOST_CODEGEN_ARCHS ?= all |
| 157 | |
| 158 | ifeq ($(ART_TARGET_CODEGEN_ARCHS),all) |
| 159 | ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH)) |
| 160 | # We need to handle the fact that some compiler tests mix code from different architectures. |
| 161 | ART_TARGET_COMPILER_TESTS ?= true |
| 162 | else |
| 163 | ART_TARGET_COMPILER_TESTS := false |
| 164 | ifeq ($(ART_TARGET_CODEGEN_ARCHS),svelte) |
| 165 | ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_ARCH_64) $(ART_TARGET_ARCH_32)) |
| 166 | endif |
| 167 | endif |
| 168 | ifeq ($(ART_HOST_CODEGEN_ARCHS),all) |
| 169 | ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_SUPPORTED_ARCH) $(ART_HOST_SUPPORTED_ARCH)) |
| 170 | ART_HOST_COMPILER_TESTS ?= true |
| 171 | else |
| 172 | ART_HOST_COMPILER_TESTS := false |
| 173 | ifeq ($(ART_HOST_CODEGEN_ARCHS),svelte) |
| 174 | ART_HOST_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS) $(ART_HOST_ARCH_64) $(ART_HOST_ARCH_32)) |
| 175 | endif |
| 176 | endif |
| 177 | |
| 178 | ifneq (,$(filter arm64,$(ART_TARGET_CODEGEN_ARCHS))) |
| 179 | ART_TARGET_CODEGEN_ARCHS += arm |
| 180 | endif |
| 181 | ifneq (,$(filter mips64,$(ART_TARGET_CODEGEN_ARCHS))) |
| 182 | ART_TARGET_CODEGEN_ARCHS += mips |
| 183 | endif |
| 184 | ifneq (,$(filter x86_64,$(ART_TARGET_CODEGEN_ARCHS))) |
| 185 | ART_TARGET_CODEGEN_ARCHS += x86 |
| 186 | endif |
| 187 | ART_TARGET_CODEGEN_ARCHS := $(sort $(ART_TARGET_CODEGEN_ARCHS)) |
| 188 | ifneq (,$(filter arm64,$(ART_HOST_CODEGEN_ARCHS))) |
| 189 | ART_HOST_CODEGEN_ARCHS += arm |
| 190 | endif |
| 191 | ifneq (,$(filter mips64,$(ART_HOST_CODEGEN_ARCHS))) |
| 192 | ART_HOST_CODEGEN_ARCHS += mips |
| 193 | endif |
| 194 | ifneq (,$(filter x86_64,$(ART_HOST_CODEGEN_ARCHS))) |
| 195 | ART_HOST_CODEGEN_ARCHS += x86 |
| 196 | endif |
| 197 | ART_HOST_CODEGEN_ARCHS := $(sort $(ART_HOST_CODEGEN_ARCHS)) |
| 198 | |
| 199 | # Base set of cflags used by target build only |
| 200 | art_target_cflags := \ |
| 201 | $(foreach target_arch,$(strip $(ART_TARGET_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(target_arch)) |
| 202 | # Base set of cflags used by host build only |
| 203 | art_host_cflags := \ |
| 204 | $(foreach host_arch,$(strip $(ART_HOST_CODEGEN_ARCHS)), -DART_ENABLE_CODEGEN_$(host_arch)) |
| 205 | |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 206 | # Base set of asflags used by all things ART. |
| 207 | art_asflags := |
| 208 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 209 | # Missing declarations: too many at the moment, as we use "extern" quite a bit. |
| 210 | # -Wmissing-declarations \ |
| 211 | |
| 212 | |
Mathieu Chartier | cd195fe | 2014-11-25 18:36:01 -0800 | [diff] [blame] | 213 | |
| 214 | ifdef ART_IMT_SIZE |
| 215 | art_cflags += -DIMT_SIZE=$(ART_IMT_SIZE) |
| 216 | else |
Matthew Gharrity | 013e3f3 | 2016-06-16 11:49:23 -0700 | [diff] [blame] | 217 | # Default is 43 |
| 218 | art_cflags += -DIMT_SIZE=43 |
Mathieu Chartier | cd195fe | 2014-11-25 18:36:01 -0800 | [diff] [blame] | 219 | endif |
| 220 | |
Hiroshi Yamauchi | b0d22f1 | 2014-12-08 12:08:46 -0800 | [diff] [blame] | 221 | ifeq ($(ART_HEAP_POISONING),true) |
| 222 | art_cflags += -DART_HEAP_POISONING=1 |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 223 | art_asflags += -DART_HEAP_POISONING=1 |
Hiroshi Yamauchi | b0d22f1 | 2014-12-08 12:08:46 -0800 | [diff] [blame] | 224 | endif |
| 225 | |
Hiroshi Yamauchi | 2e28775 | 2015-10-02 13:41:34 -0700 | [diff] [blame] | 226 | # |
| 227 | # Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP. |
| 228 | # The default is BAKER. |
| 229 | # |
| 230 | ART_READ_BARRIER_TYPE ?= BAKER |
| 231 | |
Hiroshi Yamauchi | c23f0d8 | 2015-01-23 17:23:42 -0800 | [diff] [blame] | 232 | ifeq ($(ART_USE_READ_BARRIER),true) |
| 233 | art_cflags += -DART_USE_READ_BARRIER=1 |
Hiroshi Yamauchi | 2e28775 | 2015-10-02 13:41:34 -0700 | [diff] [blame] | 234 | art_cflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1 |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 235 | art_asflags += -DART_USE_READ_BARRIER=1 |
Hiroshi Yamauchi | 2e28775 | 2015-10-02 13:41:34 -0700 | [diff] [blame] | 236 | art_asflags += -DART_READ_BARRIER_TYPE_IS_$(ART_READ_BARRIER_TYPE)=1 |
Hiroshi Yamauchi | 37ba27a | 2016-01-26 14:06:14 -0800 | [diff] [blame] | 237 | |
| 238 | # Temporarily override -fstack-protector-strong with -fstack-protector to avoid a major |
| 239 | # slowdown with the read barrier config. b/26744236. |
| 240 | art_cflags += -fstack-protector |
Hiroshi Yamauchi | c23f0d8 | 2015-01-23 17:23:42 -0800 | [diff] [blame] | 241 | endif |
| 242 | |
Hiroshi Yamauchi | 79bd2bf | 2015-03-20 10:28:34 -0700 | [diff] [blame] | 243 | ifeq ($(ART_USE_TLAB),true) |
| 244 | art_cflags += -DART_USE_TLAB=1 |
| 245 | endif |
| 246 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 247 | # Cflags for non-debug ART and ART tools. |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 248 | art_non_debug_cflags := \ |
Alex Light | 8069d9f | 2015-10-14 16:21:17 -0700 | [diff] [blame] | 249 | $(ART_NDEBUG_OPT_FLAG) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 250 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 251 | # Cflags for debug ART and ART tools. |
| 252 | art_debug_cflags := \ |
Alex Light | 8069d9f | 2015-10-14 16:21:17 -0700 | [diff] [blame] | 253 | $(ART_DEBUG_OPT_FLAG) \ |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 254 | -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ |
Ian Rogers | 50fe6da | 2014-10-17 01:18:08 -0700 | [diff] [blame] | 255 | -UNDEBUG |
Stephen Hines | 67a4338 | 2014-07-17 01:49:18 -0700 | [diff] [blame] | 256 | |
Roland Levillain | b5390f7 | 2016-07-04 16:59:53 +0100 | [diff] [blame] | 257 | # Assembler flags for non-debug ART and ART tools. |
| 258 | art_non_debug_asflags := |
| 259 | |
| 260 | # Assembler flags for debug ART and ART tools. |
| 261 | art_debug_asflags := -UNDEBUG |
| 262 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 263 | art_host_non_debug_cflags := $(art_non_debug_cflags) |
| 264 | art_target_non_debug_cflags := $(art_non_debug_cflags) |
Stephen Hines | 67a4338 | 2014-07-17 01:49:18 -0700 | [diff] [blame] | 265 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 266 | ifeq ($(HOST_OS),linux) |
Stephen Hines | 67a4338 | 2014-07-17 01:49:18 -0700 | [diff] [blame] | 267 | # Larger frame-size for host clang builds today |
Dan Albert | 31fb260 | 2014-09-30 22:10:10 -0700 | [diff] [blame] | 268 | ifneq ($(ART_COVERAGE),true) |
| 269 | ifneq ($(NATIVE_COVERAGE),true) |
Evgenii Stepanov | 1e13374 | 2015-05-20 12:30:59 -0700 | [diff] [blame] | 270 | art_host_non_debug_cflags += -Wframe-larger-than=2700 |
| 271 | ifdef SANITIZE_TARGET |
Ivan Krasin | f54cde6 | 2015-09-02 11:34:36 -0700 | [diff] [blame] | 272 | art_target_non_debug_cflags += -Wframe-larger-than=6400 |
Evgenii Stepanov | 1e13374 | 2015-05-20 12:30:59 -0700 | [diff] [blame] | 273 | else |
Brian Carlstrom | a06481e | 2016-06-08 23:48:27 -0700 | [diff] [blame] | 274 | art_target_non_debug_cflags += -Wframe-larger-than=1736 |
Evgenii Stepanov | e1b6e97 | 2015-06-15 15:55:22 -0700 | [diff] [blame] | 275 | endif |
Dan Albert | 31fb260 | 2014-09-30 22:10:10 -0700 | [diff] [blame] | 276 | endif |
Dan Albert | 98b8bcf | 2014-11-14 19:56:21 -0800 | [diff] [blame] | 277 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 278 | endif |
| 279 | |
Colin Cross | ecf75a6 | 2016-07-28 16:01:42 -0700 | [diff] [blame^] | 280 | ART_HOST_CFLAGS := $(art_cflags) |
| 281 | ART_TARGET_CFLAGS := $(art_cflags) |
| 282 | |
| 283 | ART_HOST_ASFLAGS := $(art_asflags) |
| 284 | ART_TARGET_ASFLAGS := $(art_asflags) |
| 285 | |
| 286 | # Bug: 15446488. We don't omit the frame pointer to work around |
| 287 | # clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. |
| 288 | ART_HOST_CFLAGS += -fno-omit-frame-pointer |
| 289 | |
Ying Wang | a28ff0f | 2014-12-08 14:29:34 -0800 | [diff] [blame] | 290 | ifndef LIBART_IMG_HOST_BASE_ADDRESS |
| 291 | $(error LIBART_IMG_HOST_BASE_ADDRESS unset) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 292 | endif |
Colin Cross | ecf75a6 | 2016-07-28 16:01:42 -0700 | [diff] [blame^] | 293 | ART_HOST_CFLAGS += -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS) |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 294 | ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default $(art_host_cflags) |
Ying Wang | a28ff0f | 2014-12-08 14:29:34 -0800 | [diff] [blame] | 295 | |
| 296 | ifndef LIBART_IMG_TARGET_BASE_ADDRESS |
| 297 | $(error LIBART_IMG_TARGET_BASE_ADDRESS unset) |
| 298 | endif |
Bilyan Borisov | 3071f80 | 2016-03-31 17:15:53 +0100 | [diff] [blame] | 299 | |
Colin Cross | ecf75a6 | 2016-07-28 16:01:42 -0700 | [diff] [blame^] | 300 | ART_TARGET_CFLAGS += -DART_TARGET \ |
Bilyan Borisov | 3071f80 | 2016-03-31 17:15:53 +0100 | [diff] [blame] | 301 | -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ |
| 302 | |
| 303 | ifeq ($(ART_TARGET_LINUX),true) |
| 304 | # Setting ART_TARGET_LINUX to true compiles art/ assuming that the target device |
| 305 | # will be running linux rather than android. |
| 306 | ART_TARGET_CFLAGS += -DART_TARGET_LINUX |
| 307 | else |
Bilyan Borisov | bb661c0 | 2016-04-04 16:27:32 +0100 | [diff] [blame] | 308 | # The ART_TARGET_ANDROID macro is passed to target builds, which check |
| 309 | # against it instead of against __ANDROID__ (which is provided by target |
| 310 | # toolchains). |
Bilyan Borisov | 3071f80 | 2016-03-31 17:15:53 +0100 | [diff] [blame] | 311 | ART_TARGET_CFLAGS += -DART_TARGET_ANDROID |
| 312 | endif |
Bilyan Borisov | bb661c0 | 2016-04-04 16:27:32 +0100 | [diff] [blame] | 313 | |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 314 | ART_TARGET_CFLAGS += $(art_target_cflags) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 315 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 316 | ART_HOST_NON_DEBUG_CFLAGS := $(art_host_non_debug_cflags) |
| 317 | ART_TARGET_NON_DEBUG_CFLAGS := $(art_target_non_debug_cflags) |
| 318 | ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) |
| 319 | ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags) |
| 320 | |
Roland Levillain | b5390f7 | 2016-07-04 16:59:53 +0100 | [diff] [blame] | 321 | ART_HOST_NON_DEBUG_ASFLAGS := $(art_non_debug_asflags) |
| 322 | ART_TARGET_NON_DEBUG_ASFLAGS := $(art_non_debug_asflags) |
| 323 | ART_HOST_DEBUG_ASFLAGS := $(art_debug_asflags) |
| 324 | ART_TARGET_DEBUG_ASFLAGS := $(art_debug_asflags) |
| 325 | |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 326 | ifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA |
| 327 | LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA=-0x1000000 |
| 328 | endif |
| 329 | ifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA |
| 330 | LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA=0x1000000 |
| 331 | endif |
| 332 | ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA) |
| 333 | ART_HOST_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA) |
| 334 | |
| 335 | ifndef LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA |
| 336 | LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA=-0x1000000 |
| 337 | endif |
| 338 | ifndef LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA |
| 339 | LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA=0x1000000 |
| 340 | endif |
| 341 | ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA) |
| 342 | ART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA) |
| 343 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 344 | # To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16" |
| 345 | # ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs |
| 346 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 347 | # Clear locals now they've served their purpose. |
| 348 | art_cflags := |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 349 | art_asflags := |
Alex Light | 50fa993 | 2015-08-10 15:30:07 -0700 | [diff] [blame] | 350 | art_host_cflags := |
| 351 | art_target_cflags := |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 352 | art_debug_cflags := |
| 353 | art_non_debug_cflags := |
Roland Levillain | b5390f7 | 2016-07-04 16:59:53 +0100 | [diff] [blame] | 354 | art_debug_asflags := |
| 355 | art_non_debug_asflags := |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 356 | art_host_non_debug_cflags := |
| 357 | art_target_non_debug_cflags := |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 358 | art_default_gc_type_cflags := |
| 359 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 360 | ART_TARGET_LDFLAGS := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 361 | |
| 362 | # $(1): ndebug_or_debug |
| 363 | define set-target-local-cflags-vars |
| 364 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
Roland Levillain | 12bd721 | 2015-06-04 17:50:27 +0100 | [diff] [blame] | 365 | LOCAL_ASFLAGS += $(ART_TARGET_ASFLAGS) |
Dehao Chen | 997660d | 2014-07-08 10:00:56 -0700 | [diff] [blame] | 366 | LOCAL_LDFLAGS += $(ART_TARGET_LDFLAGS) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 367 | art_target_cflags_ndebug_or_debug := $(1) |
| 368 | ifeq ($$(art_target_cflags_ndebug_or_debug),debug) |
| 369 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
Roland Levillain | b5390f7 | 2016-07-04 16:59:53 +0100 | [diff] [blame] | 370 | LOCAL_ASFLAGS += $(ART_TARGET_DEBUG_ASFLAGS) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 371 | else |
| 372 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
Roland Levillain | b5390f7 | 2016-07-04 16:59:53 +0100 | [diff] [blame] | 373 | LOCAL_ASFLAGS += $(ART_TARGET_NON_DEBUG_ASFLAGS) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 374 | endif |
| 375 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 376 | # Clear locally used variables. |
| 377 | art_target_cflags_ndebug_or_debug := |
| 378 | endef |
| 379 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 380 | # Support for disabling certain builds. |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 381 | ART_BUILD_TARGET := false |
| 382 | ART_BUILD_HOST := false |
| 383 | ART_BUILD_NDEBUG := false |
| 384 | ART_BUILD_DEBUG := false |
| 385 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 386 | ART_BUILD_TARGET := true |
| 387 | ART_BUILD_NDEBUG := true |
| 388 | endif |
| 389 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 390 | ART_BUILD_TARGET := true |
| 391 | ART_BUILD_DEBUG := true |
| 392 | endif |
| 393 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 394 | ART_BUILD_HOST := true |
| 395 | ART_BUILD_NDEBUG := true |
| 396 | endif |
| 397 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 398 | ART_BUILD_HOST := true |
| 399 | ART_BUILD_DEBUG := true |
| 400 | endif |
| 401 | |
Igor Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame] | 402 | endif # ART_ANDROID_COMMON_BUILD_MK |