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 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 20 | # These can be overridden via the environment or by editing to |
| 21 | # enable/disable certain build configuration. |
| 22 | # |
| 23 | # For example, to disable everything but the host debug build you use: |
| 24 | # |
| 25 | # (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...) |
| 26 | # |
| 27 | # Beware that tests may use the non-debug build for performance, notable 055-enum-performance |
| 28 | # |
| 29 | ART_BUILD_TARGET_NDEBUG ?= true |
| 30 | ART_BUILD_TARGET_DEBUG ?= true |
Brian Carlstrom | 19e776c | 2013-07-23 12:16:44 -0700 | [diff] [blame] | 31 | ART_BUILD_HOST_NDEBUG ?= $(WITH_HOST_DALVIK) |
| 32 | ART_BUILD_HOST_DEBUG ?= $(WITH_HOST_DALVIK) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 33 | |
| 34 | ifeq ($(ART_BUILD_TARGET_NDEBUG),false) |
| 35 | $(info Disabling ART_BUILD_TARGET_NDEBUG) |
| 36 | endif |
| 37 | ifeq ($(ART_BUILD_TARGET_DEBUG),false) |
| 38 | $(info Disabling ART_BUILD_TARGET_DEBUG) |
| 39 | endif |
| 40 | ifeq ($(ART_BUILD_HOST_NDEBUG),false) |
| 41 | $(info Disabling ART_BUILD_HOST_NDEBUG) |
| 42 | endif |
| 43 | ifeq ($(ART_BUILD_HOST_DEBUG),false) |
| 44 | $(info Disabling ART_BUILD_HOST_DEBUG) |
| 45 | endif |
| 46 | |
| 47 | # |
| 48 | # Used to enable smart mode |
| 49 | # |
Anwar Ghuloum | 8447d84 | 2013-04-30 17:27:40 -0700 | [diff] [blame] | 50 | ART_SMALL_MODE := false |
| 51 | ifneq ($(wildcard art/SMALL_ART),) |
| 52 | $(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART) |
| 53 | ART_SMALL_MODE := true |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 54 | endif |
Anwar Ghuloum | a72dd8b | 2013-06-03 17:01:15 -0700 | [diff] [blame] | 55 | ifeq ($(WITH_ART_SMALL_MODE), true) |
| 56 | ART_SMALL_MODE := true |
| 57 | endif |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 58 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 59 | # |
| 60 | # Used to enable SEA mode |
| 61 | # |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 62 | ART_SEA_IR_MODE := false |
| 63 | ifneq ($(wildcard art/SEA_IR_ART),) |
| 64 | $(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART) |
| 65 | ART_SEA_IR_MODE := true |
| 66 | endif |
| 67 | ifeq ($(WITH_ART_SEA_IR_MODE), true) |
| 68 | ART_SEA_IR_MODE := true |
| 69 | endif |
| 70 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 71 | # |
| 72 | # Used to enable portable mode |
| 73 | # |
Brian Carlstrom | 06809ed | 2012-09-17 14:19:20 -0700 | [diff] [blame] | 74 | ART_USE_PORTABLE_COMPILER := false |
| 75 | ifneq ($(wildcard art/USE_PORTABLE_COMPILER),) |
| 76 | $(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER) |
| 77 | ART_USE_PORTABLE_COMPILER := true |
| 78 | endif |
| 79 | ifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true) |
| 80 | $(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true) |
| 81 | ART_USE_PORTABLE_COMPILER := true |
| 82 | endif |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 83 | |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 84 | LLVM_ROOT_PATH := external/llvm |
Ying Wang | d910172 | 2013-09-18 09:36:27 -0700 | [diff] [blame] | 85 | # Don't fail a dalvik minimal host build. |
| 86 | -include $(LLVM_ROOT_PATH)/llvm.mk |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 87 | |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 88 | # Clang build. |
| 89 | # ART_TARGET_CLANG := true |
| 90 | # ART_HOST_CLANG := true |
| 91 | |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 92 | # directory used for gtests on device |
| 93 | ART_NATIVETEST_DIR := /data/nativetest/art |
| 94 | ART_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art |
| 95 | |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 96 | # directory used for tests on device |
| 97 | ART_TEST_DIR := /data/art-test |
| 98 | ART_TEST_OUT := $(TARGET_OUT_DATA)/art-test |
| 99 | |
Brian Carlstrom | cdc8de4 | 2011-07-19 14:23:17 -0700 | [diff] [blame] | 100 | ART_CPP_EXTENSION := .cc |
Carl Shapiro | 9bf84fd | 2011-06-17 17:05:25 -0700 | [diff] [blame] | 101 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 102 | ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX) |
| 103 | ART_HOST_SHLIB_EXTENSION ?= .so |
| 104 | |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 105 | ART_C_INCLUDES := \ |
| 106 | external/gtest/include \ |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 107 | external/valgrind/main/include \ |
Mathieu Chartier | 75165d0 | 2013-09-12 14:00:31 -0700 | [diff] [blame] | 108 | external/valgrind/main \ |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 109 | external/zlib \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 110 | frameworks/compile/mclinker/include |
Brian Carlstrom | b0460ea | 2011-07-29 10:08:05 -0700 | [diff] [blame] | 111 | |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 112 | art_cflags := \ |
Ian Rogers | 637c65b | 2013-05-31 11:46:00 -0700 | [diff] [blame] | 113 | -fno-rtti \ |
Mathieu Chartier | 9b3c3cd | 2013-08-12 17:41:54 -0700 | [diff] [blame] | 114 | -std=gnu++11 \ |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 115 | -ggdb3 \ |
| 116 | -Wall \ |
| 117 | -Werror \ |
| 118 | -Wextra \ |
Elliott Hughes | eaa200d | 2012-01-05 16:30:31 -0800 | [diff] [blame] | 119 | -Wstrict-aliasing=3 \ |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 120 | -fstrict-aliasing |
| 121 | |
Anwar Ghuloum | c44f68f | 2013-05-10 13:24:54 -0700 | [diff] [blame] | 122 | ifeq ($(ART_SMALL_MODE),true) |
| 123 | art_cflags += -DART_SMALL_MODE=1 |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 124 | endif |
| 125 | |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 126 | ifeq ($(ART_SEA_IR_MODE),true) |
| 127 | art_cflags += -DART_SEA_IR_MODE=1 |
| 128 | endif |
| 129 | |
Brian Carlstrom | 69d7a6b | 2011-12-15 17:31:21 -0800 | [diff] [blame] | 130 | ifeq ($(HOST_OS),linux) |
Shih-wei Liao | 24782c6 | 2012-01-08 12:46:11 -0800 | [diff] [blame] | 131 | art_non_debug_cflags := \ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 132 | -Wframe-larger-than=1728 |
Brian Carlstrom | 69d7a6b | 2011-12-15 17:31:21 -0800 | [diff] [blame] | 133 | endif |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 134 | |
Ian Rogers | 8d11af5 | 2013-08-15 14:24:29 -0700 | [diff] [blame] | 135 | art_non_debug_cflags := \ |
| 136 | -O3 |
| 137 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 138 | art_debug_cflags := \ |
Ian Rogers | 8d11af5 | 2013-08-15 14:24:29 -0700 | [diff] [blame] | 139 | -O1 \ |
Elliott Hughes | 06e3ad4 | 2012-02-07 14:51:57 -0800 | [diff] [blame] | 140 | -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 141 | -UNDEBUG |
| 142 | |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 143 | # start of image reserved address space |
| 144 | IMG_HOST_BASE_ADDRESS := 0x60000000 |
| 145 | |
| 146 | ifeq ($(TARGET_ARCH),mips) |
| 147 | IMG_TARGET_BASE_ADDRESS := 0x30000000 |
| 148 | else |
| 149 | IMG_TARGET_BASE_ADDRESS := 0x60000000 |
| 150 | endif |
| 151 | |
Brian Carlstrom | 1bd2ceb | 2013-11-06 00:29:48 -0800 | [diff] [blame] | 152 | ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(IMG_HOST_BASE_ADDRESS) |
| 153 | ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 154 | |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 155 | ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(IMG_TARGET_BASE_ADDRESS) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 156 | ifeq ($(TARGET_CPU_SMP),true) |
| 157 | ART_TARGET_CFLAGS += -DANDROID_SMP=1 |
| 158 | else |
| 159 | ART_TARGET_CFLAGS += -DANDROID_SMP=0 |
| 160 | endif |
| 161 | |
Brian Carlstrom | 1bd2ceb | 2013-11-06 00:29:48 -0800 | [diff] [blame] | 162 | # DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is set in ../build/core/dex_preopt.mk based on |
| 163 | # the TARGET_CPU_VARIANT |
| 164 | ifeq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) |
| 165 | $(error Required DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is not set) |
| 166 | endif |
| 167 | ART_TARGET_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) |
| 168 | |
| 169 | ifeq ($(TARGET_ARCH),x86) |
| 170 | ART_TARGET_CFLAGS += -msse2 |
| 171 | endif |
| 172 | |
Ian Rogers | ba3ce9a | 2013-05-17 18:50:09 -0700 | [diff] [blame] | 173 | # Enable thread-safety for GCC 4.6 on the target but not for GCC 4.7 where this feature was removed. |
| 174 | ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),) |
| 175 | ART_TARGET_CFLAGS += -Wthread-safety |
| 176 | else |
| 177 | # Warn if not using GCC 4.6 for target builds when not doing a top-level or 'mma' build. |
| 178 | ifneq ($(ONE_SHOT_MAKEFILE),) |
Dragos Sbirlea | 37c19bc | 2013-07-29 09:38:31 -0700 | [diff] [blame] | 179 | # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6 |
| 180 | $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.) |
Ian Rogers | ba3ce9a | 2013-05-17 18:50:09 -0700 | [diff] [blame] | 181 | endif |
| 182 | endif |
| 183 | # We build with GCC 4.6 on the host. |
| 184 | ART_HOST_CFLAGS += -Wthread-safety |
| 185 | |
Ian Rogers | f89eccd | 2013-05-30 10:50:43 -0700 | [diff] [blame] | 186 | # Make host builds easier to debug and profile by not omitting the frame pointer. |
| 187 | ART_HOST_CFLAGS += -fno-omit-frame-pointer |
| 188 | |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 189 | # To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16" |
| 190 | # ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs |
| 191 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 192 | ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags) |
| 193 | ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags) |
| 194 | |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 195 | # 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] | 196 | ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 197 | ART_HOST_DEBUG_LDLIBS := -lsupc++ |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 198 | |
| 199 | ifneq ($(HOST_OS),linux) |
| 200 | # Some Mac OS pthread header files are broken with -fkeep-inline-functions. |
Elliott Hughes | 34cf514 | 2012-01-20 16:39:13 -0800 | [diff] [blame] | 201 | 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] | 202 | # Mac OS doesn't have libsupc++. |
| 203 | ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS)) |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 204 | endif |
| 205 | |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 206 | ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 207 | |
Ian Rogers | c928de9 | 2013-02-27 14:30:44 -0800 | [diff] [blame] | 208 | ifeq ($(ART_USE_PORTABLE_COMPILER),true) |
TDYa127 | 58e63f9 | 2012-04-24 13:16:47 -0700 | [diff] [blame] | 209 | PARALLEL_ART_COMPILE_JOBS := -j8 |
| 210 | endif |
| 211 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 212 | ART_BUILD_TARGET := false |
| 213 | ART_BUILD_HOST := false |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 214 | ART_BUILD_NDEBUG := false |
| 215 | ART_BUILD_DEBUG := false |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 216 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 217 | ART_BUILD_TARGET := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 218 | ART_BUILD_NDEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 219 | endif |
| 220 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 221 | ART_BUILD_TARGET := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 222 | ART_BUILD_DEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 223 | endif |
| 224 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 225 | ART_BUILD_HOST := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 226 | ART_BUILD_NDEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 227 | endif |
| 228 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 229 | ART_BUILD_HOST := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 230 | ART_BUILD_DEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 231 | endif |
Dragos Sbirlea | 37c19bc | 2013-07-29 09:38:31 -0700 | [diff] [blame] | 232 | |
| 233 | endif # ANDROID_COMMON_MK |