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