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 # Settings to use MinGW as a cross-compiler under Linux 18 # Included by combo/select.make 19 20 $(combo_var_prefix)GLOBAL_CFLAGS += -DUSE_MINGW -DWIN32_LEAN_AND_MEAN 21 $(combo_var_prefix)GLOBAL_CFLAGS += -Wno-unused-parameter 22 $(combo_var_prefix)GLOBAL_CFLAGS += --sysroot prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32 23 $(combo_var_prefix)GLOBAL_CFLAGS += -m32 24 $(combo_var_prefix)GLOBAL_LDFLAGS += -m32 25 TOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32- 26 $(combo_var_prefix)C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include 27 $(combo_var_prefix)C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include 28 $(combo_var_prefix)GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32 29 30 # Workaround differences in inttypes.h between host and target. 31 # See bug 12708004. 32 $(combo_var_prefix)GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS 33 # Use C99-compliant printf functions (%zd). 34 $(combo_var_prefix)GLOBAL_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 35 # Admit to using >= Vista. Both are needed because of <_mingw.h>. 36 $(combo_var_prefix)GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0600 -DWINVER=0x0600 37 # Get 64-bit off_t and related functions. 38 $(combo_var_prefix)GLOBAL_CFLAGS += -D_FILE_OFFSET_BITS=64 39 40 $(combo_var_prefix)CC := $(TOOLS_PREFIX)gcc 41 $(combo_var_prefix)CXX := $(TOOLS_PREFIX)g++ 42 $(combo_var_prefix)AR := $(TOOLS_PREFIX)ar 43 $(combo_var_prefix)NM := $(TOOLS_PREFIX)nm 44 $(combo_var_prefix)OBJDUMP := $(TOOLS_PREFIX)objdump 45 46 define $(combo_var_prefix)transform-shared-lib-to-toc 47 $(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OBJDUMP) -x $(1) | grep "^Name" | cut -f3 -d" " > $(2) 48 $(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)NM) -g -f p $(1) | cut -f1-2 -d" " >> $(2) 49 endef 50 51 $(combo_var_prefix)GLOBAL_LDFLAGS += \ 52 --enable-stdcall-fixup 53 54 ifneq ($(strip $(BUILD_HOST_static)),) 55 # Statically-linked binaries are desirable for sandboxed environment 56 $(combo_var_prefix)GLOBAL_LDFLAGS += -static 57 endif # BUILD_HOST_static 58 59 $(combo_var_prefix)SHLIB_SUFFIX := .dll 60 $(combo_var_prefix)EXECUTABLE_SUFFIX := .exe 61 62 $(combo_var_prefix)IS_64_BIT := 63 64 # The mingw gcc is 4.8, 4.9 is required for color diagnostics 65 $(combo_var_prefix)UNKNOWN_CFLAGS := -fdiagnostics-color 66