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