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 25 # Previously the prebiult host toolchain is used only for the sdk build, 26 # that's why we have "sdk" in the path name. 27 ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),) 28 HOST_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk 29 endif 30 # Don't do anything if the toolchain is not there 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 36 37 ifneq ($(strip $(BUILD_HOST_64bit)),) 38 # By default we build everything in 32-bit, because it gives us 39 # more consistency between the host tools and the target. 40 # BUILD_HOST_64bit=1 overrides it for tool like emulator 41 # which can benefit from 64-bit host arch. 42 HOST_GLOBAL_CFLAGS += -m64 43 HOST_GLOBAL_LDFLAGS += -m64 44 else 45 # We expect SSE3 floating point math. 46 HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 47 HOST_GLOBAL_LDFLAGS += -m32 48 endif # BUILD_HOST_64bit 49 50 ifneq ($(strip $(BUILD_HOST_static)),) 51 # Statically-linked binaries are desirable for sandboxed environment 52 HOST_GLOBAL_LDFLAGS += -static 53 endif # BUILD_HOST_static 54 55 HOST_GLOBAL_CFLAGS += -fPIC \ 56 -include $(call select-android-config-h,linux-x86) 57 58 # Disable new longjmp in glibc 2.11 and later. See bug 2967937. 59 HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 60 61 HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined 62