added support for cmd.exe as a shell on make.

This commit is contained in:
kkitayam
2021-01-10 20:46:29 +09:00
parent 05728e2b18
commit 8fa083d79e
3 changed files with 29 additions and 1 deletions

View File

@@ -34,9 +34,14 @@ CXX = $(CROSS_COMPILE)g++
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
MKDIR = mkdir
ifeq ($(UNAME),Windows)
CP = copy
RM = del
else
SED = sed
CP = cp
RM = rm
endif
#-------------- Source files and compiler flags --------------

View File

@@ -81,7 +81,11 @@ uf2: $(BUILD)/$(BOARD)-firmware.uf2
OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): | $(OBJ_DIRS)
$(OBJ_DIRS):
ifeq ($(UNAME),Windows)
@$(MKDIR) $(subst /,\,$@)
else
@$(MKDIR) -p $@
endif
$(BUILD)/$(BOARD)-firmware.elf: $(OBJ)
@echo LINK $@
@@ -107,6 +111,7 @@ vpath %.c . $(TOP)
$(BUILD)/obj/%.o: %.c
@echo CC $(notdir $@)
@$(CC) $(CFLAGS) -c -MD -o $@ $<
ifneq ($(UNAME),Windows)
@# The following fixes the dependency file.
@# See http://make.paulandlesley.org/autodep.html for details.
@# Regex adjusted from the above to play better with Windows paths, etc.
@@ -114,6 +119,7 @@ $(BUILD)/obj/%.o: %.c
$(SED) -e 's/#.*//' -e 's/^.*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.d) >> $(@:.o=.P); \
$(RM) $(@:.o=.d)
endif
# ASM sources lower case .s
vpath %.s . $(TOP)
@@ -134,7 +140,11 @@ size: $(BUILD)/$(BOARD)-firmware.elf
.PHONY: clean
clean:
ifeq ($(UNAME),Windows)
rd /S /Q $(subst /,\,$(BUILD))
else
$(RM) -rf $(BUILD)
endif
# Print out the value of a make variable.
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile