Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 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 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 20 | $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -m32 |
| 21 | $(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32 |
Jeff Hamilton | ebc2869 | 2010-05-26 18:13:54 -0500 | [diff] [blame] | 22 | |
Andrew Hsieh | f9613a4 | 2012-04-28 00:35:19 +0800 | [diff] [blame] | 23 | ifneq ($(strip $(BUILD_HOST_static)),) |
| 24 | # Statically-linked binaries are desirable for sandboxed environment |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 25 | $(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static |
Andrew Hsieh | f9613a4 | 2012-04-28 00:35:19 +0800 | [diff] [blame] | 26 | endif # BUILD_HOST_static |
| 27 | |
Ian Rogers | 61e5059 | 2014-01-29 13:09:30 -0800 | [diff] [blame] | 28 | # Workaround differences in inttypes.h between host and target. |
| 29 | # See bug 12708004. |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 30 | $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS |
Ian Rogers | 61e5059 | 2014-01-29 13:09:30 -0800 | [diff] [blame] | 31 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 32 | include $(BUILD_COMBOS)/mac_version.mk |
SangWook Han | 691e024 | 2012-07-31 02:09:38 +0900 | [diff] [blame] | 33 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 34 | $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1 |
| 35 | $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version) |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 36 | $(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-gcc |
| 37 | $(combo_2nd_arch_prefix)HOST_CXX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-g++ |
Andrew Hsieh | e2e28f6 | 2012-11-09 21:12:02 -0800 | [diff] [blame] | 38 | |
Shinichiro Hamaji | 0e7587a | 2015-10-09 14:36:04 +0900 | [diff] [blame] | 39 | define $(combo_var_prefix)transform-shared-lib-to-toc |
| 40 | $(call _gen_toc_command_for_macho,$(1),$(2)) |
| 41 | endef |
| 42 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 43 | # gcc location for clang; to be updated when clang is updated |
| 44 | # HOST_TOOLCHAIN_ROOT is a Darwin-specific define |
Ying Wang | ef773d2 | 2014-05-16 16:22:32 -0700 | [diff] [blame] | 45 | $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT) |
Jeff Hamilton | ebc2869 | 2010-05-26 18:13:54 -0500 | [diff] [blame] | 46 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 47 | $(combo_2nd_arch_prefix)HOST_AR := $(AR) |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 48 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 49 | $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version) |
Al Sutton | 1199f73 | 2014-11-10 14:39:14 +0000 | [diff] [blame] | 50 | $(combo_2nd_arch_prefix)HOST_GLOBAL_CPPFLAGS += -isystem $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 51 | $(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 52 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 53 | $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables |
| 54 | $(combo_2nd_arch_prefix)HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error |
| 55 | |
| 56 | $(combo_2nd_arch_prefix)HOST_SHLIB_SUFFIX := .dylib |
| 57 | $(combo_2nd_arch_prefix)HOST_JNILIB_SUFFIX := .jnilib |
| 58 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 59 | $(combo_2nd_arch_prefix)HOST_GLOBAL_ARFLAGS := cqs |
| 60 | |
| 61 | ############################################################ |
| 62 | ## Macros after this line are shared by the 64-bit config. |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 63 | |
| 64 | HOST_CUSTOM_LD_COMMAND := true |
| 65 | |
| 66 | define transform-host-o-to-shared-lib-inner |
Ying Wang | 3a7e4cc | 2011-01-28 14:14:47 -0800 | [diff] [blame] | 67 | $(hide) $(PRIVATE_CXX) \ |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 68 | -dynamiclib -single_module -read_only_relocs suppress \ |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 69 | $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \ |
| 70 | $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \ |
| 71 | $(PRIVATE_HOST_GLOBAL_LDFLAGS) \ |
| 72 | ) \ |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 73 | $(PRIVATE_ALL_OBJECTS) \ |
Shih-wei Liao | b268075 | 2012-05-02 04:41:41 -0700 | [diff] [blame] | 74 | $(addprefix -force_load , $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ |
Ying Wang | 80e6cce | 2011-01-24 23:25:36 -0800 | [diff] [blame] | 75 | $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ |
Ying Wang | 80e6cce | 2011-01-24 23:25:36 -0800 | [diff] [blame] | 76 | $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 77 | $(PRIVATE_LDLIBS) \ |
| 78 | -o $@ \ |
Ying Wang | 5dea692 | 2012-02-01 13:18:20 -0800 | [diff] [blame] | 79 | -install_name @rpath/$(notdir $@) \ |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 80 | -Wl,-rpath,@loader_path/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \ |
Ying Wang | 30127bf | 2015-06-01 10:43:29 -0700 | [diff] [blame] | 81 | -Wl,-rpath,@loader_path/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \ |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 82 | $(PRIVATE_LDFLAGS) |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 83 | endef |
| 84 | |
| 85 | define transform-host-o-to-executable-inner |
Ying Wang | 3a7e4cc | 2011-01-28 14:14:47 -0800 | [diff] [blame] | 86 | $(hide) $(PRIVATE_CXX) \ |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 87 | -Wl,-rpath,@loader_path/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \ |
Ying Wang | 30127bf | 2015-06-01 10:43:29 -0700 | [diff] [blame] | 88 | -Wl,-rpath,@loader_path/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \ |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 89 | -o $@ \ |
Ying Wang | aaf9a5b | 2015-04-09 09:22:36 -0700 | [diff] [blame] | 90 | -Wl,-headerpad_max_install_names \ |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 91 | $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \ |
| 92 | $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \ |
| 93 | $(PRIVATE_HOST_GLOBAL_LDFLAGS) \ |
| 94 | ) \ |
Ying Wang | 80e6cce | 2011-01-24 23:25:36 -0800 | [diff] [blame] | 95 | $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 96 | $(PRIVATE_ALL_OBJECTS) \ |
Ying Wang | 80e6cce | 2011-01-24 23:25:36 -0800 | [diff] [blame] | 97 | $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ |
| 98 | $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 99 | $(PRIVATE_LDFLAGS) \ |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 100 | $(PRIVATE_LDLIBS) |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 101 | endef |
| 102 | |
| 103 | # $(1): The file to check |
| 104 | define get-file-size |
| 105 | stat -f "%z" $(1) |
| 106 | endef |