From 5b57ae985ff7064dd7b09b0ce891697bfaa5dae2 Mon Sep 17 00:00:00 2001 From: stijn Date: Wed, 10 Aug 2016 10:19:16 +0200 Subject: [PATCH] mpy-cross: Fix compiler detection for including windows/fmode.c fmode.c should only be included for builds targetting 'pure' windows, i.e. msvc or mingw builds but not when using msys or cygwin's gcc (see #2298). Just checking if the OS is windows and UNAME doesn't have msys stil leaves the gate open for builds with cygwin's gcc since UNAME there is e.g. CYGWIN_NT-6.1-WOW. Fix this by checking for 'mingw' explicitly in the compiler version; both gcc and clang have the -dumpmachine flag so the check should be ok for all platforms. --- mpy-cross/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index 3d5e5da2f9..6ed4e653f8 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -49,10 +49,10 @@ SRC_C = \ main.c \ gccollect.c \ -ifeq ($(OS),Windows_NT) - ifeq (,$(findstring MSYS,$(UNAME_S))) - SRC_C += windows/fmode.c - endif +# Add fmode when compiling with mingw gcc +COMPILER_TARGET := $(shell $(CC) -dumpmachine) +ifneq (,$(findstring mingw,$(COMPILER_TARGET))) + SRC_C += windows/fmode.c endif OBJ = $(PY_O)