HOST_darwin-x86_64.mk revision 6feb6d5607ce86a446645564212043964628f540
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
17# Configuration for Darwin (Mac OS X) on x86_64.
18# Included by combo/select.mk
19
20HOST_IS_64_BIT := true
21
22HOST_GLOBAL_CFLAGS += -m64
23HOST_GLOBAL_LDFLAGS += -m64
24
25ifneq ($(strip $(BUILD_HOST_static)),)
26# Statically-linked binaries are desirable for sandboxed environment
27HOST_GLOBAL_LDFLAGS += -static
28endif # BUILD_HOST_static
29
30# Workaround differences in inttypes.h between host and target.
31# See bug 12708004.
32HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
33
34include $(BUILD_COMBOS)/mac_version.mk
35
36HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1
37HOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version)
38# Don't do anything if the toolchain is not there
39ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc)))
40HOST_CC  := $(HOST_TOOLCHAIN_PREFIX)-gcc
41HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++
42ifeq ($(mac_sdk_version),10.8)
43# Mac SDK 10.8 no longer has stdarg.h, etc
44host_toolchain_header := $(HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include
45HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header)
46endif
47else
48HOST_CC := gcc
49HOST_CXX := g++
50endif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists
51
52# gcc location for clang; to be updated when clang is updated
53# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
54HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)
55
56HOST_AR := $(AR)
57
58HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
59HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
60
61HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
62HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
63
64HOST_SHLIB_SUFFIX := .dylib
65HOST_JNILIB_SUFFIX := .jnilib
66
67HOST_GLOBAL_CFLAGS += \
68    -include $(call select-android-config-h,darwin-x86)
69
70ifneq ($(filter 10.7 10.7.% 10.8 10.8.%, $(build_mac_version)),)
71       HOST_RUN_RANLIB_AFTER_COPYING := false
72else
73       HOST_RUN_RANLIB_AFTER_COPYING := true
74endif
75HOST_GLOBAL_ARFLAGS := cqs
76
77# We Reuse the following functions with the same name from HOST_darwin-x86.mk:
78# transform-host-o-to-shared-lib-inner
79# transform-host-o-to-executable-inner
80# get-file-size
81