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