Skip to content

Commit 301e4ac

Browse files
committed
Fixing Windows not playing nicely with mkdir.
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. 😂
1 parent 764147d commit 301e4ac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ GDB = $(CROSS_COMPILE)gdb
4747
NRFUTIL = adafruit-nrfutil
4848
NRFJPROG = nrfjprog
4949

50-
MK = mkdir -p
51-
RM = rm -rf
50+
# Set make directory command, Windows tries to create a directory named "-p" if that flag is there.
51+
ifneq ($(OS), Windows_NT)
52+
MK := mkdir -p
53+
else
54+
MK := mkdir
55+
endif
56+
57+
RM := rm -rf
5258

5359
# auto-detect BMP on macOS, otherwise have to specify
5460
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
@@ -324,7 +330,7 @@ print-%:
324330

325331
# Create build directories
326332
$(BUILD):
327-
@$(MK) $@
333+
@$(MK) "$@"
328334

329335
clean:
330336
@$(RM) $(BUILD)

0 commit comments

Comments
 (0)