detect OS, chose RM cmd

This commit is contained in:
fengbh 2024-01-13 01:29:24 +08:00
parent d880f49a4f
commit edc636b5be

View File

@ -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 $@