From 301e4ace3e9d3e435f3cd43f1442628124af0b18 Mon Sep 17 00:00:00 2001 From: nitz Date: Thu, 16 Jul 2020 21:13:37 -0400 Subject: [PATCH] Fixing Windows not playing nicely with mkdir. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I really don't know why Windows is such a pain sometimes: * The `-p` doesn't get handled as a switch, and instead actually creates a directory named "-p"... * The forward slash in the path being created causes cmd.exe to be sad instead of interpreting it as a path. Quotes around the path makes it happy. One day things will be sane on Windows. Today is not that day. 😂 --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 85d2496..271c030 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,14 @@ GDB = $(CROSS_COMPILE)gdb NRFUTIL = adafruit-nrfutil NRFJPROG = nrfjprog -MK = mkdir -p -RM = rm -rf +# Set make directory command, Windows tries to create a directory named "-p" if that flag is there. +ifneq ($(OS), Windows_NT) +MK := mkdir -p +else +MK := mkdir +endif + +RM := rm -rf # auto-detect BMP on macOS, otherwise have to specify BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1) @@ -324,7 +330,7 @@ print-%: # Create build directories $(BUILD): - @$(MK) $@ + @$(MK) "$@" clean: @$(RM) $(BUILD)