Carl Shapiro | 7b21670 | 2011-06-17 15:09:26 -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 | |
Dragos Sbirlea | 37c19bc | 2013-07-29 09:38:31 -0700 | [diff] [blame] | 17 | ifndef ANDROID_COMMON_MK |
| 18 | ANDROID_COMMON_MK = true |
| 19 | |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 20 | ART_SUPPORTED_ARCH := arm arm64 mips x86 x86_64 |
Colin Cross | dc781a1 | 2014-02-04 16:22:03 -0800 | [diff] [blame] | 21 | |
| 22 | ifeq (,$(filter $(TARGET_ARCH),$(ART_SUPPORTED_ARCH))) |
| 23 | $(warning unsupported TARGET_ARCH=$(TARGET_ARCH)) |
| 24 | endif |
| 25 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 26 | # These can be overridden via the environment or by editing to |
| 27 | # enable/disable certain build configuration. |
| 28 | # |
| 29 | # For example, to disable everything but the host debug build you use: |
| 30 | # |
| 31 | # (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...) |
| 32 | # |
| 33 | # Beware that tests may use the non-debug build for performance, notable 055-enum-performance |
| 34 | # |
| 35 | ART_BUILD_TARGET_NDEBUG ?= true |
| 36 | ART_BUILD_TARGET_DEBUG ?= true |
Brian Carlstrom | 19e776c | 2013-07-23 12:16:44 -0700 | [diff] [blame] | 37 | ART_BUILD_HOST_NDEBUG ?= $(WITH_HOST_DALVIK) |
| 38 | ART_BUILD_HOST_DEBUG ?= $(WITH_HOST_DALVIK) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 39 | |
Brian Carlstrom | afdc560 | 2014-06-10 15:42:52 -0700 | [diff] [blame^] | 40 | ifeq ($(HOST_PREFER_32_BIT),true) |
| 41 | ART_HOST_ARCH := $(HOST_2ND_ARCH) |
| 42 | else |
Ying Wang | c6585b7 | 2014-04-23 18:19:44 -0700 | [diff] [blame] | 43 | ART_HOST_ARCH := $(HOST_ARCH) |
Brian Carlstrom | afdc560 | 2014-06-10 15:42:52 -0700 | [diff] [blame^] | 44 | endif |
Andreas Gampe | 922141a | 2014-03-12 10:59:26 -0700 | [diff] [blame] | 45 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 46 | ifeq ($(ART_BUILD_TARGET_NDEBUG),false) |
| 47 | $(info Disabling ART_BUILD_TARGET_NDEBUG) |
| 48 | endif |
| 49 | ifeq ($(ART_BUILD_TARGET_DEBUG),false) |
| 50 | $(info Disabling ART_BUILD_TARGET_DEBUG) |
| 51 | endif |
| 52 | ifeq ($(ART_BUILD_HOST_NDEBUG),false) |
| 53 | $(info Disabling ART_BUILD_HOST_NDEBUG) |
| 54 | endif |
| 55 | ifeq ($(ART_BUILD_HOST_DEBUG),false) |
| 56 | $(info Disabling ART_BUILD_HOST_DEBUG) |
| 57 | endif |
| 58 | |
| 59 | # |
| 60 | # Used to enable smart mode |
| 61 | # |
Anwar Ghuloum | 8447d84 | 2013-04-30 17:27:40 -0700 | [diff] [blame] | 62 | ART_SMALL_MODE := false |
| 63 | ifneq ($(wildcard art/SMALL_ART),) |
| 64 | $(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART) |
| 65 | ART_SMALL_MODE := true |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 66 | endif |
Anwar Ghuloum | a72dd8b | 2013-06-03 17:01:15 -0700 | [diff] [blame] | 67 | ifeq ($(WITH_ART_SMALL_MODE), true) |
| 68 | ART_SMALL_MODE := true |
| 69 | endif |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 70 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 71 | # |
| 72 | # Used to enable SEA mode |
| 73 | # |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 74 | ART_SEA_IR_MODE := false |
| 75 | ifneq ($(wildcard art/SEA_IR_ART),) |
| 76 | $(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART) |
| 77 | ART_SEA_IR_MODE := true |
| 78 | endif |
| 79 | ifeq ($(WITH_ART_SEA_IR_MODE), true) |
| 80 | ART_SEA_IR_MODE := true |
| 81 | endif |
| 82 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 83 | # |
| 84 | # Used to enable portable mode |
| 85 | # |
Brian Carlstrom | 06809ed | 2012-09-17 14:19:20 -0700 | [diff] [blame] | 86 | ART_USE_PORTABLE_COMPILER := false |
| 87 | ifneq ($(wildcard art/USE_PORTABLE_COMPILER),) |
| 88 | $(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER) |
| 89 | ART_USE_PORTABLE_COMPILER := true |
| 90 | endif |
| 91 | ifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true) |
| 92 | $(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true) |
| 93 | ART_USE_PORTABLE_COMPILER := true |
| 94 | endif |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 95 | |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 96 | # |
| 97 | # Used to enable optimizing compiler |
| 98 | # |
| 99 | ART_USE_OPTIMIZING_COMPILER := false |
| 100 | ifneq ($(wildcard art/USE_OPTIMIZING_COMPILER),) |
| 101 | $(info Enabling ART_USE_OPTIMIZING_COMPILER because of existence of art/USE_OPTIMIZING_COMPILER) |
| 102 | ART_USE_OPTIMIZING_COMPILER := true |
| 103 | endif |
| 104 | ifeq ($(WITH_ART_USE_OPTIMIZING_COMPILER), true) |
| 105 | ART_USE_OPTIMIZING_COMPILER := true |
| 106 | endif |
| 107 | |
| 108 | ifeq ($(ART_USE_OPTIMIZING_COMPILER),true) |
| 109 | DEX2OAT_FLAGS := --compiler-backend=Optimizing |
Mathieu Chartier | 769a5ad | 2014-05-18 15:30:10 -0700 | [diff] [blame] | 110 | DALVIKVM_FLAGS += -Xcompiler-option --compiler-backend=Optimizing |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 111 | endif |
| 112 | |
Hiroshi Yamauchi | 1dda060 | 2014-05-12 12:32:32 -0700 | [diff] [blame] | 113 | # |
| 114 | # Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS. |
| 115 | # |
| 116 | ART_DEFAULT_GC_TYPE ?= CMS |
| 117 | ART_DEFAULT_GC_TYPE_CFLAGS := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE) |
| 118 | |
Ian Rogers | 28f5c09 | 2014-05-15 09:03:20 -0700 | [diff] [blame] | 119 | ifeq ($(ART_USE_PORTABLE_COMPILER),true) |
| 120 | LLVM_ROOT_PATH := external/llvm |
| 121 | # Don't fail a dalvik minimal host build. |
| 122 | -include $(LLVM_ROOT_PATH)/llvm.mk |
| 123 | endif |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 124 | |
Brian Carlstrom | 9719cd2 | 2014-03-09 14:05:04 -0700 | [diff] [blame] | 125 | # Clang build support. |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 126 | |
| 127 | # Host. |
Brian Carlstrom | 9719cd2 | 2014-03-09 14:05:04 -0700 | [diff] [blame] | 128 | ART_HOST_CLANG := false |
Ying Wang | d858c96 | 2014-03-10 18:27:10 -0700 | [diff] [blame] | 129 | ifneq ($(WITHOUT_HOST_CLANG),true) |
Brian Carlstrom | 9719cd2 | 2014-03-09 14:05:04 -0700 | [diff] [blame] | 130 | # By default, host builds use clang for better warnings. |
Ian Rogers | 35df1f3 | 2014-03-08 23:48:23 -0800 | [diff] [blame] | 131 | ART_HOST_CLANG := true |
Ian Rogers | 35df1f3 | 2014-03-08 23:48:23 -0800 | [diff] [blame] | 132 | endif |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 133 | |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 134 | # Clang on the target: only enabled for ARM64. Target builds use GCC by default. |
| 135 | ART_TARGET_CLANG := |
| 136 | ART_TARGET_CLANG_arm := |
| 137 | ART_TARGET_CLANG_arm64 := true |
| 138 | ART_TARGET_CLANG_mips := |
| 139 | ART_TARGET_CLANG_x86 := |
| 140 | ART_TARGET_CLANG_x86_64 := |
| 141 | |
| 142 | define set-target-local-clang-vars |
| 143 | LOCAL_CLANG := $(ART_TARGET_CLANG) |
| 144 | $(foreach arch,$(ART_SUPPORTED_ARCH), |
| 145 | ifneq ($$(ART_TARGET_CLANG_$(arch)),) |
| 146 | LOCAL_CLANG_$(arch) := $$(ART_TARGET_CLANG_$(arch)) |
| 147 | endif) |
| 148 | endef |
Tim Murray | a7e7c2a | 2014-04-30 14:09:31 -0700 | [diff] [blame] | 149 | |
Brian Carlstrom | b32a3ad | 2014-01-20 14:48:07 -0800 | [diff] [blame] | 150 | # directory used for dalvik-cache on device |
| 151 | ART_DALVIK_CACHE_DIR := /data/dalvik-cache |
| 152 | |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 153 | # directory used for gtests on device |
Brian Carlstrom | 0e12bdc | 2014-05-14 17:44:28 -0700 | [diff] [blame] | 154 | ART_NATIVETEST_DIR := /data/nativetest/art |
| 155 | ART_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 156 | |
Brian Carlstrom | 0e12bdc | 2014-05-14 17:44:28 -0700 | [diff] [blame] | 157 | # directory used for oat tests on device |
| 158 | ART_TEST_DIR := /data/art-test |
| 159 | ART_TEST_OUT := $(TARGET_OUT_DATA)/art-test |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 160 | |
| 161 | # Primary vs. secondary |
| 162 | 2ND_TARGET_ARCH := $(TARGET_2ND_ARCH) |
| 163 | ART_PHONY_TEST_TARGET_SUFFIX := |
| 164 | 2ND_ART_PHONY_TEST_TARGET_SUFFIX := |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 165 | ifdef TARGET_2ND_ARCH |
| 166 | art_test_primary_suffix := |
| 167 | art_test_secondary_suffix := |
| 168 | ifneq ($(filter %64,$(TARGET_ARCH)),) |
| 169 | art_test_primary_suffix := 64 |
| 170 | ART_PHONY_TEST_TARGET_SUFFIX := 64 |
| 171 | 2ND_ART_PHONY_TEST_TARGET_SUFFIX := 32 |
Brian Carlstrom | 0e12bdc | 2014-05-14 17:44:28 -0700 | [diff] [blame] | 172 | ART_TARGET_ARCH_32 := $(TARGET_2ND_ARCH) |
| 173 | ART_TARGET_ARCH_64 := $(TARGET_ARCH) |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 174 | else |
| 175 | # TODO: ??? |
| 176 | $(error Do not know what to do with this multi-target configuration!) |
| 177 | endif |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 178 | else |
Brian Carlstrom | 0e12bdc | 2014-05-14 17:44:28 -0700 | [diff] [blame] | 179 | ART_TARGET_ARCH_32 := $(TARGET_ARCH) |
| 180 | ART_TARGET_ARCH_64 := |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame] | 181 | endif |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 182 | |
Brian Carlstrom | cdc8de4 | 2011-07-19 14:23:17 -0700 | [diff] [blame] | 183 | ART_CPP_EXTENSION := .cc |
Carl Shapiro | 9bf84fd | 2011-06-17 17:05:25 -0700 | [diff] [blame] | 184 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 185 | ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX) |
| 186 | ART_HOST_SHLIB_EXTENSION ?= .so |
| 187 | |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 188 | ART_C_INCLUDES := \ |
| 189 | external/gtest/include \ |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 190 | external/valgrind/main/include \ |
Mathieu Chartier | 75165d0 | 2013-09-12 14:00:31 -0700 | [diff] [blame] | 191 | external/valgrind/main \ |
Serban Constantinescu | ed8dd49 | 2014-02-11 14:15:10 +0000 | [diff] [blame] | 192 | external/vixl/src \ |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 193 | external/zlib \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 194 | frameworks/compile/mclinker/include |
Brian Carlstrom | b0460ea | 2011-07-29 10:08:05 -0700 | [diff] [blame] | 195 | |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 196 | art_cflags := \ |
Ian Rogers | 637c65b | 2013-05-31 11:46:00 -0700 | [diff] [blame] | 197 | -fno-rtti \ |
Mathieu Chartier | 9b3c3cd | 2013-08-12 17:41:54 -0700 | [diff] [blame] | 198 | -std=gnu++11 \ |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 199 | -ggdb3 \ |
| 200 | -Wall \ |
| 201 | -Werror \ |
| 202 | -Wextra \ |
Nicolas Geoffray | f3e2cc4 | 2014-02-18 18:37:26 +0000 | [diff] [blame] | 203 | -Wno-sign-promo \ |
| 204 | -Wno-unused-parameter \ |
Mark Mendell | 3f2d031 | 2014-01-20 17:20:27 -0800 | [diff] [blame] | 205 | -Wstrict-aliasing \ |
Tim Murray | a7e7c2a | 2014-04-30 14:09:31 -0700 | [diff] [blame] | 206 | -fstrict-aliasing |
| 207 | |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 208 | ART_TARGET_CLANG_CFLAGS := |
| 209 | ART_TARGET_CLANG_CFLAGS_arm := |
| 210 | ART_TARGET_CLANG_CFLAGS_arm64 := |
| 211 | ART_TARGET_CLANG_CFLAGS_mips := |
| 212 | ART_TARGET_CLANG_CFLAGS_x86 := |
| 213 | ART_TARGET_CLANG_CFLAGS_x86_64 := |
| 214 | |
Tim Murray | a7e7c2a | 2014-04-30 14:09:31 -0700 | [diff] [blame] | 215 | # these are necessary for Clang ARM64 ART builds |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 216 | ART_TARGET_CLANG_CFLAGS_arm64 += \ |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 217 | -Wno-implicit-exception-spec-mismatch \ |
| 218 | -DNVALGRIND \ |
| 219 | -Wno-unused-value |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 220 | |
Anwar Ghuloum | c44f68f | 2013-05-10 13:24:54 -0700 | [diff] [blame] | 221 | ifeq ($(ART_SMALL_MODE),true) |
| 222 | art_cflags += -DART_SMALL_MODE=1 |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 223 | endif |
| 224 | |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 225 | ifeq ($(ART_SEA_IR_MODE),true) |
| 226 | art_cflags += -DART_SEA_IR_MODE=1 |
| 227 | endif |
| 228 | |
Ian Rogers | 8d11af5 | 2013-08-15 14:24:29 -0700 | [diff] [blame] | 229 | art_non_debug_cflags := \ |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 230 | -O3 |
| 231 | |
Sebastien Hertz | 278ff9e | 2014-05-27 15:27:58 +0200 | [diff] [blame] | 232 | ifeq ($(HOST_OS),linux) |
| 233 | art_non_debug_cflags += \ |
| 234 | -Wframe-larger-than=1728 |
| 235 | endif |
| 236 | |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 237 | # FIXME: upstream LLVM has a vectorizer bug that needs to be fixed |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 238 | ART_TARGET_CLANG_CFLAGS_arm64 += \ |
| 239 | -fno-vectorize |
Ian Rogers | 8d11af5 | 2013-08-15 14:24:29 -0700 | [diff] [blame] | 240 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 241 | art_debug_cflags := \ |
Ian Rogers | 8d11af5 | 2013-08-15 14:24:29 -0700 | [diff] [blame] | 242 | -O1 \ |
Elliott Hughes | 06e3ad4 | 2012-02-07 14:51:57 -0800 | [diff] [blame] | 243 | -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 244 | -UNDEBUG |
| 245 | |
Brian Carlstrom | 9719cd2 | 2014-03-09 14:05:04 -0700 | [diff] [blame] | 246 | ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS) |
Brian Carlstrom | 1bd2ceb | 2013-11-06 00:29:48 -0800 | [diff] [blame] | 247 | ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default |
Hiroshi Yamauchi | 1dda060 | 2014-05-12 12:32:32 -0700 | [diff] [blame] | 248 | ART_HOST_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 249 | |
Brian Carlstrom | 7ab763c | 2013-12-09 00:38:02 -0800 | [diff] [blame] | 250 | ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 251 | ifeq ($(TARGET_CPU_SMP),true) |
| 252 | ART_TARGET_CFLAGS += -DANDROID_SMP=1 |
| 253 | else |
Andreas Gampe | b14329f | 2014-05-15 11:16:06 -0700 | [diff] [blame] | 254 | ifeq ($(TARGET_CPU_SMP),false) |
| 255 | ART_TARGET_CFLAGS += -DANDROID_SMP=0 |
| 256 | else |
Andreas Gampe | ef5113d | 2014-05-15 13:54:25 -0700 | [diff] [blame] | 257 | $(warning TARGET_CPU_SMP should be (true|false), found $(TARGET_CPU_SMP)) |
| 258 | # Make sure we emit barriers for the worst case. |
| 259 | ART_TARGET_CFLAGS += -DANDROID_SMP=1 |
Andreas Gampe | b14329f | 2014-05-15 11:16:06 -0700 | [diff] [blame] | 260 | endif |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 261 | endif |
Hiroshi Yamauchi | 1dda060 | 2014-05-12 12:32:32 -0700 | [diff] [blame] | 262 | ART_TARGET_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 263 | |
Brian Carlstrom | 1bd2ceb | 2013-11-06 00:29:48 -0800 | [diff] [blame] | 264 | # DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is set in ../build/core/dex_preopt.mk based on |
| 265 | # the TARGET_CPU_VARIANT |
| 266 | ifeq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) |
| 267 | $(error Required DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is not set) |
| 268 | endif |
| 269 | ART_TARGET_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) |
| 270 | |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 271 | # Enable thread-safety for GCC 4.6, and clang, but not for GCC 4.7 or later where this feature was |
| 272 | # removed. Warn when -Wthread-safety is not used. |
Ian Rogers | ba3ce9a | 2013-05-17 18:50:09 -0700 | [diff] [blame] | 273 | ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),) |
| 274 | ART_TARGET_CFLAGS += -Wthread-safety |
| 275 | else |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 276 | # FIXME: add -Wthread-safety when the problem is fixed |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 277 | ifeq ($(ART_TARGET_CLANG),true) |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 278 | ART_TARGET_CFLAGS += |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 279 | else |
| 280 | # Warn if -Wthread-safety is not suport and not doing a top-level or 'mma' build. |
| 281 | ifneq ($(ONE_SHOT_MAKEFILE),) |
| 282 | # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6 |
| 283 | $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.) |
| 284 | endif |
Ian Rogers | ba3ce9a | 2013-05-17 18:50:09 -0700 | [diff] [blame] | 285 | endif |
| 286 | endif |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 287 | # We compile with GCC 4.6 or clang on the host, both of which support -Wthread-safety. |
Ian Rogers | ba3ce9a | 2013-05-17 18:50:09 -0700 | [diff] [blame] | 288 | ART_HOST_CFLAGS += -Wthread-safety |
| 289 | |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 290 | # To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16" |
| 291 | # ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs |
| 292 | |
Ian Rogers | a984454 | 2014-04-21 17:01:02 -0700 | [diff] [blame] | 293 | # Addition CPU specific CFLAGS. |
| 294 | ifeq ($(TARGET_ARCH),arm) |
| 295 | ifneq ($(filter cortex-a15, $(TARGET_CPU_VARIANT)),) |
| 296 | # Fake a ARM feature for LPAE support. |
| 297 | ART_TARGET_CFLAGS += -D__ARM_FEATURE_LPAE=1 |
| 298 | endif |
| 299 | endif |
| 300 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 301 | ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags) |
| 302 | ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags) |
| 303 | |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 304 | # TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4 (and -lsupc++) |
Elliott Hughes | 1ba2714 | 2012-01-20 15:32:00 -0800 | [diff] [blame] | 305 | ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 306 | ART_HOST_DEBUG_LDLIBS := -lsupc++ |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 307 | |
| 308 | ifneq ($(HOST_OS),linux) |
| 309 | # Some Mac OS pthread header files are broken with -fkeep-inline-functions. |
Elliott Hughes | 34cf514 | 2012-01-20 16:39:13 -0800 | [diff] [blame] | 310 | ART_HOST_DEBUG_CFLAGS := $(filter-out -fkeep-inline-functions,$(ART_HOST_DEBUG_CFLAGS)) |
Elliott Hughes | 6023456 | 2012-06-01 12:25:59 -0700 | [diff] [blame] | 311 | # Mac OS doesn't have libsupc++. |
| 312 | ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS)) |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 313 | endif |
| 314 | |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 315 | ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 316 | |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 317 | # $(1): ndebug_or_debug |
| 318 | define set-target-local-cflags-vars |
| 319 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
| 320 | LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86) |
| 321 | art_target_cflags_ndebug_or_debug := $(1) |
| 322 | ifeq ($$(art_target_cflags_ndebug_or_debug),debug) |
| 323 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
| 324 | else |
| 325 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 326 | endif |
| 327 | |
| 328 | # TODO: Also set when ART_TARGET_CLANG_$(arch)!=false and ART_TARGET_CLANG==true |
| 329 | $(foreach arch,$(ART_SUPPORTED_ARCH), |
| 330 | ifeq ($$(ART_TARGET_CLANG_$(arch)),true) |
| 331 | LOCAL_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch)) |
| 332 | endif) |
| 333 | endef |
| 334 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 335 | ART_BUILD_TARGET := false |
| 336 | ART_BUILD_HOST := false |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 337 | ART_BUILD_NDEBUG := false |
| 338 | ART_BUILD_DEBUG := false |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 339 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 340 | ART_BUILD_TARGET := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 341 | ART_BUILD_NDEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 342 | endif |
| 343 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 344 | ART_BUILD_TARGET := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 345 | ART_BUILD_DEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 346 | endif |
| 347 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 348 | ART_BUILD_HOST := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 349 | ART_BUILD_NDEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 350 | endif |
| 351 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 352 | ART_BUILD_HOST := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 353 | ART_BUILD_DEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 354 | endif |
Dragos Sbirlea | 37c19bc | 2013-07-29 09:38:31 -0700 | [diff] [blame] | 355 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 356 | # Helper function to call a function twice with a target suffix |
| 357 | # $(1): The generator function for the rules |
| 358 | # Has one argument, the suffix |
| 359 | define call-art-multi-target |
| 360 | $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX)) |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 361 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 362 | ifdef TARGET_2ND_ARCH |
| 363 | $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)) |
| 364 | endif |
| 365 | endef |
| 366 | |
| 367 | # Helper function to combine two variables with suffixes together. |
| 368 | # $(1): The base name. |
| 369 | define combine-art-multi-target-var |
| 370 | ifdef TARGET_2ND_ARCH |
| 371 | ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),) |
| 372 | ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),) |
| 373 | $(1) := $($(1)$(ART_PHONY_TEST_TARGET_SUFFIX)) $($(1)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)) |
| 374 | endif |
| 375 | endif |
| 376 | endif |
| 377 | endef |
| 378 | |
| 379 | |
| 380 | # Helper function to define a variable twice with a target suffix. Assume the name generated is |
| 381 | # derived from $(2) so we can create a combined var. |
| 382 | # $(1): The generator function for the rules |
| 383 | # Has one argument, the suffix |
| 384 | define call-art-multi-target-var |
| 385 | $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX)) |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 386 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 387 | ifdef TARGET_2ND_ARCH |
| 388 | $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)) |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 389 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 390 | # Link both together, if it makes sense |
| 391 | ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),) |
| 392 | ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),) |
| 393 | $(2) := $(2)$(ART_PHONY_TEST_TARGET_SUFFIX) $(2)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) |
| 394 | endif |
| 395 | endif |
| 396 | |
| 397 | endif |
| 398 | endef |
| 399 | |
| 400 | # Helper function to call a function twice with a target suffix. Assume it generates make rules |
| 401 | # with the given name, and link them. |
| 402 | # $(1): The generator function for the rules |
| 403 | # Has one argument, the suffix |
| 404 | # $(2): The base rule name, necessary for the link |
| 405 | # We assume we can link the names together easily... |
| 406 | define call-art-multi-target-rule |
| 407 | $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX)) |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 408 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 409 | ifdef TARGET_2ND_ARCH |
| 410 | $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)) |
Tim Murray | 4a0047a | 2014-04-30 13:40:58 -0700 | [diff] [blame] | 411 | |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 412 | # Link both together, if it makes sense |
| 413 | ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),) |
| 414 | ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),) |
| 415 | .PHONY: $(2) |
| 416 | $(2): $(2)$(ART_PHONY_TEST_TARGET_SUFFIX) $(2)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) |
| 417 | endif |
| 418 | endif |
| 419 | endif |
| 420 | endef |
| 421 | |
Brian Carlstrom | f662e06 | 2014-05-19 16:09:42 -0700 | [diff] [blame] | 422 | HOST_CORE_OAT := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core.oat |
| 423 | TARGET_CORE_OAT := $(ART_TEST_DIR)/$(DEX2OAT_TARGET_ARCH)/core.oat |
| 424 | ifdef TARGET_2ND_ARCH |
| 425 | 2ND_TARGET_CORE_OAT := $(2ND_ART_TEST_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.oat |
| 426 | endif |
| 427 | |
| 428 | HOST_CORE_OAT_OUT := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core.oat |
| 429 | TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/$(DEX2OAT_TARGET_ARCH)/core.oat |
| 430 | ifdef TARGET_2ND_ARCH |
| 431 | 2ND_TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.oat |
| 432 | endif |
| 433 | |
| 434 | HOST_CORE_IMG_OUT := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core.art |
| 435 | TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/$(DEX2OAT_TARGET_ARCH)/core.art |
| 436 | ifdef TARGET_2ND_ARCH |
| 437 | 2ND_TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.art |
| 438 | endif |
| 439 | |
| 440 | HOST_CORE_IMG_LOCATION := $(HOST_OUT_JAVA_LIBRARIES)/core.art |
Brian Carlstrom | 0f5baa0 | 2014-05-22 11:54:18 -0700 | [diff] [blame] | 441 | TARGET_CORE_IMG_LOCATION := $(ART_TEST_OUT)/core.art |
Andreas Gampe | 2fe0792 | 2014-04-21 07:50:39 -0700 | [diff] [blame] | 442 | |
Dragos Sbirlea | 37c19bc | 2013-07-29 09:38:31 -0700 | [diff] [blame] | 443 | endif # ANDROID_COMMON_MK |