Skip to content

Commit 3d9af87

Browse files
btongminhdpgeorge
authored andcommitted
windows/Makefile: Add .exe extension to executables name.
Uses the same logic applied in 5b57ae9 to determine when to add .exe. See related: adafruit#3310, adafruit#3361, adafruit#3370, adafruit#4143, adafruit#5727.
1 parent e10a044 commit 3d9af87

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

ports/windows/.appveyor.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ after_test:
6363
throw "$env:MSYSTEM build exited with code $LASTEXITCODE"
6464
}
6565
cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'mpy-cross')
66-
# Building of mpy-cross hasn't been fixed across all possible windows/WSL/...
67-
# variations and the STRIP step tries to strip mpy-cross whereas that should be
68-
# mpy-cross.exe. Workaround for now by skipping actual strip and size commands.
69-
C:\msys64\usr\bin\bash.exe -l -c "make -B -j4 V=1 STRIP=echo SIZE=echo"
66+
C:\msys64\usr\bin\bash.exe -l -c "make -B -j4 V=1"
7067
if ($LASTEXITCODE -ne 0) {
7168
throw "$env:MSYSTEM mpy_cross build exited with code $LASTEXITCODE"
7269
}

ports/windows/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include ../../py/mkenv.mk
22
-include mpconfigport.mk
33

44
# define main target
5-
PROG = micropython.exe
5+
PROG = micropython
66

77
# qstr definitions (must come before including py.mk)
88
QSTR_DEFS = ../unix/qstrdefsport.h

py/mkrules.mk

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ endif
178178
ifneq ($(PROG),)
179179
# Build a standalone executable (unix does this)
180180

181+
# The executable should have an .exe extension for builds targetting 'pure'
182+
# Windows, i.e. msvc or mingw builds, but not when using msys or cygwin's gcc.
183+
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
184+
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
185+
PROG := $(PROG).exe
186+
endif
187+
181188
all: $(PROG)
182189

183190
$(PROG): $(OBJ)
@@ -186,9 +193,9 @@ $(PROG): $(OBJ)
186193
# we may want to compile using Thumb, but link with non-Thumb libc.
187194
$(Q)$(CC) -o $@ $^ $(LIB) $(LDFLAGS)
188195
ifndef DEBUG
189-
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)
196+
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $@
190197
endif
191-
$(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG)
198+
$(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $@
192199

193200
clean: clean-prog
194201
clean-prog:

0 commit comments

Comments
 (0)