16feb6d5607ce86a446645564212043964628f540Ying Wang# 26feb6d5607ce86a446645564212043964628f540Ying Wang# Copyright (C) 2006 The Android Open Source Project 36feb6d5607ce86a446645564212043964628f540Ying Wang# 46feb6d5607ce86a446645564212043964628f540Ying Wang# Licensed under the Apache License, Version 2.0 (the "License"); 56feb6d5607ce86a446645564212043964628f540Ying Wang# you may not use this file except in compliance with the License. 66feb6d5607ce86a446645564212043964628f540Ying Wang# You may obtain a copy of the License at 76feb6d5607ce86a446645564212043964628f540Ying Wang# 86feb6d5607ce86a446645564212043964628f540Ying Wang# http://www.apache.org/licenses/LICENSE-2.0 96feb6d5607ce86a446645564212043964628f540Ying Wang# 106feb6d5607ce86a446645564212043964628f540Ying Wang# Unless required by applicable law or agreed to in writing, software 116feb6d5607ce86a446645564212043964628f540Ying Wang# distributed under the License is distributed on an "AS IS" BASIS, 126feb6d5607ce86a446645564212043964628f540Ying Wang# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136feb6d5607ce86a446645564212043964628f540Ying Wang# See the License for the specific language governing permissions and 146feb6d5607ce86a446645564212043964628f540Ying Wang# limitations under the License. 156feb6d5607ce86a446645564212043964628f540Ying Wang# 166feb6d5607ce86a446645564212043964628f540Ying Wang 176feb6d5607ce86a446645564212043964628f540Ying Wang# Configuration for Darwin (Mac OS X) on x86_64. 186feb6d5607ce86a446645564212043964628f540Ying Wang# Included by combo/select.mk 196feb6d5607ce86a446645564212043964628f540Ying Wang 206feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_CFLAGS += -m64 216feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_LDFLAGS += -m64 226feb6d5607ce86a446645564212043964628f540Ying Wang 236feb6d5607ce86a446645564212043964628f540Ying Wangifneq ($(strip $(BUILD_HOST_static)),) 246feb6d5607ce86a446645564212043964628f540Ying Wang# Statically-linked binaries are desirable for sandboxed environment 256feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_LDFLAGS += -static 266feb6d5607ce86a446645564212043964628f540Ying Wangendif # BUILD_HOST_static 276feb6d5607ce86a446645564212043964628f540Ying Wang 286feb6d5607ce86a446645564212043964628f540Ying Wang# Workaround differences in inttypes.h between host and target. 296feb6d5607ce86a446645564212043964628f540Ying Wang# See bug 12708004. 306feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS 316feb6d5607ce86a446645564212043964628f540Ying Wang 326feb6d5607ce86a446645564212043964628f540Ying Wanginclude $(BUILD_COMBOS)/mac_version.mk 336feb6d5607ce86a446645564212043964628f540Ying Wang 346feb6d5607ce86a446645564212043964628f540Ying WangHOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1 356feb6d5607ce86a446645564212043964628f540Ying WangHOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version) 366feb6d5607ce86a446645564212043964628f540Ying Wang# Don't do anything if the toolchain is not there 376feb6d5607ce86a446645564212043964628f540Ying Wangifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc))) 386feb6d5607ce86a446645564212043964628f540Ying WangHOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc 396feb6d5607ce86a446645564212043964628f540Ying WangHOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++ 406feb6d5607ce86a446645564212043964628f540Ying Wangifeq ($(mac_sdk_version),10.8) 416feb6d5607ce86a446645564212043964628f540Ying Wang# Mac SDK 10.8 no longer has stdarg.h, etc 426feb6d5607ce86a446645564212043964628f540Ying Wanghost_toolchain_header := $(HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include 436feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header) 446feb6d5607ce86a446645564212043964628f540Ying Wangendif 456feb6d5607ce86a446645564212043964628f540Ying Wangelse 466feb6d5607ce86a446645564212043964628f540Ying WangHOST_CC := gcc 476feb6d5607ce86a446645564212043964628f540Ying WangHOST_CXX := g++ 486feb6d5607ce86a446645564212043964628f540Ying Wangendif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists 496feb6d5607ce86a446645564212043964628f540Ying Wang 506feb6d5607ce86a446645564212043964628f540Ying Wang# gcc location for clang; to be updated when clang is updated 516feb6d5607ce86a446645564212043964628f540Ying Wang# HOST_TOOLCHAIN_ROOT is a Darwin-specific define 526feb6d5607ce86a446645564212043964628f540Ying WangHOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT) 536feb6d5607ce86a446645564212043964628f540Ying Wang 546feb6d5607ce86a446645564212043964628f540Ying WangHOST_AR := $(AR) 556feb6d5607ce86a446645564212043964628f540Ying Wang 566feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version) 576feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) 586feb6d5607ce86a446645564212043964628f540Ying Wang 596feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_CFLAGS += -fPIC -funwind-tables 606feb6d5607ce86a446645564212043964628f540Ying WangHOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error 616feb6d5607ce86a446645564212043964628f540Ying Wang 626feb6d5607ce86a446645564212043964628f540Ying WangHOST_SHLIB_SUFFIX := .dylib 636feb6d5607ce86a446645564212043964628f540Ying WangHOST_JNILIB_SUFFIX := .jnilib 646feb6d5607ce86a446645564212043964628f540Ying Wang 656feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_CFLAGS += \ 666feb6d5607ce86a446645564212043964628f540Ying Wang -include $(call select-android-config-h,darwin-x86) 676feb6d5607ce86a446645564212043964628f540Ying Wang 686feb6d5607ce86a446645564212043964628f540Ying Wangifneq ($(filter 10.7 10.7.% 10.8 10.8.%, $(build_mac_version)),) 696feb6d5607ce86a446645564212043964628f540Ying Wang HOST_RUN_RANLIB_AFTER_COPYING := false 706feb6d5607ce86a446645564212043964628f540Ying Wangelse 716feb6d5607ce86a446645564212043964628f540Ying Wang HOST_RUN_RANLIB_AFTER_COPYING := true 726feb6d5607ce86a446645564212043964628f540Ying Wangendif 736feb6d5607ce86a446645564212043964628f540Ying WangHOST_GLOBAL_ARFLAGS := cqs 746feb6d5607ce86a446645564212043964628f540Ying Wang 756feb6d5607ce86a446645564212043964628f540Ying Wang# We Reuse the following functions with the same name from HOST_darwin-x86.mk: 766feb6d5607ce86a446645564212043964628f540Ying Wang# transform-host-o-to-shared-lib-inner 776feb6d5607ce86a446645564212043964628f540Ying Wang# transform-host-o-to-executable-inner 786feb6d5607ce86a446645564212043964628f540Ying Wang# get-file-size 79