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 builds hosted on linux-x86. |
| 18 | # Included by combo/select.mk |
| 19 | |
| 20 | # $(1): The file to check |
| 21 | define get-file-size |
| 22 | stat --format "%s" "$(1)" | tr -d '\n' |
| 23 | endef |
| 24 | |
Ying Wang | 85e8cda | 2012-11-12 14:31:20 -0800 | [diff] [blame] | 25 | # Previously the prebiult host toolchain is used only for the sdk build, |
| 26 | # that's why we have "sdk" in the path name. |
Ying Wang | 79e3f77 | 2013-02-12 11:48:37 -0800 | [diff] [blame] | 27 | ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),) |
Andrew Hsieh | cbe162e | 2014-03-12 19:27:59 +0800 | [diff] [blame] | 28 | HOST_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk/ |
Ying Wang | 79e3f77 | 2013-02-12 11:48:37 -0800 | [diff] [blame] | 29 | endif |
David 'Digit' Turner | 0960ca7 | 2010-12-10 22:24:06 +0100 | [diff] [blame] | 30 | # Don't do anything if the toolchain is not there |
Andrew Hsieh | cbe162e | 2014-03-12 19:27:59 +0800 | [diff] [blame] | 31 | ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc))) |
| 32 | HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc |
| 33 | HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++ |
| 34 | HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar |
| 35 | endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists |
David 'Digit' Turner | 0960ca7 | 2010-12-10 22:24:06 +0100 | [diff] [blame] | 36 | |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 37 | ifneq ($(strip $(BUILD_HOST_64bit)),) |
| 38 | # By default we build everything in 32-bit, because it gives us |
Andy McFadden | 16e95bb | 2010-02-24 08:29:39 -0800 | [diff] [blame] | 39 | # more consistency between the host tools and the target. |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 40 | # BUILD_HOST_64bit=1 overrides it for tool like emulator |
| 41 | # which can benefit from 64-bit host arch. |
Joshua J. Drake | afb4563 | 2013-12-12 00:41:38 -0600 | [diff] [blame] | 42 | HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack |
| 43 | HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack |
Tim Murray | 02cefc9 | 2014-03-20 13:48:35 -0700 | [diff] [blame] | 44 | # gcc location for clang; to be updated when clang is updated |
| 45 | HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/ |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 46 | else |
Ian Rogers | 35a6b4f | 2013-02-26 15:10:22 -0800 | [diff] [blame] | 47 | # We expect SSE3 floating point math. |
Joshua J. Drake | afb4563 | 2013-12-12 00:41:38 -0600 | [diff] [blame] | 48 | HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack |
| 49 | HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack |
Tim Murray | 02cefc9 | 2014-03-20 13:48:35 -0700 | [diff] [blame] | 50 | # gcc location for clang; to be updated when clang is updated |
| 51 | HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/ |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 52 | endif # BUILD_HOST_64bit |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 53 | |
Andrew Hsieh | f9613a4 | 2012-04-28 00:35:19 +0800 | [diff] [blame] | 54 | ifneq ($(strip $(BUILD_HOST_static)),) |
| 55 | # Statically-linked binaries are desirable for sandboxed environment |
| 56 | HOST_GLOBAL_LDFLAGS += -static |
| 57 | endif # BUILD_HOST_static |
| 58 | |
Ying Wang | 5bdf305 | 2012-09-20 10:06:33 -0700 | [diff] [blame] | 59 | HOST_GLOBAL_CFLAGS += -fPIC \ |
| 60 | -include $(call select-android-config-h,linux-x86) |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 61 | |
Ying Wang | fb64488 | 2010-09-01 16:39:11 -0700 | [diff] [blame] | 62 | # Disable new longjmp in glibc 2.11 and later. See bug 2967937. |
Jim Huang | cb48497 | 2011-09-07 01:25:28 +0800 | [diff] [blame] | 63 | HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 |
Ying Wang | fb64488 | 2010-09-01 16:39:11 -0700 | [diff] [blame] | 64 | |
Ian Rogers | 61e5059 | 2014-01-29 13:09:30 -0800 | [diff] [blame] | 65 | # Workaround differences in inttypes.h between host and target. |
| 66 | # See bug 12708004. |
Ian Rogers | aa54033 | 2014-03-10 16:49:41 -0700 | [diff] [blame] | 67 | HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS |
Ian Rogers | 61e5059 | 2014-01-29 13:09:30 -0800 | [diff] [blame] | 68 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 69 | HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined |