select.mk revision e1d44c3b4acef1319c34514e8d4ee78127b895ef
1#
2# Copyright (C) 2006 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
17# Select a combo based on the compiler being used.
18#
19# Inputs:
20#	combo_target -- prefix for final variables (HOST_ or TARGET_)
21#	combo_2nd_arch_prefix -- it's defined if this is loaded for TARGET_2ND_ARCH.
22#
23
24# Build a target string like "linux-arm" or "darwin-x86".
25ifdef combo_2nd_arch_prefix
26combo_os_arch := $($(combo_target)OS)-$(TARGET_2ND_ARCH)
27else
28combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
29endif
30
31combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
32
33# Set reasonable defaults for the various variables
34
35$(combo_var_prefix)CC := $(CC)
36$(combo_var_prefix)CXX := $(CXX)
37$(combo_var_prefix)AR := $(AR)
38$(combo_var_prefix)STRIP := $(STRIP)
39
40$(combo_var_prefix)BINDER_MINI := 0
41
42$(combo_var_prefix)HAVE_EXCEPTIONS := 0
43$(combo_var_prefix)HAVE_UNIX_FILE_PATH := 1
44$(combo_var_prefix)HAVE_WINDOWS_FILE_PATH := 0
45$(combo_var_prefix)HAVE_RTTI := 1
46$(combo_var_prefix)HAVE_CALL_STACKS := 1
47$(combo_var_prefix)HAVE_64BIT_IO := 1
48$(combo_var_prefix)HAVE_CLOCK_TIMERS := 1
49$(combo_var_prefix)HAVE_PTHREAD_RWLOCK := 1
50$(combo_var_prefix)HAVE_STRNLEN := 1
51$(combo_var_prefix)HAVE_STRERROR_R_STRRET := 1
52$(combo_var_prefix)HAVE_STRLCPY := 0
53$(combo_var_prefix)HAVE_STRLCAT := 0
54$(combo_var_prefix)HAVE_KERNEL_MODULES := 0
55
56$(combo_var_prefix)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
57$(combo_var_prefix)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
58$(combo_var_prefix)GLOBAL_CPPFLAGS :=
59$(combo_var_prefix)GLOBAL_LDFLAGS :=
60$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD
61
62$(combo_var_prefix)EXECUTABLE_SUFFIX :=
63$(combo_var_prefix)SHLIB_SUFFIX := .so
64$(combo_var_prefix)JNILIB_SUFFIX := $($(combo_var_prefix)SHLIB_SUFFIX)
65$(combo_var_prefix)STATIC_LIB_SUFFIX := .a
66
67# Now include the combo for this specific target.
68include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
69
70ifneq ($(USE_CCACHE),)
71  # The default check uses size and modification time, causing false misses
72  # since the mtime depends when the repo was checked out
73  export CCACHE_COMPILERCHECK := content
74
75  # See man page, optimizations to get more cache hits
76  # implies that __DATE__ and __TIME__ are not critical for functionality.
77  # Ignore include file modification time since it will depend on when
78  # the repo was checked out
79  export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
80
81  # Turn all preprocessor absolute paths into relative paths.
82  # Fixes absolute paths in preprocessed source due to use of -g.
83  # We don't really use system headers much so the rootdir is
84  # fine; ensures these paths are relative for all Android trees
85  # on a workstation.
86  export CCACHE_BASEDIR := /
87
88  CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
89  # If we are cross-compiling Windows binaries on Linux
90  # then use the linux ccache binary instead.
91  ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
92    CCACHE_HOST_TAG := linux-$(BUILD_ARCH)
93  endif
94  ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
95  # Check that the executable is here.
96  ccache := $(strip $(wildcard $(ccache)))
97  ifdef ccache
98    # prepend ccache if necessary
99    ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC)))
100      $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC)
101    endif
102    ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX)))
103      $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX)
104    endif
105    ccache =
106  endif
107endif
108