blob: 8234a8fcb128c8cedc94bbca921d878c230c150b [file] [log] [blame]
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -08001#
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
The Android Open Source Project88b60792009-03-03 19:28:42 -080017# Select a combo based on the compiler being used.
18#
19# Inputs:
20# combo_target -- prefix for final variables (HOST_ or TARGET_)
Ying Wang6feb6d52014-04-17 10:03:35 -070021# combo_2nd_arch_prefix -- it's defined if this is loaded for the 2nd arch.
The Android Open Source Project88b60792009-03-03 19:28:42 -080022#
The Android Open Source Project88b60792009-03-03 19:28:42 -080023
24# Build a target string like "linux-arm" or "darwin-x86".
Ying Wang6feb6d52014-04-17 10:03:35 -070025combo_os_arch := $($(combo_target)OS)-$($(combo_target)$(combo_2nd_arch_prefix)ARCH)
Ying Wang1d274d22013-12-27 11:09:36 -080026
27combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
The Android Open Source Project88b60792009-03-03 19:28:42 -080028
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080029# Set reasonable defaults for the various variables
The Android Open Source Project88b60792009-03-03 19:28:42 -080030
Ying Wang1d274d22013-12-27 11:09:36 -080031$(combo_var_prefix)CC := $(CC)
32$(combo_var_prefix)CXX := $(CXX)
33$(combo_var_prefix)AR := $(AR)
34$(combo_var_prefix)STRIP := $(STRIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -080035
Ying Wang1d274d22013-12-27 11:09:36 -080036$(combo_var_prefix)BINDER_MINI := 0
The Android Open Source Project88b60792009-03-03 19:28:42 -080037
Ying Wang1d274d22013-12-27 11:09:36 -080038$(combo_var_prefix)HAVE_EXCEPTIONS := 0
39$(combo_var_prefix)HAVE_UNIX_FILE_PATH := 1
40$(combo_var_prefix)HAVE_WINDOWS_FILE_PATH := 0
41$(combo_var_prefix)HAVE_RTTI := 1
42$(combo_var_prefix)HAVE_CALL_STACKS := 1
43$(combo_var_prefix)HAVE_64BIT_IO := 1
44$(combo_var_prefix)HAVE_CLOCK_TIMERS := 1
45$(combo_var_prefix)HAVE_PTHREAD_RWLOCK := 1
46$(combo_var_prefix)HAVE_STRNLEN := 1
47$(combo_var_prefix)HAVE_STRERROR_R_STRRET := 1
48$(combo_var_prefix)HAVE_STRLCPY := 0
49$(combo_var_prefix)HAVE_STRLCAT := 0
50$(combo_var_prefix)HAVE_KERNEL_MODULES := 0
The Android Open Source Project88b60792009-03-03 19:28:42 -080051
Ying Wang1d274d22013-12-27 11:09:36 -080052$(combo_var_prefix)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
53$(combo_var_prefix)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
54$(combo_var_prefix)GLOBAL_CPPFLAGS :=
55$(combo_var_prefix)GLOBAL_LDFLAGS :=
56$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD
Ying Wang4d2cc662014-01-16 12:36:34 -080057$(combo_var_prefix)GLOBAL_LD_DIRS :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080058
Ying Wang1d274d22013-12-27 11:09:36 -080059$(combo_var_prefix)EXECUTABLE_SUFFIX :=
60$(combo_var_prefix)SHLIB_SUFFIX := .so
61$(combo_var_prefix)JNILIB_SUFFIX := $($(combo_var_prefix)SHLIB_SUFFIX)
62$(combo_var_prefix)STATIC_LIB_SUFFIX := .a
The Android Open Source Project88b60792009-03-03 19:28:42 -080063
The Android Open Source Project88b60792009-03-03 19:28:42 -080064# Now include the combo for this specific target.
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080065include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080066
67ifneq ($(USE_CCACHE),)
Andrew Boie1f930432012-08-13 13:45:50 -070068 # The default check uses size and modification time, causing false misses
69 # since the mtime depends when the repo was checked out
70 export CCACHE_COMPILERCHECK := content
71
72 # See man page, optimizations to get more cache hits
73 # implies that __DATE__ and __TIME__ are not critical for functionality.
74 # Ignore include file modification time since it will depend on when
75 # the repo was checked out
76 export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
77
78 # Turn all preprocessor absolute paths into relative paths.
79 # Fixes absolute paths in preprocessed source due to use of -g.
80 # We don't really use system headers much so the rootdir is
81 # fine; ensures these paths are relative for all Android trees
82 # on a workstation.
83 export CCACHE_BASEDIR := /
84
David 'Digit' Turner55aad082011-03-12 13:19:01 +010085 CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
86 # If we are cross-compiling Windows binaries on Linux
87 # then use the linux ccache binary instead.
88 ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
Ying Wang6feb6d52014-04-17 10:03:35 -070089 CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
Ying Wang83f69eb2010-10-07 10:45:02 -070090 endif
Ying Wang71b5cc12012-01-09 11:52:23 -080091 ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
David 'Digit' Turner55aad082011-03-12 13:19:01 +010092 # Check that the executable is here.
93 ccache := $(strip $(wildcard $(ccache)))
94 ifdef ccache
95 # prepend ccache if necessary
Ying Wang1d274d22013-12-27 11:09:36 -080096 ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC)))
97 $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC)
David 'Digit' Turner55aad082011-03-12 13:19:01 +010098 endif
Ying Wang1d274d22013-12-27 11:09:36 -080099 ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX)))
100 $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX)
David 'Digit' Turner55aad082011-03-12 13:19:01 +0100101 endif
102 ccache =
Ying Wang83f69eb2010-10-07 10:45:02 -0700103 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800104endif