From edc636b5be42fa357f6f8882acdacbecfe0ef34d Mon Sep 17 00:00:00 2001 From: fengbh <1953356163@qq.com> Date: Sat, 13 Jan 2024 01:29:24 +0800 Subject: [PATCH] =?UTF-8?q?detect=20OS=EF=BC=8C=20chose=20RM=20cmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c604f9..0ee3263 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,26 @@ +# detect OS +ifeq ($(OS),Windows_NT) + RM = del /q +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + RM = rm -rf + endif + ifeq ($(UNAME_S),Darwin) + RM = rm -rf + endif + # UNAME_P := $(shell uname -p) + # ifeq ($(UNAME_P),x86_64) + # CCFLAGS += -D AMD64 + # endif + # ifneq ($(filter %86,$(UNAME_P)),) + # CCFLAGS += -D IA32 + # endif + # ifneq ($(filter arm%,$(UNAME_P)),) + # CCFLAGS += -D ARM + # endif +endif + # set CC TOOL CC := sdcc PACKIHX := packihx @@ -19,7 +42,7 @@ OBJ := $(patsubst src/%.c, obj/%.rel, $(SRC)) all: uart_temp.hex clean: - -del /q obj\* + -$(RM) obj\* $(OBJ):obj/%.rel:src/%.c -$(CC) $(CFLAGS) -I $(INC) -c $^ -o $@