Skip to content

Commit 5b57ae9

Browse files
stinosdpgeorge
authored andcommitted
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 adafruit#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.
1 parent 7d4ba9d commit 5b57ae9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mpy-cross/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ SRC_C = \
4949
main.c \
5050
gccollect.c \
5151

52-
ifeq ($(OS),Windows_NT)
53-
ifeq (,$(findstring MSYS,$(UNAME_S)))
54-
SRC_C += windows/fmode.c
55-
endif
52+
# Add fmode when compiling with mingw gcc
53+
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
54+
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
55+
SRC_C += windows/fmode.c
5656
endif
5757

5858
OBJ = $(PY_O)

0 commit comments

Comments
 (0)