summaryrefslogtreecommitdiffstats
path: root/core/combo/select.mk
blob: c54da2273f6ad2356ccd82bd5ee7f35a38fdd866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Select a combo based on the compiler being used.
#
# Inputs:
#	combo_target -- prefix for final variables (HOST_ or TARGET_)
#
# Outputs:
#   $(combo_target)OS -- standard name for this host (LINUX, DARWIN, etc.)
#   $(combo_target)ARCH -- standard name for process architecture (powerpc, x86, etc.)
#   $(combo_target)GLOBAL_CFLAGS -- C compiler flags to use for everything
#   $(combo_target)DEBUG_CFLAGS -- additional C compiler flags for debug builds
#   $(combo_target)RELEASE_CFLAGS -- additional C compiler flags for release builds
#   $(combo_target)GLOBAL_ARFLAGS -- flags to use for static linking everything
#   $(combo_target)SHLIB_SUFFIX -- suffix of shared libraries

# Build a target string like "linux-arm" or "darwin-x86".
combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)

# Set the defaults.

HOST_CC ?= $(CC)
HOST_CXX ?= $(CXX)
HOST_AR ?= $(AR)

$(combo_target)BINDER_MINI := 0

$(combo_target)HAVE_EXCEPTIONS := 0
$(combo_target)HAVE_UNIX_FILE_PATH := 1
$(combo_target)HAVE_WINDOWS_FILE_PATH := 0
$(combo_target)HAVE_RTTI := 1
$(combo_target)HAVE_CALL_STACKS := 1
$(combo_target)HAVE_64BIT_IO := 1
$(combo_target)HAVE_CLOCK_TIMERS := 1
$(combo_target)HAVE_PTHREAD_RWLOCK := 1
$(combo_target)HAVE_STRNLEN := 1
$(combo_target)HAVE_STRERROR_R_STRRET := 1
$(combo_target)HAVE_STRLCPY := 0
$(combo_target)HAVE_STRLCAT := 0
$(combo_target)HAVE_KERNEL_MODULES := 0

# These flags might (will) be overridden by the target makefiles
$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
$(combo_target)DEBUG_CFLAGS := -O0 -g
$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
$(combo_target)GLOBAL_ARFLAGS := crs

$(combo_target)EXECUTABLE_SUFFIX := 
$(combo_target)SHLIB_SUFFIX := .so
$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
$(combo_target)STATIC_LIB_SUFFIX := .a

$(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map

# We try to find a target or host specific file for the os/arch specified, and
# default to just looking for the os/arch one. This will allow us to define
# things separately for targets and hosts that have the same architecture
# but need different defines. e.g. target_linux-x86 and host_linux-x86

ifneq ($(TARGET_SIMULATOR),true)
# Convert the combo_target string to lowercase
combo_target_lc := $(shell echo $(combo_target) | tr '[A-Z]' '[a-z]')

# form combo makefile name like "<path>/target_linux-x86.make",
# "<path>/host_darwin-x86.make", etc.
combo_target_os_arch := $(BUILD_COMBOS)/$(combo_target_lc)$(combo_os_arch).mk
else
combo_target_os_arch :=
endif

# Now include the combo for this specific target.
ifneq ($(wildcard $(combo_target_os_arch)),)
include $(combo_target_os_arch)
else
include $(BUILD_COMBOS)/$(combo_os_arch).mk
endif

ifneq ($(USE_CCACHE),)
  ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
  $(combo_target)CC := $(ccache) $($(combo_target)CC)
  $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
  ccache =
endif