summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Tomaszewski <kamil.tomaszewski@sony.com>2019-10-11 11:17:28 +0200
committerKamil Tomaszewski <kamil.tomaszewski@sony.com>2019-10-11 12:09:51 +0200
commitc062990830891cd4193563a4a11eabbec25b1b57 (patch)
treef3576b17c75d2b69aee5baeea944649967a3a45d
parent8f653d62384fd9463d1c4df5c9ded4fe8546c6d4 (diff)
Make Makefile work across OS
-rw-r--r--ports/cxd56/Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile
index 69c8e1bef..c7350a652 100644
--- a/ports/cxd56/Makefile
+++ b/ports/cxd56/Makefile
@@ -62,6 +62,20 @@ SPRESENSE_SDK = spresense-exported-sdk
FIRMWARE = $(SPRESENSE_SDK)/firmware
+# Platforms are: Linux, Darwin, MSYS, CYGWIN
+PLATFORM := $(firstword $(subst _, ,$(shell uname -s 2>/dev/null)))
+
+ifeq ($(PLATFORM),Darwin)
+ # macOS
+ MKSPK = $(SPRESENSE_SDK)/sdk/tools/macos/mkspk
+else ifeq ($(PLATFORM),Linux)
+ # Linux
+ MKSPK = $(SPRESENSE_SDK)/sdk/tools/linux/mkspk
+else
+ # Cygwin/MSYS2
+ MKSPK = $(SPRESENSE_SDK)/sdk/tools/windows/mkspk.exe
+endif
+
INC += \
-I. \
-I../.. \
@@ -186,7 +200,7 @@ $(BUILD)/circuitpython.elf: $(BUILD)/libmpy.a
$(BUILD)/circuitpython.spk: $(BUILD)/circuitpython.elf
$(ECHO) "Creating $@"
- $(SPRESENSE_SDK)/sdk/tools/linux/mkspk -c 2 $(BUILD)/circuitpython.elf nuttx $(BUILD)/circuitpython.spk
+ $(MKSPK) -c 2 $(BUILD)/circuitpython.elf nuttx $(BUILD)/circuitpython.spk
flash: $(BUILD)/circuitpython.spk
$(ECHO) "Writing $< to the board"