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
17ifndef ART_ANDROID_COMMON_MK
18ART_ANDROID_COMMON_MK = true
19
20ART_TARGET_SUPPORTED_ARCH := arm arm64 mips mips64 x86 x86_64
21ART_HOST_SUPPORTED_ARCH := x86 x86_64
22
23ifneq ($(HOST_OS),darwin)
24  ART_HOST_SUPPORTED_ARCH := x86 x86_64
25else
26  # Mac OS doesn't support low-4GB allocation in a 64-bit process. So we won't be able to create
27  # our heaps.
28  ART_HOST_SUPPORTED_ARCH := x86
29endif
30
31ART_COVERAGE := false
32
33ifeq ($(ART_COVERAGE),true)
34# https://gcc.gnu.org/onlinedocs/gcc/Cross-profiling.html
35GCOV_PREFIX := /data/local/tmp/gcov
36# GCOV_PREFIX_STRIP is an integer that defines how many levels should be
37# stripped off the beginning of the path. We want the paths in $GCOV_PREFIX to
38# be relative to $ANDROID_BUILD_TOP so we can just adb pull from the top and not
39# have to worry about placing things ourselves.
40GCOV_PREFIX_STRIP := $(shell echo $(ANDROID_BUILD_TOP) | grep -o / | wc -l)
41GCOV_ENV := GCOV_PREFIX=$(GCOV_PREFIX) GCOV_PREFIX_STRIP=$(GCOV_PREFIX_STRIP)
42else
43GCOV_ENV :=
44endif
45
46ifeq (,$(filter $(TARGET_ARCH),$(ART_TARGET_SUPPORTED_ARCH)))
47$(warning unsupported TARGET_ARCH=$(TARGET_ARCH))
48endif
49ifeq (,$(filter $(HOST_ARCH),$(ART_HOST_SUPPORTED_ARCH)))
50$(warning unsupported HOST_ARCH=$(HOST_ARCH))
51endif
52
53# Primary vs. secondary
542ND_TARGET_ARCH := $(TARGET_2ND_ARCH)
55TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
562ND_TARGET_INSTRUCTION_SET_FEATURES := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
57ifdef TARGET_2ND_ARCH
58  ifneq ($(filter %64,$(TARGET_ARCH)),)
59    ART_PHONY_TEST_TARGET_SUFFIX := 64
60    2ND_ART_PHONY_TEST_TARGET_SUFFIX := 32
61  else
62    # TODO: ???
63    $(warning Do not know what to do with this multi-target configuration!)
64    ART_PHONY_TEST_TARGET_SUFFIX := 32
65    2ND_ART_PHONY_TEST_TARGET_SUFFIX :=
66  endif
67else
68  ifneq ($(filter %64,$(TARGET_ARCH)),)
69    ART_PHONY_TEST_TARGET_SUFFIX := 64
70    2ND_ART_PHONY_TEST_TARGET_SUFFIX :=
71  else
72    ART_PHONY_TEST_TARGET_SUFFIX := 32
73    2ND_ART_PHONY_TEST_TARGET_SUFFIX :=
74  endif
75endif
76
77ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX)
78ART_HOST_SHLIB_EXTENSION ?= .so
79ifeq ($(HOST_PREFER_32_BIT),true)
80  ART_PHONY_TEST_HOST_SUFFIX := 32
81  2ND_ART_PHONY_TEST_HOST_SUFFIX :=
82  ART_HOST_ARCH := x86
83  2ND_ART_HOST_ARCH :=
84  2ND_HOST_ARCH :=
85  ART_HOST_OUT_SHARED_LIBRARIES := $(2ND_HOST_OUT_SHARED_LIBRARIES)
86  2ND_ART_HOST_OUT_SHARED_LIBRARIES :=
87else
88  ART_PHONY_TEST_HOST_SUFFIX := 64
89  2ND_ART_PHONY_TEST_HOST_SUFFIX := 32
90  ART_HOST_ARCH := x86_64
91  2ND_ART_HOST_ARCH := x86
92  2ND_HOST_ARCH := x86
93  ART_HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT_SHARED_LIBRARIES)
94  2ND_ART_HOST_OUT_SHARED_LIBRARIES := $(2ND_HOST_OUT_SHARED_LIBRARIES)
95endif
96
97endif # ART_ANDROID_COMMON_MK
98