HOST_darwin-x86.mk revision 02eb37c267adff3528c9e88cdfdd59035ce934b8
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. 18# Included by combo/select.mk 19 20# We build everything in 32-bit, because some host tools are 21# 32-bit-only anyway (emulator, acc), and because it gives us 22# more consistency between the host tools and the target. 23HOST_GLOBAL_CFLAGS += -m32 24HOST_GLOBAL_LDFLAGS += -m32 25 26build_mac_version := $(shell sw_vers -productVersion) 27mac_sdk_version := 10.6 28mac_sdk_root := /Developer/SDKs/MacOSX$(mac_sdk_version).sdk 29ifeq ($(wildcard $(mac_sdk_root)),) 30recent_xcode4_mac_sdk_root := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(mac_sdk_version).sdk 31ifeq ($(wildcard $(recent_xcode4_mac_sdk_root)),) 32$(warning *****************************************************) 33$(warning * Can not find SDK $(mac_sdk_version) at $(mac_sdk_root)) 34$(warning * or $(recent_xcode4_mac_sdk_root)) 35$(warning *****************************************************) 36$(error Stop.) 37endif 38mac_sdk_root := $(recent_xcode4_mac_sdk_root) 39endif 40 41HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) 42HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) 43 44HOST_GLOBAL_CFLAGS += -fPIC 45HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error 46 47GCC_REALPATH = $(realpath $(shell which gcc)) 48ifneq ($(findstring llvm-gcc,$(GCC_REALPATH)),) 49 # Using LLVM GCC results in a non functional emulator due to it 50 # not honouring global register variables 51 $(warning ****************************************) 52 $(warning * gcc is linked to llvm-gcc which will *) 53 $(warning * not create a useable emulator. *) 54 $(warning ****************************************) 55endif 56 57HOST_CC := gcc 58HOST_CXX := g++ 59HOST_AR := $(AR) 60HOST_STRIP := $(STRIP) 61HOST_STRIP_COMMAND = $(HOST_STRIP) --strip-debug $< -o $@ 62 63HOST_SHLIB_SUFFIX := .dylib 64HOST_JNILIB_SUFFIX := .jnilib 65 66HOST_GLOBAL_CFLAGS += \ 67 -include $(call select-android-config-h,darwin-x86) 68ifneq ($(filter 10.7 10.7.% 10.8 10.8.%, $(build_mac_version)),) 69 HOST_RUN_RANLIB_AFTER_COPYING := false 70else 71 HOST_RUN_RANLIB_AFTER_COPYING := true 72 PRE_LION_DYNAMIC_LINKER_OPTIONS := -Wl,-dynamic 73endif 74HOST_GLOBAL_ARFLAGS := cqs 75 76HOST_CUSTOM_LD_COMMAND := true 77 78define transform-host-o-to-shared-lib-inner 79$(hide) $(PRIVATE_CXX) \ 80 -dynamiclib -single_module -read_only_relocs suppress \ 81 $(HOST_GLOBAL_LD_DIRS) \ 82 $(HOST_GLOBAL_LDFLAGS) \ 83 $(PRIVATE_ALL_OBJECTS) \ 84 $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ 85 $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ 86 $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \ 87 $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ 88 $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \ 89 $(PRIVATE_LDLIBS) \ 90 -o $@ \ 91 $(PRIVATE_LDFLAGS) \ 92 $(HOST_LIBGCC) 93endef 94 95define transform-host-o-to-executable-inner 96$(hide) $(PRIVATE_CXX) \ 97 -o $@ \ 98 $(PRE_LION_DYNAMIC_LINKER_OPTIONS) -headerpad_max_install_names \ 99 $(HOST_GLOBAL_LD_DIRS) \ 100 $(HOST_GLOBAL_LDFLAGS) \ 101 $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ 102 $(PRIVATE_ALL_OBJECTS) \ 103 $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ 104 $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \ 105 $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ 106 $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \ 107 $(PRIVATE_LDFLAGS) \ 108 $(PRIVATE_LDLIBS) \ 109 $(HOST_LIBGCC) 110endef 111 112# $(1): The file to check 113define get-file-size 114stat -f "%z" $(1) 115endef 116