19b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
29b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Copyright (C) 2006 The Android Open Source Project
39b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
49b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Licensed under the Apache License, Version 2.0 (the "License");
59b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# you may not use this file except in compliance with the License.
69b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# You may obtain a copy of the License at
79b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
89b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#      http://www.apache.org/licenses/LICENSE-2.0
99b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
109b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Unless required by applicable law or agreed to in writing, software
119b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# distributed under the License is distributed on an "AS IS" BASIS,
129b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# See the License for the specific language governing permissions and
149b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# limitations under the License.
159b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
169b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
179b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Configuration for Linux on x86.
189b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Included by combo/select.make
199b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
209b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# right now we get these from the environment, but we should
219b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# pick them from the tree somewhere
229b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste QueruTOOLS_PREFIX := #prebuilt/windows/host/bin/
239b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste QueruTOOLS_EXE_SUFFIX := .exe
249b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
259b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Settings to use MinGW has a cross-compiler under Linux
269b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruifneq ($(findstring Linux,$(UNAME)),)
279b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruifneq ($(strip $(USE_MINGW)),)
289b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste QueruHOST_ACP_UNAVAILABLE := true
299b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste QueruTOOLS_EXE_SUFFIX :=
306feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -DUSE_MINGW
31dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -Wno-unused-parameter
32dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += --sysroot=prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32
33dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -m32
34dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32
35dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen HinesTOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-
36dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include
37dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include
38dc64c7b460c5ba3578d2531c33da1df6cc2e4c26Stephen Hines$(combo_2nd_arch_prefix)HOST_GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32
39ed6b8155056c52ac6d6a38151a97fc948b4614c3Andrew Hsiehendif # USE_MINGW
40ed6b8155056c52ac6d6a38151a97fc948b4614c3Andrew Hsiehendif # Linux
419b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
42694b2b7b124eb1c69c9e3277fdb4b714a8084841Ian Rogers# Workaround differences in inttypes.h between host and target.
43694b2b7b124eb1c69c9e3277fdb4b714a8084841Ian Rogers# See bug 12708004.
446feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
45694b2b7b124eb1c69c9e3277fdb4b714a8084841Ian Rogers
466feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
476feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
486feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
496feb6d5607ce86a446645564212043964628f540Ying Wang
506feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += \
516feb6d5607ce86a446645564212043964628f540Ying Wang    -include $(call select-android-config-h,windows)
526feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += \
536feb6d5607ce86a446645564212043964628f540Ying Wang    --enable-stdcall-fixup
549b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
55f9613a4f730b8a385971f95150582b9a543302aeAndrew Hsiehifneq ($(strip $(BUILD_HOST_static)),)
56f9613a4f730b8a385971f95150582b9a543302aeAndrew Hsieh# Statically-linked binaries are desirable for sandboxed environment
576feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
58f9613a4f730b8a385971f95150582b9a543302aeAndrew Hsiehendif # BUILD_HOST_static
599b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
609b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# when building under Cygwin, ensure that we use Mingw compilation by default.
619b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# you can disable this (i.e. to generate Cygwin executables) by defining the
629b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# USE_CYGWIN variable in your environment, e.g.:
639b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
649b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#   export USE_CYGWIN=1
659b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
669b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# note that the -mno-cygwin flags are not needed when cross-compiling the
679b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# Windows host tools on Linux
689b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru#
699b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruifneq ($(findstring CYGWIN,$(UNAME)),)
709b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruifeq ($(strip $(USE_CYGWIN)),)
716feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mno-cygwin
726feb6d5607ce86a446645564212043964628f540Ying Wang$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
739b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruendif
749b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruendif
759b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
766feb6d5607ce86a446645564212043964628f540Ying Wang############################################################
776feb6d5607ce86a446645564212043964628f540Ying Wang## Macros after this line are shared by the 64-bit config.
786feb6d5607ce86a446645564212043964628f540Ying Wang
799b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste QueruHOST_SHLIB_SUFFIX := .dll
809b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste QueruHOST_EXECUTABLE_SUFFIX := .exe
819b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru
829b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# $(1): The file to check
839b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru# TODO: find out what format cygwin's stat(1) uses
849b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Querudefine get-file-size
859b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queru999999999
869b4a81237be29b0aae50d1e370b63a07ea2b88b9Jean-Baptiste Queruendef
87