blob: 671ce5cc94127c30de58000d6ea86e8d6dc9afbd [file] [log] [blame]
Carl Shapiro7b216702011-06-17 15:09:26 -07001#
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
Anwar Ghuloum8447d842013-04-30 17:27:40 -070017ART_SMALL_MODE := false
18ifneq ($(wildcard art/SMALL_ART),)
19$(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART)
20ART_SMALL_MODE := true
Ian Rogersf3e98552013-03-20 15:49:49 -070021endif
Anwar Ghulouma72dd8b2013-06-03 17:01:15 -070022ifeq ($(WITH_ART_SMALL_MODE), true)
23ART_SMALL_MODE := true
24endif
Ian Rogersf3e98552013-03-20 15:49:49 -070025
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070026ART_SEA_IR_MODE := false
27ifneq ($(wildcard art/SEA_IR_ART),)
28$(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART)
29ART_SEA_IR_MODE := true
30endif
31ifeq ($(WITH_ART_SEA_IR_MODE), true)
32ART_SEA_IR_MODE := true
33endif
34
Brian Carlstrom06809ed2012-09-17 14:19:20 -070035ART_USE_PORTABLE_COMPILER := false
36ifneq ($(wildcard art/USE_PORTABLE_COMPILER),)
37$(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER)
38ART_USE_PORTABLE_COMPILER := true
39endif
40ifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true)
41$(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true)
42ART_USE_PORTABLE_COMPILER := true
43endif
Shih-wei Liaod1fec812012-02-13 09:51:10 -080044
Shih-wei Liaod1fec812012-02-13 09:51:10 -080045LLVM_ROOT_PATH := external/llvm
46include $(LLVM_ROOT_PATH)/llvm.mk
Shih-wei Liaod1fec812012-02-13 09:51:10 -080047
Ian Rogerscd5d0422013-05-17 15:54:01 -070048# Clang build.
49# ART_TARGET_CLANG := true
50# ART_HOST_CLANG := true
51
Brian Carlstrom32b4b2a2012-01-31 16:21:40 -080052# directory used for gtests on device
53ART_NATIVETEST_DIR := /data/nativetest/art
54ART_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art
55
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -070056# directory used for tests on device
57ART_TEST_DIR := /data/art-test
58ART_TEST_OUT := $(TARGET_OUT_DATA)/art-test
59
Brian Carlstromcdc8de42011-07-19 14:23:17 -070060ART_CPP_EXTENSION := .cc
Carl Shapiro9bf84fd2011-06-17 17:05:25 -070061
Elliott Hughes0af55432011-08-17 18:37:28 -070062ART_C_INCLUDES := \
63 external/gtest/include \
Ian Rogers1d54e732013-05-02 21:10:01 -070064 external/valgrind/main/include \
buzbeec143c552011-08-20 17:38:58 -070065 external/zlib \
Brian Carlstrom700c8d32012-11-05 10:42:02 -080066 frameworks/compile/mclinker/include \
Elliott Hughesadb8c672012-03-06 16:49:32 -080067 art/src
Brian Carlstromb0460ea2011-07-29 10:08:05 -070068
Elliott Hughes1d3f1142011-09-13 12:00:00 -070069art_cflags := \
Ian Rogers637c65b2013-05-31 11:46:00 -070070 -fno-rtti \
Ian Rogers646c3d72012-02-17 23:55:19 -080071 -O2 \
Carl Shapiro1fb86202011-06-27 17:43:13 -070072 -ggdb3 \
73 -Wall \
74 -Werror \
75 -Wextra \
Elliott Hugheseaa200d2012-01-05 16:30:31 -080076 -Wstrict-aliasing=3 \
Carl Shapiro1fb86202011-06-27 17:43:13 -070077 -fstrict-aliasing
78
Anwar Ghuloumc44f68f2013-05-10 13:24:54 -070079ifeq ($(ART_SMALL_MODE),true)
80 art_cflags += -DART_SMALL_MODE=1
Ian Rogersf3e98552013-03-20 15:49:49 -070081endif
82
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070083ifeq ($(ART_SEA_IR_MODE),true)
84 art_cflags += -DART_SEA_IR_MODE=1
85endif
86
Brian Carlstrom700c8d32012-11-05 10:42:02 -080087# TODO: enable -std=gnu++0x for auto support when on Ubuntu 12.04 LTS (Precise Pangolin)
88# On 10.04 LTS (Lucid Lynx), it can cause dependencies on GLIBCXX_3.4.14 version symbols.
89
Brian Carlstrom69d7a6b2011-12-15 17:31:21 -080090ifeq ($(HOST_OS),linux)
Shih-wei Liao24782c62012-01-08 12:46:11 -080091 art_non_debug_cflags := \
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070092 -Wframe-larger-than=1728
Brian Carlstrom69d7a6b2011-12-15 17:31:21 -080093endif
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070094
95art_debug_cflags := \
Ian Rogers1ffa32f2013-02-05 18:29:08 -080096 -fno-inline \
Elliott Hughes06e3ad42012-02-07 14:51:57 -080097 -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070098 -UNDEBUG
99
jeffhao8161c032012-10-31 15:50:00 -0700100# start of image reserved address space
101IMG_HOST_BASE_ADDRESS := 0x60000000
102
103ifeq ($(TARGET_ARCH),mips)
104IMG_TARGET_BASE_ADDRESS := 0x30000000
105else
106IMG_TARGET_BASE_ADDRESS := 0x60000000
107endif
108
109ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(IMG_HOST_BASE_ADDRESS)
Ian Rogers9adbff52013-01-23 18:19:03 -0800110
111ifeq ($(TARGET_ARCH),x86)
112ART_TARGET_CFLAGS += -msse2
113endif
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700114
jeffhao8161c032012-10-31 15:50:00 -0700115ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(IMG_TARGET_BASE_ADDRESS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700116ifeq ($(TARGET_CPU_SMP),true)
117 ART_TARGET_CFLAGS += -DANDROID_SMP=1
118else
119 ART_TARGET_CFLAGS += -DANDROID_SMP=0
120endif
121
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700122# Enable thread-safety for GCC 4.6 on the target but not for GCC 4.7 where this feature was removed.
123ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),)
124 ART_TARGET_CFLAGS += -Wthread-safety
125else
126 # Warn if not using GCC 4.6 for target builds when not doing a top-level or 'mma' build.
127 ifneq ($(ONE_SHOT_MAKEFILE),)
128 # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6
129 $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.)
130 endif
131endif
132# We build with GCC 4.6 on the host.
133ART_HOST_CFLAGS += -Wthread-safety
134
Ian Rogersf89eccd2013-05-30 10:50:43 -0700135# Make host builds easier to debug and profile by not omitting the frame pointer.
136ART_HOST_CFLAGS += -fno-omit-frame-pointer
137
Brian Carlstrom89521892011-12-07 22:05:07 -0800138# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
139# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
140
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700141ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
142ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
143
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700144# TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4 (and -lsupc++)
Elliott Hughes1ba27142012-01-20 15:32:00 -0800145ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700146ART_HOST_DEBUG_LDLIBS := -lsupc++
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800147
148ifneq ($(HOST_OS),linux)
149 # Some Mac OS pthread header files are broken with -fkeep-inline-functions.
Elliott Hughes34cf5142012-01-20 16:39:13 -0800150 ART_HOST_DEBUG_CFLAGS := $(filter-out -fkeep-inline-functions,$(ART_HOST_DEBUG_CFLAGS))
Elliott Hughes60234562012-06-01 12:25:59 -0700151 # Mac OS doesn't have libsupc++.
152 ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS))
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800153endif
154
Brian Carlstrom86927212011-09-15 11:31:11 -0700155ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700156
Ian Rogersc928de92013-02-27 14:30:44 -0800157ifeq ($(ART_USE_PORTABLE_COMPILER),true)
TDYa12758e63f92012-04-24 13:16:47 -0700158PARALLEL_ART_COMPILE_JOBS := -j8
159endif
160
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700161ART_BUILD_TARGET := false
162ART_BUILD_HOST := false
Brian Carlstrom265091e2013-01-30 14:08:26 -0800163ART_BUILD_NDEBUG := false
164ART_BUILD_DEBUG := false
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700165ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
166 ART_BUILD_TARGET := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800167 ART_BUILD_NDEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700168endif
169ifeq ($(ART_BUILD_TARGET_DEBUG),true)
170 ART_BUILD_TARGET := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800171 ART_BUILD_DEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700172endif
173ifeq ($(ART_BUILD_HOST_NDEBUG),true)
174 ART_BUILD_HOST := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800175 ART_BUILD_NDEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700176endif
177ifeq ($(ART_BUILD_HOST_DEBUG),true)
178 ART_BUILD_HOST := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800179 ART_BUILD_DEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700180endif