Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 17 | # Select a combo based on the compiler being used. |
| 18 | # |
| 19 | # Inputs: |
| 20 | # combo_target -- prefix for final variables (HOST_ or TARGET_) |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 21 | # combo_2nd_arch_prefix -- it's defined if this is loaded for TARGET_2ND_ARCH. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 22 | # |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 23 | |
| 24 | # Build a target string like "linux-arm" or "darwin-x86". |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 25 | ifdef combo_2nd_arch_prefix |
| 26 | combo_os_arch := $($(combo_target)OS)-$(TARGET_2ND_ARCH) |
| 27 | else |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 28 | combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH) |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 29 | endif |
| 30 | |
| 31 | combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 32 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 33 | # Set reasonable defaults for the various variables |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 34 | |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 35 | $(combo_var_prefix)CC := $(CC) |
| 36 | $(combo_var_prefix)CXX := $(CXX) |
| 37 | $(combo_var_prefix)AR := $(AR) |
| 38 | $(combo_var_prefix)STRIP := $(STRIP) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 39 | |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 40 | $(combo_var_prefix)BINDER_MINI := 0 |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 41 | |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 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 |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 55 | |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 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 |
Ying Wang | 4d2cc66 | 2014-01-16 12:36:34 -0800 | [diff] [blame] | 61 | $(combo_var_prefix)GLOBAL_LD_DIRS := |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 62 | |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 63 | $(combo_var_prefix)EXECUTABLE_SUFFIX := |
| 64 | $(combo_var_prefix)SHLIB_SUFFIX := .so |
| 65 | $(combo_var_prefix)JNILIB_SUFFIX := $($(combo_var_prefix)SHLIB_SUFFIX) |
| 66 | $(combo_var_prefix)STATIC_LIB_SUFFIX := .a |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 67 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 68 | # Now include the combo for this specific target. |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 69 | include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 70 | |
| 71 | ifneq ($(USE_CCACHE),) |
Andrew Boie | 1f93043 | 2012-08-13 13:45:50 -0700 | [diff] [blame] | 72 | # The default check uses size and modification time, causing false misses |
| 73 | # since the mtime depends when the repo was checked out |
| 74 | export CCACHE_COMPILERCHECK := content |
| 75 | |
| 76 | # See man page, optimizations to get more cache hits |
| 77 | # implies that __DATE__ and __TIME__ are not critical for functionality. |
| 78 | # Ignore include file modification time since it will depend on when |
| 79 | # the repo was checked out |
| 80 | export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro |
| 81 | |
| 82 | # Turn all preprocessor absolute paths into relative paths. |
| 83 | # Fixes absolute paths in preprocessed source due to use of -g. |
| 84 | # We don't really use system headers much so the rootdir is |
| 85 | # fine; ensures these paths are relative for all Android trees |
| 86 | # on a workstation. |
| 87 | export CCACHE_BASEDIR := / |
| 88 | |
David 'Digit' Turner | 55aad08 | 2011-03-12 13:19:01 +0100 | [diff] [blame] | 89 | CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG) |
| 90 | # If we are cross-compiling Windows binaries on Linux |
| 91 | # then use the linux ccache binary instead. |
| 92 | ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux) |
| 93 | CCACHE_HOST_TAG := linux-$(BUILD_ARCH) |
Ying Wang | 83f69eb | 2010-10-07 10:45:02 -0700 | [diff] [blame] | 94 | endif |
Ying Wang | 71b5cc1 | 2012-01-09 11:52:23 -0800 | [diff] [blame] | 95 | ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache |
David 'Digit' Turner | 55aad08 | 2011-03-12 13:19:01 +0100 | [diff] [blame] | 96 | # Check that the executable is here. |
| 97 | ccache := $(strip $(wildcard $(ccache))) |
| 98 | ifdef ccache |
| 99 | # prepend ccache if necessary |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 100 | ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC))) |
| 101 | $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC) |
David 'Digit' Turner | 55aad08 | 2011-03-12 13:19:01 +0100 | [diff] [blame] | 102 | endif |
Ying Wang | 1d274d2 | 2013-12-27 11:09:36 -0800 | [diff] [blame] | 103 | ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX))) |
| 104 | $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX) |
David 'Digit' Turner | 55aad08 | 2011-03-12 13:19:01 +0100 | [diff] [blame] | 105 | endif |
| 106 | ccache = |
Ying Wang | 83f69eb | 2010-10-07 10:45:02 -0700 | [diff] [blame] | 107 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 108 | endif |