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