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_) |
| 21 | # |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 22 | |
| 23 | # Build a target string like "linux-arm" or "darwin-x86". |
| 24 | combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH) |
| 25 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 26 | # Set reasonable defaults for the various variables |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 27 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 28 | $(combo_target)CC := $(CC) |
| 29 | $(combo_target)CXX := $(CXX) |
| 30 | $(combo_target)AR := $(AR) |
Bruce Beare | 45ac434 | 2010-06-24 14:02:00 -0700 | [diff] [blame] | 31 | $(combo_target)STRIP := $(STRIP) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 32 | |
| 33 | $(combo_target)BINDER_MINI := 0 |
| 34 | |
| 35 | $(combo_target)HAVE_EXCEPTIONS := 0 |
| 36 | $(combo_target)HAVE_UNIX_FILE_PATH := 1 |
| 37 | $(combo_target)HAVE_WINDOWS_FILE_PATH := 0 |
| 38 | $(combo_target)HAVE_RTTI := 1 |
| 39 | $(combo_target)HAVE_CALL_STACKS := 1 |
| 40 | $(combo_target)HAVE_64BIT_IO := 1 |
| 41 | $(combo_target)HAVE_CLOCK_TIMERS := 1 |
| 42 | $(combo_target)HAVE_PTHREAD_RWLOCK := 1 |
| 43 | $(combo_target)HAVE_STRNLEN := 1 |
| 44 | $(combo_target)HAVE_STRERROR_R_STRRET := 1 |
| 45 | $(combo_target)HAVE_STRLCPY := 0 |
| 46 | $(combo_target)HAVE_STRLCAT := 0 |
| 47 | $(combo_target)HAVE_KERNEL_MODULES := 0 |
| 48 | |
IAmTheOneTheyCallNeo | b34df0f | 2014-03-01 12:18:08 -0500 | [diff] [blame^] | 49 | $(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar -Wno-error=unused-parameter |
| 50 | $(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing -Wno-error=unused-parameter |
Erik Gilling | c12c518 | 2009-07-17 15:57:10 -0700 | [diff] [blame] | 51 | $(combo_target)GLOBAL_LDFLAGS := |
Sriram Raman | 5bbd229 | 2009-10-07 16:27:38 -0700 | [diff] [blame] | 52 | $(combo_target)GLOBAL_ARFLAGS := crsP |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 53 | |
Ying Wang | 83f69eb | 2010-10-07 10:45:02 -0700 | [diff] [blame] | 54 | $(combo_target)EXECUTABLE_SUFFIX := |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 55 | $(combo_target)SHLIB_SUFFIX := .so |
| 56 | $(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX) |
| 57 | $(combo_target)STATIC_LIB_SUFFIX := .a |
| 58 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 59 | # Now include the combo for this specific target. |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 60 | include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 61 | |
| 62 | ifneq ($(USE_CCACHE),) |
Andrew Boie | 1f93043 | 2012-08-13 13:45:50 -0700 | [diff] [blame] | 63 | # The default check uses size and modification time, causing false misses |
| 64 | # since the mtime depends when the repo was checked out |
| 65 | export CCACHE_COMPILERCHECK := content |
| 66 | |
| 67 | # See man page, optimizations to get more cache hits |
| 68 | # implies that __DATE__ and __TIME__ are not critical for functionality. |
| 69 | # Ignore include file modification time since it will depend on when |
| 70 | # the repo was checked out |
| 71 | export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro |
| 72 | |
| 73 | # Turn all preprocessor absolute paths into relative paths. |
| 74 | # Fixes absolute paths in preprocessed source due to use of -g. |
| 75 | # We don't really use system headers much so the rootdir is |
| 76 | # fine; ensures these paths are relative for all Android trees |
| 77 | # on a workstation. |
| 78 | export CCACHE_BASEDIR := / |
| 79 | |
David 'Digit' Turner | 55aad08 | 2011-03-12 13:19:01 +0100 | [diff] [blame] | 80 | CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG) |
| 81 | # If we are cross-compiling Windows binaries on Linux |
| 82 | # then use the linux ccache binary instead. |
| 83 | ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux) |
| 84 | CCACHE_HOST_TAG := linux-$(BUILD_ARCH) |
Ying Wang | 83f69eb | 2010-10-07 10:45:02 -0700 | [diff] [blame] | 85 | endif |
Ying Wang | 71b5cc1 | 2012-01-09 11:52:23 -0800 | [diff] [blame] | 86 | ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache |
David 'Digit' Turner | 55aad08 | 2011-03-12 13:19:01 +0100 | [diff] [blame] | 87 | # Check that the executable is here. |
| 88 | ccache := $(strip $(wildcard $(ccache))) |
| 89 | ifdef ccache |
| 90 | # prepend ccache if necessary |
| 91 | ifneq ($(ccache),$(firstword $($(combo_target)CC))) |
| 92 | $(combo_target)CC := $(ccache) $($(combo_target)CC) |
| 93 | endif |
| 94 | ifneq ($(ccache),$(firstword $($(combo_target)CXX))) |
| 95 | $(combo_target)CXX := $(ccache) $($(combo_target)CXX) |
| 96 | endif |
| 97 | ccache = |
Ying Wang | 83f69eb | 2010-10-07 10:45:02 -0700 | [diff] [blame] | 98 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 99 | endif |