The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | # Select a combo based on the compiler being used. |
| 2 | # |
| 3 | # Inputs: |
| 4 | # combo_target -- prefix for final variables (HOST_ or TARGET_) |
| 5 | # |
| 6 | # Outputs: |
| 7 | # $(combo_target)OS -- standard name for this host (LINUX, DARWIN, etc.) |
| 8 | # $(combo_target)ARCH -- standard name for process architecture (powerpc, x86, etc.) |
| 9 | # $(combo_target)GLOBAL_CFLAGS -- C compiler flags to use for everything |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 10 | # $(combo_target)RELEASE_CFLAGS -- additional C compiler flags for release builds |
| 11 | # $(combo_target)GLOBAL_ARFLAGS -- flags to use for static linking everything |
| 12 | # $(combo_target)SHLIB_SUFFIX -- suffix of shared libraries |
| 13 | |
| 14 | # Build a target string like "linux-arm" or "darwin-x86". |
| 15 | combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH) |
| 16 | |
| 17 | # Set the defaults. |
| 18 | |
| 19 | HOST_CC ?= $(CC) |
| 20 | HOST_CXX ?= $(CXX) |
| 21 | HOST_AR ?= $(AR) |
| 22 | |
| 23 | $(combo_target)BINDER_MINI := 0 |
| 24 | |
| 25 | $(combo_target)HAVE_EXCEPTIONS := 0 |
| 26 | $(combo_target)HAVE_UNIX_FILE_PATH := 1 |
| 27 | $(combo_target)HAVE_WINDOWS_FILE_PATH := 0 |
| 28 | $(combo_target)HAVE_RTTI := 1 |
| 29 | $(combo_target)HAVE_CALL_STACKS := 1 |
| 30 | $(combo_target)HAVE_64BIT_IO := 1 |
| 31 | $(combo_target)HAVE_CLOCK_TIMERS := 1 |
| 32 | $(combo_target)HAVE_PTHREAD_RWLOCK := 1 |
| 33 | $(combo_target)HAVE_STRNLEN := 1 |
| 34 | $(combo_target)HAVE_STRERROR_R_STRRET := 1 |
| 35 | $(combo_target)HAVE_STRLCPY := 0 |
| 36 | $(combo_target)HAVE_STRLCAT := 0 |
| 37 | $(combo_target)HAVE_KERNEL_MODULES := 0 |
| 38 | |
| 39 | # These flags might (will) be overridden by the target makefiles |
| 40 | $(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 41 | $(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing |
| 42 | $(combo_target)GLOBAL_ARFLAGS := crs |
| 43 | |
| 44 | $(combo_target)EXECUTABLE_SUFFIX := |
| 45 | $(combo_target)SHLIB_SUFFIX := .so |
| 46 | $(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX) |
| 47 | $(combo_target)STATIC_LIB_SUFFIX := .a |
| 48 | |
| 49 | $(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map |
| 50 | |
| 51 | # We try to find a target or host specific file for the os/arch specified, and |
| 52 | # default to just looking for the os/arch one. This will allow us to define |
| 53 | # things separately for targets and hosts that have the same architecture |
| 54 | # but need different defines. e.g. target_linux-x86 and host_linux-x86 |
| 55 | |
| 56 | ifneq ($(TARGET_SIMULATOR),true) |
| 57 | # Convert the combo_target string to lowercase |
| 58 | combo_target_lc := $(shell echo $(combo_target) | tr '[A-Z]' '[a-z]') |
| 59 | |
| 60 | # form combo makefile name like "<path>/target_linux-x86.make", |
| 61 | # "<path>/host_darwin-x86.make", etc. |
| 62 | combo_target_os_arch := $(BUILD_COMBOS)/$(combo_target_lc)$(combo_os_arch).mk |
| 63 | else |
| 64 | combo_target_os_arch := |
| 65 | endif |
| 66 | |
| 67 | # Now include the combo for this specific target. |
| 68 | ifneq ($(wildcard $(combo_target_os_arch)),) |
| 69 | include $(combo_target_os_arch) |
| 70 | else |
| 71 | include $(BUILD_COMBOS)/$(combo_os_arch).mk |
| 72 | endif |
| 73 | |
| 74 | ifneq ($(USE_CCACHE),) |
| 75 | ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache |
| 76 | $(combo_target)CC := $(ccache) $($(combo_target)CC) |
| 77 | $(combo_target)CXX := $(ccache) $($(combo_target)CXX) |
| 78 | ccache = |
| 79 | endif |