summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2016-08-10 10:19:16 +0200
committerDamien George <damien.p.george@gmail.com>2017-05-03 10:37:51 +1000
commit5b57ae985ff7064dd7b09b0ce891697bfaa5dae2 (patch)
treecb080f759cee7758045aa1031164b2d6010d21a5
parent7d4ba9d257865548e402e65033ac9c72307b6983 (diff)
downloadmicropython-5b57ae985ff7064dd7b09b0ce891697bfaa5dae2.tar.gz
micropython-5b57ae985ff7064dd7b09b0ce891697bfaa5dae2.zip
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.
-rw-r--r--mpy-cross/Makefile8
1 files 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)