replaced variable name to CMDEXE from UNAME.
removed the rule that .d files are converted to .P files.
This commit is contained in:
@@ -34,7 +34,7 @@ CXX = $(CROSS_COMPILE)g++
|
|||||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
SIZE = $(CROSS_COMPILE)size
|
SIZE = $(CROSS_COMPILE)size
|
||||||
MKDIR = mkdir
|
MKDIR = mkdir
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
CP = copy
|
CP = copy
|
||||||
RM = del
|
RM = del
|
||||||
else
|
else
|
||||||
|
@@ -81,7 +81,7 @@ uf2: $(BUILD)/$(BOARD)-firmware.uf2
|
|||||||
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
||||||
$(OBJ): | $(OBJ_DIRS)
|
$(OBJ): | $(OBJ_DIRS)
|
||||||
$(OBJ_DIRS):
|
$(OBJ_DIRS):
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
@$(MKDIR) $(subst /,\,$@)
|
@$(MKDIR) $(subst /,\,$@)
|
||||||
else
|
else
|
||||||
@$(MKDIR) -p $@
|
@$(MKDIR) -p $@
|
||||||
@@ -111,15 +111,6 @@ vpath %.c . $(TOP)
|
|||||||
$(BUILD)/obj/%.o: %.c
|
$(BUILD)/obj/%.o: %.c
|
||||||
@echo CC $(notdir $@)
|
@echo CC $(notdir $@)
|
||||||
@$(CC) $(CFLAGS) -c -MD -o $@ $<
|
@$(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.
|
|
||||||
@$(CP) $(@:.o=.d) $(@:.o=.P); \
|
|
||||||
$(SED) -e 's/#.*//' -e 's/^.*: *//' -e 's/ *\\$$//' \
|
|
||||||
-e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.d) >> $(@:.o=.P); \
|
|
||||||
$(RM) $(@:.o=.d)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# ASM sources lower case .s
|
# ASM sources lower case .s
|
||||||
vpath %.s . $(TOP)
|
vpath %.s . $(TOP)
|
||||||
@@ -140,7 +131,7 @@ size: $(BUILD)/$(BOARD)-firmware.elf
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
rd /S /Q $(subst /,\,$(BUILD))
|
rd /S /Q $(subst /,\,$(BUILD))
|
||||||
else
|
else
|
||||||
$(RM) -rf $(BUILD)
|
$(RM) -rf $(BUILD)
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -13,7 +13,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -14,7 +14,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -13,7 +13,7 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
|
|||||||
|
|
||||||
# due to tusb_hal_nrf_power_event
|
# due to tusb_hal_nrf_power_event
|
||||||
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
|
||||||
CFLAGS += -Wno-error=cast-function-type
|
CFLAGS += -Wno-error=cast-function-type
|
||||||
endif
|
endif
|
||||||
|
@@ -2,10 +2,10 @@ ifneq ($(lastword a b),b)
|
|||||||
$(error This Makefile require make 3.81 or newer)
|
$(error This Makefile require make 3.81 or newer)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Detect windows or not
|
# Detect whether shell style is windows or not
|
||||||
# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
|
# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
|
||||||
ifeq '$(findstring ;,$(PATH))' ';'
|
ifeq '$(findstring ;,$(PATH))' ';'
|
||||||
UNAME := Windows
|
CMDEXE := 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Set TOP to be the path to get from the current directory (where make was
|
# Set TOP to be the path to get from the current directory (where make was
|
||||||
@@ -15,14 +15,14 @@ endif
|
|||||||
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||||
TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE))
|
TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE))
|
||||||
|
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi))
|
TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi))
|
||||||
else
|
else
|
||||||
TOP := $(shell realpath $(TOP))
|
TOP := $(shell realpath $(TOP))
|
||||||
endif
|
endif
|
||||||
#$(info Top directory is $(TOP))
|
#$(info Top directory is $(TOP))
|
||||||
|
|
||||||
ifeq ($(UNAME),Windows)
|
ifeq ($(CMDEXE),1)
|
||||||
CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%)))
|
CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%)))
|
||||||
else
|
else
|
||||||
CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`)
|
CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`)
|
||||||
|
Reference in New Issue
Block a user