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 | |
David 'Digit' Turner | 0960ca7 | 2010-12-10 22:24:06 +0100 | [diff] [blame] | 25 | # Special case for the Linux SDK: We need to use a special cross-toolchain |
| 26 | # that generates machine code that will run properly on Ubuntu 8.04 (Hardy) |
| 27 | # By default, the code generated by the Lucid host toolchain will not run |
| 28 | # on previous versions of the platform, due to GLibc ABI mistmatches |
| 29 | # (Lucid is 2.11, Hardy is 2.7) |
| 30 | # |
| 31 | # Note that components that need to be built as 64-bit (e.g. clearsilver |
| 32 | # which is loaded by the 64-bit JVM through JNI), will have to use |
| 33 | # LOCAL_CC and LOCAL_CXX to override this. |
| 34 | # |
Andrew Hsieh | 0e63fd3 | 2012-03-13 02:17:35 -0700 | [diff] [blame] | 35 | HOST_SDK_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk |
David 'Digit' Turner | 0960ca7 | 2010-12-10 22:24:06 +0100 | [diff] [blame] | 36 | # Don't do anything if the toolchain is not there |
Andrew Hsieh | 0e63fd3 | 2012-03-13 02:17:35 -0700 | [diff] [blame] | 37 | ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc))) |
| 38 | HOST_CC := $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc |
| 39 | HOST_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)/g++ |
| 40 | HOST_AR := $(HOST_SDK_TOOLCHAIN_PREFIX)/ar |
| 41 | endif # $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc exists |
David 'Digit' Turner | 0960ca7 | 2010-12-10 22:24:06 +0100 | [diff] [blame] | 42 | |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 43 | ifneq ($(strip $(BUILD_HOST_64bit)),) |
| 44 | # By default we build everything in 32-bit, because it gives us |
Andy McFadden | 16e95bb | 2010-02-24 08:29:39 -0800 | [diff] [blame] | 45 | # more consistency between the host tools and the target. |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 46 | # BUILD_HOST_64bit=1 overrides it for tool like emulator |
| 47 | # which can benefit from 64-bit host arch. |
| 48 | HOST_GLOBAL_CFLAGS += -m64 |
| 49 | HOST_GLOBAL_LDFLAGS += -m64 |
| 50 | else |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 51 | HOST_GLOBAL_CFLAGS += -m32 |
| 52 | HOST_GLOBAL_LDFLAGS += -m32 |
Andrew Hsieh | ed6b815 | 2012-02-27 21:03:30 -0800 | [diff] [blame] | 53 | endif # BUILD_HOST_64bit |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 54 | |
Andrew Hsieh | f9613a4 | 2012-04-28 00:35:19 +0800 | [diff] [blame] | 55 | ifneq ($(strip $(BUILD_HOST_static)),) |
| 56 | # Statically-linked binaries are desirable for sandboxed environment |
| 57 | HOST_GLOBAL_LDFLAGS += -static |
| 58 | endif # BUILD_HOST_static |
| 59 | |
Ying Wang | 5bdf305 | 2012-09-20 10:06:33 -0700 | [diff] [blame] | 60 | HOST_GLOBAL_CFLAGS += -fPIC \ |
| 61 | -include $(call select-android-config-h,linux-x86) |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 62 | |
Ying Wang | fb64488 | 2010-09-01 16:39:11 -0700 | [diff] [blame] | 63 | # Disable new longjmp in glibc 2.11 and later. See bug 2967937. |
Jim Huang | cb48497 | 2011-09-07 01:25:28 +0800 | [diff] [blame] | 64 | HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 |
Ying Wang | fb64488 | 2010-09-01 16:39:11 -0700 | [diff] [blame] | 65 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 66 | HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined |