select.mk revision 5bbd2294e9ba74462b940e9ef2f879c0ce4ef8a7
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)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".
15combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
16
17# Set the defaults.
18
19HOST_CC ?= $(CC)
20HOST_CXX ?= $(CXX)
21HOST_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
41$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
42$(combo_target)GLOBAL_LDFLAGS :=
43$(combo_target)GLOBAL_ARFLAGS := crsP
44
45$(combo_target)EXECUTABLE_SUFFIX := 
46$(combo_target)SHLIB_SUFFIX := .so
47$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
48$(combo_target)STATIC_LIB_SUFFIX := .a
49
50$(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map
51
52# We try to find a target or host specific file for the os/arch specified, and
53# default to just looking for the os/arch one. This will allow us to define
54# things separately for targets and hosts that have the same architecture
55# but need different defines. e.g. target_linux-x86 and host_linux-x86
56
57ifneq ($(TARGET_SIMULATOR),true)
58# Convert the combo_target string to lowercase
59combo_target_lc := $(shell echo $(combo_target) | tr '[A-Z]' '[a-z]')
60
61# form combo makefile name like "<path>/target_linux-x86.make",
62# "<path>/host_darwin-x86.make", etc.
63combo_target_os_arch := $(BUILD_COMBOS)/$(combo_target_lc)$(combo_os_arch).mk
64else
65combo_target_os_arch :=
66endif
67
68# Now include the combo for this specific target.
69ifneq ($(wildcard $(combo_target_os_arch)),)
70include $(combo_target_os_arch)
71else
72include $(BUILD_COMBOS)/$(combo_os_arch).mk
73endif
74
75ifneq ($(USE_CCACHE),)
76  ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
77  $(combo_target)CC := $(ccache) $($(combo_target)CC)
78  $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
79  ccache =
80endif
81