blob: 85d536b4b17b329dfafb711a8716b58e763765a5 [file] [log] [blame]
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -08001#
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
21define get-file-size
22stat --format "%s" "$(1)" | tr -d '\n'
23endef
24
Ying Wang79e3f772013-02-12 11:48:37 -080025ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),)
Andrew Hsiehdfde3602014-03-21 21:05:45 +080026HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
Ying Wang79e3f772013-02-12 11:48:37 -080027endif
David 'Digit' Turner0960ca72010-12-10 22:24:06 +010028# Don't do anything if the toolchain is not there
Andrew Hsiehcbe162e2014-03-12 19:27:59 +080029ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc)))
30HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc
31HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++
32HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar
33endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists
David 'Digit' Turner0960ca72010-12-10 22:24:06 +010034
Andrew Hsiehdfde3602014-03-21 21:05:45 +080035HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
Andrew Hsiehed6b8152012-02-27 21:03:30 -080036ifneq ($(strip $(BUILD_HOST_64bit)),)
37# By default we build everything in 32-bit, because it gives us
Andy McFadden16e95bb2010-02-24 08:29:39 -080038# more consistency between the host tools and the target.
Andrew Hsiehed6b8152012-02-27 21:03:30 -080039# BUILD_HOST_64bit=1 overrides it for tool like emulator
40# which can benefit from 64-bit host arch.
Joshua J. Drakeafb45632013-12-12 00:41:38 -060041HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
42HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
Andrew Hsiehed6b8152012-02-27 21:03:30 -080043else
Ian Rogers35a6b4f2013-02-26 15:10:22 -080044# We expect SSE3 floating point math.
Joshua J. Drakeafb45632013-12-12 00:41:38 -060045HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack
46HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack
Andrew Hsiehed6b8152012-02-27 21:03:30 -080047endif # BUILD_HOST_64bit
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080048
Andrew Hsiehf9613a42012-04-28 00:35:19 +080049ifneq ($(strip $(BUILD_HOST_static)),)
50# Statically-linked binaries are desirable for sandboxed environment
51HOST_GLOBAL_LDFLAGS += -static
52endif # BUILD_HOST_static
53
Ying Wang5bdf3052012-09-20 10:06:33 -070054HOST_GLOBAL_CFLAGS += -fPIC \
55 -include $(call select-android-config-h,linux-x86)
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080056
Ying Wangfb644882010-09-01 16:39:11 -070057# Disable new longjmp in glibc 2.11 and later. See bug 2967937.
Jim Huangcb484972011-09-07 01:25:28 +080058HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
Ying Wangfb644882010-09-01 16:39:11 -070059
Ian Rogers61e50592014-01-29 13:09:30 -080060# Workaround differences in inttypes.h between host and target.
61# See bug 12708004.
Ian Rogersaa540332014-03-10 16:49:41 -070062HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
Ian Rogers61e50592014-01-29 13:09:30 -080063
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080064HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined