Skip to content

Commit c062990

Browse files
committed
Make Makefile work across OS
1 parent 8f653d6 commit c062990

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

ports/cxd56/Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ SPRESENSE_SDK = spresense-exported-sdk
6262

6363
FIRMWARE = $(SPRESENSE_SDK)/firmware
6464

65+
# Platforms are: Linux, Darwin, MSYS, CYGWIN
66+
PLATFORM := $(firstword $(subst _, ,$(shell uname -s 2>/dev/null)))
67+
68+
ifeq ($(PLATFORM),Darwin)
69+
# macOS
70+
MKSPK = $(SPRESENSE_SDK)/sdk/tools/macos/mkspk
71+
else ifeq ($(PLATFORM),Linux)
72+
# Linux
73+
MKSPK = $(SPRESENSE_SDK)/sdk/tools/linux/mkspk
74+
else
75+
# Cygwin/MSYS2
76+
MKSPK = $(SPRESENSE_SDK)/sdk/tools/windows/mkspk.exe
77+
endif
78+
6579
INC += \
6680
-I. \
6781
-I../.. \
@@ -186,7 +200,7 @@ $(BUILD)/circuitpython.elf: $(BUILD)/libmpy.a
186200

187201
$(BUILD)/circuitpython.spk: $(BUILD)/circuitpython.elf
188202
$(ECHO) "Creating $@"
189-
$(SPRESENSE_SDK)/sdk/tools/linux/mkspk -c 2 $(BUILD)/circuitpython.elf nuttx $(BUILD)/circuitpython.spk
203+
$(MKSPK) -c 2 $(BUILD)/circuitpython.elf nuttx $(BUILD)/circuitpython.spk
190204

191205
flash: $(BUILD)/circuitpython.spk
192206
$(ECHO) "Writing $< to the board"

0 commit comments

Comments
 (0)