HOST_darwin-x86.mk revision 80cfc37d0f0ddbb7db09b7662b84e816ab409537
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
26# Use the Mac OSX SDK 10.5 if the build host is 10.6
27build_mac_version := $(shell sw_vers -productVersion)
28ifneq ($(filter 10.6.%, $(build_mac_version)),)
29sdk_105_root := /Developer/SDKs/MacOSX10.5.sdk
30ifeq ($(wildcard $(sdk_105_root)),)
31$(warning *****************************************************)
32$(warning * You are building on Mac OSX 10.6.)
33$(warning * Can not find SDK 10.5 at $(sdk_105_root))
34$(warning *****************************************************)
35$(error Stop.)
36endif
37
38HOST_GLOBAL_CFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
39HOST_GLOBAL_LDFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
40endif # build_mac_version is 10.6
41
42HOST_GLOBAL_CFLAGS += -fPIC
43HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
44
45HOST_CC := $(CC)
46HOST_CXX := $(CXX)
47HOST_AR := $(AR)
48HOST_STRIP := $(STRIP)
49HOST_STRIP_COMMAND = $(HOST_STRIP) --strip-debug $< -o $@
50
51HOST_SHLIB_SUFFIX := .dylib
52HOST_JNILIB_SUFFIX := .jnilib
53
54HOST_GLOBAL_CFLAGS += \
55	-include $(call select-android-config-h,darwin-x86)
56ifneq ($(filter 10.7.%, $(build_mac_version)),)
57       HOST_RUN_RANLIB_AFTER_COPYING := false
58else
59       HOST_RUN_RANLIB_AFTER_COPYING := true
60       PRE_LION_DYNAMIC_LINKER_OPTIONS := -Wl,-dynamic
61endif
62HOST_GLOBAL_ARFLAGS := cqs
63
64HOST_CUSTOM_LD_COMMAND := true
65
66define transform-host-o-to-shared-lib-inner
67$(hide) $(PRIVATE_CXX) \
68        -dynamiclib -single_module -read_only_relocs suppress \
69        $(HOST_GLOBAL_LD_DIRS) \
70        $(HOST_GLOBAL_LDFLAGS) \
71        $(PRIVATE_ALL_OBJECTS) \
72        $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
73        $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
74        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
75        $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
76        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
77        $(PRIVATE_LDLIBS) \
78        -o $@ \
79        $(PRIVATE_LDFLAGS) \
80        $(HOST_LIBGCC)
81endef
82
83define transform-host-o-to-executable-inner
84$(hide) $(PRIVATE_CXX) \
85        -o $@ \
86        $(PRE_LION_DYNAMIC_LINKER_OPTIONS) -headerpad_max_install_names \
87        $(HOST_GLOBAL_LD_DIRS) \
88        $(HOST_GLOBAL_LDFLAGS) \
89        $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
90        $(PRIVATE_ALL_OBJECTS) \
91        $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
92        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
93        $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
94        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
95        $(PRIVATE_LDFLAGS) \
96        $(PRIVATE_LDLIBS) \
97        $(HOST_LIBGCC)
98endef
99
100# $(1): The file to check
101define get-file-size
102stat -f "%z" $(1)
103endef
104