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 | |
Anwar Ghuloum | 8447d84 | 2013-04-30 17:27:40 -0700 | [diff] [blame] | 17 | ART_SMALL_MODE := false |
| 18 | ifneq ($(wildcard art/SMALL_ART),) |
| 19 | $(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART) |
| 20 | ART_SMALL_MODE := true |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 21 | endif |
Anwar Ghuloum | a72dd8b | 2013-06-03 17:01:15 -0700 | [diff] [blame] | 22 | ifeq ($(WITH_ART_SMALL_MODE), true) |
| 23 | ART_SMALL_MODE := true |
| 24 | endif |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 25 | |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 26 | ART_SEA_IR_MODE := false |
| 27 | ifneq ($(wildcard art/SEA_IR_ART),) |
| 28 | $(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART) |
| 29 | ART_SEA_IR_MODE := true |
| 30 | endif |
| 31 | ifeq ($(WITH_ART_SEA_IR_MODE), true) |
| 32 | ART_SEA_IR_MODE := true |
| 33 | endif |
| 34 | |
Brian Carlstrom | 06809ed | 2012-09-17 14:19:20 -0700 | [diff] [blame] | 35 | ART_USE_PORTABLE_COMPILER := false |
| 36 | ifneq ($(wildcard art/USE_PORTABLE_COMPILER),) |
| 37 | $(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER) |
| 38 | ART_USE_PORTABLE_COMPILER := true |
| 39 | endif |
| 40 | ifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true) |
| 41 | $(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true) |
| 42 | ART_USE_PORTABLE_COMPILER := true |
| 43 | endif |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 44 | |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 45 | LLVM_ROOT_PATH := external/llvm |
| 46 | include $(LLVM_ROOT_PATH)/llvm.mk |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 47 | |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 48 | # Clang build. |
| 49 | # ART_TARGET_CLANG := true |
| 50 | # ART_HOST_CLANG := true |
| 51 | |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 52 | # directory used for gtests on device |
| 53 | ART_NATIVETEST_DIR := /data/nativetest/art |
| 54 | ART_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art |
| 55 | |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 56 | # directory used for tests on device |
| 57 | ART_TEST_DIR := /data/art-test |
| 58 | ART_TEST_OUT := $(TARGET_OUT_DATA)/art-test |
| 59 | |
Brian Carlstrom | cdc8de4 | 2011-07-19 14:23:17 -0700 | [diff] [blame] | 60 | ART_CPP_EXTENSION := .cc |
Carl Shapiro | 9bf84fd | 2011-06-17 17:05:25 -0700 | [diff] [blame] | 61 | |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 62 | ART_C_INCLUDES := \ |
| 63 | external/gtest/include \ |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 64 | external/valgrind/main/include \ |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 65 | external/zlib \ |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 66 | frameworks/compile/mclinker/include \ |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 67 | art/src |
Brian Carlstrom | b0460ea | 2011-07-29 10:08:05 -0700 | [diff] [blame] | 68 | |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 69 | art_cflags := \ |
Ian Rogers | 637c65b | 2013-05-31 11:46:00 -0700 | [diff] [blame] | 70 | -fno-rtti \ |
Ian Rogers | 646c3d7 | 2012-02-17 23:55:19 -0800 | [diff] [blame] | 71 | -O2 \ |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 72 | -ggdb3 \ |
| 73 | -Wall \ |
| 74 | -Werror \ |
| 75 | -Wextra \ |
Elliott Hughes | eaa200d | 2012-01-05 16:30:31 -0800 | [diff] [blame] | 76 | -Wstrict-aliasing=3 \ |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 77 | -fstrict-aliasing |
| 78 | |
Anwar Ghuloum | c44f68f | 2013-05-10 13:24:54 -0700 | [diff] [blame] | 79 | ifeq ($(ART_SMALL_MODE),true) |
| 80 | art_cflags += -DART_SMALL_MODE=1 |
Ian Rogers | f3e9855 | 2013-03-20 15:49:49 -0700 | [diff] [blame] | 81 | endif |
| 82 | |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 83 | ifeq ($(ART_SEA_IR_MODE),true) |
| 84 | art_cflags += -DART_SEA_IR_MODE=1 |
| 85 | endif |
| 86 | |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 87 | # 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 Carlstrom | 69d7a6b | 2011-12-15 17:31:21 -0800 | [diff] [blame] | 90 | ifeq ($(HOST_OS),linux) |
Shih-wei Liao | 24782c6 | 2012-01-08 12:46:11 -0800 | [diff] [blame] | 91 | art_non_debug_cflags := \ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 92 | -Wframe-larger-than=1728 |
Brian Carlstrom | 69d7a6b | 2011-12-15 17:31:21 -0800 | [diff] [blame] | 93 | endif |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 94 | |
| 95 | art_debug_cflags := \ |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 96 | -fno-inline \ |
Elliott Hughes | 06e3ad4 | 2012-02-07 14:51:57 -0800 | [diff] [blame] | 97 | -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 98 | -UNDEBUG |
| 99 | |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 100 | # start of image reserved address space |
| 101 | IMG_HOST_BASE_ADDRESS := 0x60000000 |
| 102 | |
| 103 | ifeq ($(TARGET_ARCH),mips) |
| 104 | IMG_TARGET_BASE_ADDRESS := 0x30000000 |
| 105 | else |
| 106 | IMG_TARGET_BASE_ADDRESS := 0x60000000 |
| 107 | endif |
| 108 | |
| 109 | ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(IMG_HOST_BASE_ADDRESS) |
Ian Rogers | 9adbff5 | 2013-01-23 18:19:03 -0800 | [diff] [blame] | 110 | |
| 111 | ifeq ($(TARGET_ARCH),x86) |
| 112 | ART_TARGET_CFLAGS += -msse2 |
| 113 | endif |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 114 | |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 115 | 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] | 116 | ifeq ($(TARGET_CPU_SMP),true) |
| 117 | ART_TARGET_CFLAGS += -DANDROID_SMP=1 |
| 118 | else |
| 119 | ART_TARGET_CFLAGS += -DANDROID_SMP=0 |
| 120 | endif |
| 121 | |
Ian Rogers | ba3ce9a | 2013-05-17 18:50:09 -0700 | [diff] [blame] | 122 | # Enable thread-safety for GCC 4.6 on the target but not for GCC 4.7 where this feature was removed. |
| 123 | ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),) |
| 124 | ART_TARGET_CFLAGS += -Wthread-safety |
| 125 | else |
| 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 |
| 131 | endif |
| 132 | # We build with GCC 4.6 on the host. |
| 133 | ART_HOST_CFLAGS += -Wthread-safety |
| 134 | |
Ian Rogers | f89eccd | 2013-05-30 10:50:43 -0700 | [diff] [blame] | 135 | # Make host builds easier to debug and profile by not omitting the frame pointer. |
| 136 | ART_HOST_CFLAGS += -fno-omit-frame-pointer |
| 137 | |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 138 | # 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 Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 141 | ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags) |
| 142 | ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags) |
| 143 | |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 144 | # 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] | 145 | ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 146 | ART_HOST_DEBUG_LDLIBS := -lsupc++ |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 147 | |
| 148 | ifneq ($(HOST_OS),linux) |
| 149 | # Some Mac OS pthread header files are broken with -fkeep-inline-functions. |
Elliott Hughes | 34cf514 | 2012-01-20 16:39:13 -0800 | [diff] [blame] | 150 | 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] | 151 | # Mac OS doesn't have libsupc++. |
| 152 | ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS)) |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 153 | endif |
| 154 | |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 155 | ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 156 | |
Ian Rogers | c928de9 | 2013-02-27 14:30:44 -0800 | [diff] [blame] | 157 | ifeq ($(ART_USE_PORTABLE_COMPILER),true) |
TDYa127 | 58e63f9 | 2012-04-24 13:16:47 -0700 | [diff] [blame] | 158 | PARALLEL_ART_COMPILE_JOBS := -j8 |
| 159 | endif |
| 160 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 161 | ART_BUILD_TARGET := false |
| 162 | ART_BUILD_HOST := false |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 163 | ART_BUILD_NDEBUG := false |
| 164 | ART_BUILD_DEBUG := false |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 165 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 166 | ART_BUILD_TARGET := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 167 | ART_BUILD_NDEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 168 | endif |
| 169 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 170 | ART_BUILD_TARGET := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 171 | ART_BUILD_DEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 172 | endif |
| 173 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 174 | ART_BUILD_HOST := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 175 | ART_BUILD_NDEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 176 | endif |
| 177 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 178 | ART_BUILD_HOST := true |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 179 | ART_BUILD_DEBUG := true |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 180 | endif |