Fix `make debug-store` (and hence `make upload`) on windows
authorDavid Robertson <david@robertson.yt>
Sat, 23 Sep 2017 20:17:40 +0000 (21:17 +0100)
committerDavid Robertson <david@robertson.yt>
Sat, 23 Sep 2017 20:17:40 +0000 (21:17 +0100)
Note that the cd commands are to avoid having to translate between / and \ as path separators

src/makefile

index 51d1671..8858644 100644 (file)
@@ -108,12 +108,17 @@ include $(BUILD_DIR)/build.mk
 CONSOLE?=/dev/arduino
 BAUD?=9600
 
-.PHONY: debug-store flash upload debug console dfu
+ifneq "$(OS)" "Windows_NT"
+COPY=cp
+else
+COPY=copy
+endif
 
+.PHONY: debug-store flash upload debug console dfu
 print-%  : ; @echo $* = $($*)
 
 debug-store: ../LPC1768/$(PROJECT).elf
-       cp ../LPC1768/$(PROJECT).elf ../LPC1768/$(PROJECT)_lastupload.elf
+       cd .. && cd LPC1768 && $(COPY) $(PROJECT).elf $(PROJECT)_lastupload.elf
 
 flash: ../LPC1768/$(PROJECT).hex debug-store
        lpc21isp $< $(CONSOLE) 115200 12000