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