Skip to content

Commit 3289b9b

Browse files
chrismas9dpgeorge
authored andcommitted
py/{mkenv.mk,mkrules.mk}: Append .exe for Windows executable files.
Building mpy-cross: this patch adds .exe to the PROG name when building executables for host (eg mpy-cross) on Windows. make clean now removes mpy-cross.exe under Windows. Building MicroPython: this patch sets MPY_CROSS to mpy-cross.exe or mpy-cross so they can coexist and use cygwin or WSL without rebuilding mpy-cross. The dependency in the mpy rule now uses mpy-cross.exe for Windows and mpy-cross for Linux.
1 parent b00040c commit 3289b9b

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

py/mkenv.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ LD += -m32
5959
endif
6060

6161
MAKE_FROZEN = $(TOP)/tools/make-frozen.py
62+
# allow mpy-cross (for WSL) and mpy-cross.exe (for cygwin) to coexist
63+
ifeq ($(OS),Windows_NT)
64+
MPY_CROSS = $(TOP)/mpy-cross/mpy-cross.exe
65+
PROG_EXT = .exe
66+
else
6267
MPY_CROSS = $(TOP)/mpy-cross/mpy-cross
68+
endif
6369
MPY_TOOL = $(TOP)/tools/mpy-tool.py
6470

6571
all:

py/mkrules.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' |
111111
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
112112

113113
# to build .mpy files from .py files
114-
$(BUILD)/frozen_mpy/%.mpy: $(FROZEN_MPY_DIR)/%.py $(TOP)/mpy-cross/mpy-cross
114+
$(BUILD)/frozen_mpy/%.mpy: $(FROZEN_MPY_DIR)/%.py $(MPY_CROSS)
115115
@$(ECHO) "MPY $<"
116116
$(Q)$(MKDIR) -p $(dir $@)
117117
$(Q)$(MPY_CROSS) -o $@ -s $(<:$(FROZEN_MPY_DIR)/%=%) $(MPY_CROSS_FLAGS) $<
@@ -133,13 +133,13 @@ $(PROG): $(OBJ)
133133
# we may want to compile using Thumb, but link with non-Thumb libc.
134134
$(Q)$(CC) -o $@ $^ $(LIB) $(LDFLAGS)
135135
ifndef DEBUG
136-
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)
136+
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)$(PROG_EXT)
137137
endif
138-
$(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG)
138+
$(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG)$(PROG_EXT)
139139

140140
clean: clean-prog
141141
clean-prog:
142-
$(RM) -f $(PROG)
142+
$(RM) -f $(PROG)$(PROG_EXT)
143143
$(RM) -f $(PROG).map
144144

145145
.PHONY: clean-prog

0 commit comments

Comments
 (0)