Android.common_build.mk revision 07140838a3ee44a6056cacdc78f2930e019107da
1afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 2afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Copyright (C) 2011 The Android Open Source Project 3afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 4afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Licensed under the Apache License, Version 2.0 (the "License"); 5afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# you may not use this file except in compliance with the License. 6afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# You may obtain a copy of the License at 7afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 8afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# http://www.apache.org/licenses/LICENSE-2.0 9afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 10afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Unless required by applicable law or agreed to in writing, software 11afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# distributed under the License is distributed on an "AS IS" BASIS, 12afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# See the License for the specific language governing permissions and 14afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# limitations under the License. 15afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 16afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 17afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifndef ANDROID_COMMON_BUILD_MK 18afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersANDROID_COMMON_BUILD_MK = true 19afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 20afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersinclude art/build/Android.common.mk 21afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 22afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# These can be overridden via the environment or by editing to 23afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# enable/disable certain build configuration. 24afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 25afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# For example, to disable everything but the host debug build you use: 26afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 27afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...) 28afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 29afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Beware that tests may use the non-debug build for performance, notable 055-enum-performance 30afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 31afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_TARGET_NDEBUG ?= true 32afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_TARGET_DEBUG ?= true 33afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_HOST_NDEBUG ?= true 34afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_HOST_DEBUG ?= true 35afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 36afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_NDEBUG),false) 37afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_TARGET_NDEBUG) 38afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 39afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_DEBUG),false) 40afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_TARGET_DEBUG) 41afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 42afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_NDEBUG),false) 43afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_HOST_NDEBUG) 44afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 45afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_DEBUG),false) 46afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Disabling ART_BUILD_HOST_DEBUG) 47afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 48afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 49afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 50afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Used to enable smart mode 51afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 52afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_SMALL_MODE := false 53afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(wildcard art/SMALL_ART),) 54afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART) 55afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_SMALL_MODE := true 56afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 57afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(WITH_ART_SMALL_MODE), true) 58afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_SMALL_MODE := true 59afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 60afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 61afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 62afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Used to enable SEA mode 63afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 64afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_SEA_IR_MODE := false 65afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(wildcard art/SEA_IR_ART),) 66afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART) 67afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_SEA_IR_MODE := true 68afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 69afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(WITH_ART_SEA_IR_MODE), true) 70afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_SEA_IR_MODE := true 71afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 72afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 73afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 74afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Used to enable portable mode 75afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 76afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_USE_PORTABLE_COMPILER := false 77afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(wildcard art/USE_PORTABLE_COMPILER),) 78afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER) 79afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_USE_PORTABLE_COMPILER := true 80afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 81afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true) 82afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true) 83afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_USE_PORTABLE_COMPILER := true 84afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 85afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 86afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 87afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Used to enable optimizing compiler 88afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 89afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_USE_OPTIMIZING_COMPILER := false 90afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(wildcard art/USE_OPTIMIZING_COMPILER),) 91afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(info Enabling ART_USE_OPTIMIZING_COMPILER because of existence of art/USE_OPTIMIZING_COMPILER) 92afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_USE_OPTIMIZING_COMPILER := true 93afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 94afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(WITH_ART_USE_OPTIMIZING_COMPILER), true) 95afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_USE_OPTIMIZING_COMPILER := true 96afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 97afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 98afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_USE_OPTIMIZING_COMPILER),true) 99afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersDEX2OAT_FLAGS := --compiler-backend=Optimizing 100afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersDALVIKVM_FLAGS += -Xcompiler-option --compiler-backend=Optimizing 101afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 102afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 103afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 104afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS. 105afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# 106afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_DEFAULT_GC_TYPE ?= CMS 107afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_DEFAULT_GC_TYPE_CFLAGS := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE) 108afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 109afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_USE_PORTABLE_COMPILER),true) 110afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LLVM_ROOT_PATH := external/llvm 111afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Don't fail a dalvik minimal host build. 112afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -include $(LLVM_ROOT_PATH)/llvm.mk 113afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 114afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 115afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Clang build support. 116afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 117afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Host. 118afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_CLANG := false 119afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(WITHOUT_HOST_CLANG),true) 120afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # By default, host builds use clang for better warnings. 121afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_HOST_CLANG := true 122afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 123afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 124ea521dccd5dea59bcdfda7cc61cdd413152a8890Sebastien Hertz# Clang on the target. Target builds use GCC by default. 125afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG := 126afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_arm := 127ea521dccd5dea59bcdfda7cc61cdd413152a8890Sebastien HertzART_TARGET_CLANG_arm64 := 128afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_mips := 129afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_x86 := 130afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_x86_64 := 131afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 132afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersdefine set-target-local-clang-vars 133afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CLANG := $(ART_TARGET_CLANG) 134afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH), 135afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifneq ($$(ART_TARGET_CLANG_$(arch)),) 136afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CLANG_$(arch) := $$(ART_TARGET_CLANG_$(arch)) 137afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif) 138afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendef 139afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 140afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_CPP_EXTENSION := .cc 141afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 142afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_C_INCLUDES := \ 143afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers external/gtest/include \ 144afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers external/valgrind/main/include \ 145afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers external/valgrind/main \ 146afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers external/vixl/src \ 147afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers external/zlib \ 148afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers frameworks/compile/mclinker/include 149afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 150afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersart_cflags := \ 151afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -fno-rtti \ 152afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -std=gnu++11 \ 153afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -ggdb3 \ 154afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wall \ 155afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Werror \ 156afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wextra \ 157afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wno-sign-promo \ 158afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wno-unused-parameter \ 159afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wstrict-aliasing \ 16029b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe -fstrict-aliasing \ 16107140838a3ee44a6056cacdc78f2930e019107daIan Rogers -Wunreachable-code \ 16229b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe -fvisibility=protected 163afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 164afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS := 165afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_arm := 166afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_arm64 := 167afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_mips := 168afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_x86 := 169afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_x86_64 := 170afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 171afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# these are necessary for Clang ARM64 ART builds 172afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_arm64 += \ 173afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wno-implicit-exception-spec-mismatch \ 174afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -DNVALGRIND \ 175afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -Wno-unused-value 176afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 177afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_SMALL_MODE),true) 178afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers art_cflags += -DART_SMALL_MODE=1 179afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 180afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 181afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_SEA_IR_MODE),true) 182afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers art_cflags += -DART_SEA_IR_MODE=1 183afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 184afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 185afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersart_non_debug_cflags := \ 186afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -O3 187afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 18867a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hinesart_host_non_debug_cflags := \ 18967a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines $(art_non_debug_cflags) 19067a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines 19167a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hinesart_target_non_debug_cflags := \ 19267a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines $(art_non_debug_cflags) 19367a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines 194afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(HOST_OS),linux) 19567a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines # Larger frame-size for host clang builds today 1961159727e271ad3dbc5f84859e3f3c463842e821eStephen Hines art_host_non_debug_cflags += -Wframe-larger-than=2600 19767a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hines art_target_non_debug_cflags += -Wframe-larger-than=1728 198afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 199afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 200afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# FIXME: upstream LLVM has a vectorizer bug that needs to be fixed 201afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CLANG_CFLAGS_arm64 += \ 202afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -fno-vectorize 203afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 204afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersart_debug_cflags := \ 205afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -O1 \ 206afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ 207afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers -UNDEBUG 208afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 209afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifndef LIBART_IMG_HOST_BASE_ADDRESS 210afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers $(error LIBART_IMG_HOST_BASE_ADDRESS unset) 211afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 212afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS) 213afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default 214afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS) 215afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 216afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifndef LIBART_IMG_TARGET_BASE_ADDRESS 217afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers $(error LIBART_IMG_TARGET_BASE_ADDRESS unset) 218afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 219afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS) 220a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 221a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA 222a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA=-0x1000000 223a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif 224a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA 225a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA=0x1000000 226a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif 227a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_HOST_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA) 228a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_HOST_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA) 229a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 230a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA 231a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA=-0x1000000 232a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif 233a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightifndef LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA 234a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA=0x1000000 235a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightendif 236a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA) 237a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex LightART_TARGET_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA) 238a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 239997660dec8b10bba56276f35a9ee8d7ce9d62fc2Dehao ChenART_TARGET_LDFLAGS := 240afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(TARGET_CPU_SMP),true) 241afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_TARGET_CFLAGS += -DANDROID_SMP=1 242afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogerselse 243afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifeq ($(TARGET_CPU_SMP),false) 244afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_TARGET_CFLAGS += -DANDROID_SMP=0 245afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers else 246afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers $(warning TARGET_CPU_SMP should be (true|false), found $(TARGET_CPU_SMP)) 247afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Make sure we emit barriers for the worst case. 248afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_TARGET_CFLAGS += -DANDROID_SMP=1 249afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif 250afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 251afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS) 252afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 253afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is set in ../build/core/dex_preopt.mk based on 254afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# the TARGET_CPU_VARIANT 255afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 256afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers$(error Required DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is not set) 257afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 258afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 259afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 260afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Enable thread-safety for GCC 4.6, and clang, but not for GCC 4.7 or later where this feature was 261afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# removed. Warn when -Wthread-safety is not used. 262afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),) 263afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_TARGET_CFLAGS += -Wthread-safety 264afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogerselse 265afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # FIXME: add -Wthread-safety when the problem is fixed 266afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifeq ($(ART_TARGET_CLANG),true) 267afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_TARGET_CFLAGS += 268afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers else 269afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Warn if -Wthread-safety is not supported and not doing a top-level or 'mma' build. 270afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifneq ($(ONE_SHOT_MAKEFILE),) 271afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6 272afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.) 273afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif 274afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif 275afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 276afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# We compile with GCC 4.6 or clang on the host, both of which support -Wthread-safety. 277afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_CFLAGS += -Wthread-safety 278afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 279afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16" 280afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs 281afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 282afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Addition CPU specific CFLAGS. 283afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(TARGET_ARCH),arm) 284afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifneq ($(filter cortex-a15, $(TARGET_CPU_VARIANT)),) 285afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Fake a ARM feature for LPAE support. 286afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_TARGET_CFLAGS += -D__ARM_FEATURE_LPAE=1 287afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif 288afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 289afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 29067a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen HinesART_HOST_NON_DEBUG_CFLAGS := $(art_host_non_debug_cflags) 29167a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen HinesART_TARGET_NON_DEBUG_CFLAGS := $(art_target_non_debug_cflags) 292afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 293afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4 (and -lsupc++) 294afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions 295afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_HOST_DEBUG_LDLIBS := -lsupc++ 296afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 297afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifneq ($(HOST_OS),linux) 298afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Some Mac OS pthread header files are broken with -fkeep-inline-functions. 299afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_HOST_DEBUG_CFLAGS := $(filter-out -fkeep-inline-functions,$(ART_HOST_DEBUG_CFLAGS)) 300afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Mac OS doesn't have libsupc++. 301afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS)) 302afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 303afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 304afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags) 305afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 306afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# $(1): ndebug_or_debug 307afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersdefine set-target-local-cflags-vars 308afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) 309afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86) 310997660dec8b10bba56276f35a9ee8d7ce9d62fc2Dehao Chen LOCAL_LDFLAGS += $(ART_TARGET_LDFLAGS) 311afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers art_target_cflags_ndebug_or_debug := $(1) 312afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifeq ($$(art_target_cflags_ndebug_or_debug),debug) 313afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) 314afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers else 315afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) 316afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif 317afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 318afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # TODO: Also set when ART_TARGET_CLANG_$(arch)!=false and ART_TARGET_CLANG==true 319afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers $(foreach arch,$(ART_SUPPORTED_ARCH), 320afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ifeq ($$(ART_TARGET_CLANG_$(arch)),true) 321afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers LOCAL_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch)) 322afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers endif) 323afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 324afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers # Clear locally used variables. 325afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers art_target_cflags_ndebug_or_debug := 326afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendef 327afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 328afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_TARGET := false 329afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_HOST := false 330afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_NDEBUG := false 331afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_BUILD_DEBUG := false 332afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_NDEBUG),true) 333afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_TARGET := true 334afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_NDEBUG := true 335afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 336afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_TARGET_DEBUG),true) 337afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_TARGET := true 338afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_DEBUG := true 339afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 340afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_NDEBUG),true) 341afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_HOST := true 342afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_NDEBUG := true 343afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 344afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersifeq ($(ART_BUILD_HOST_DEBUG),true) 345afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_HOST := true 346afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers ART_BUILD_DEBUG := true 347afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif 348afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 349afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers# Clear locally defined variables that aren't necessary in the rest of the build system. 350afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_DEFAULT_GC_TYPE := 351afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian RogersART_DEFAULT_GC_TYPE_CFLAGS := 352afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersart_cflags := 35367a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hinesart_target_non_debug_cflags := 35467a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hinesart_host_non_debug_cflags := 35567a4338c5cc91ad3a8a3b99f06e1cf03b232d156Stephen Hinesart_non_debug_cflags := 356afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogers 357afd9acc30bdd11cdd12d8209eb994cb371c65e33Ian Rogersendif # ANDROID_COMMON_BUILD_MK 358