uart_temp/Makefile
2023-12-29 00:57:13 +08:00

42 lines
692 B
Makefile

# set CC TOOL
CC := sdcc
PACKIHX := packihx
# set DIR
INCDIR = include
SRCDIR = src
OBJDIR = obj
TARGET = obj/main.ihx
INC := ./include
SRC := $(wildcard $(SRCDIR)/*.c)
# OBJ := $(SRC:%.c=%.rel)
OBJ := $(patsubst src/%.c, obj/%.rel, $(SRC))
.PHONY: all clean
all: uart_temp.hex
clean:
-del /q obj\*
$(OBJ):obj/%.rel:src/%.c
-$(CC) -I $(INC) -c $^ -o $@
$(TARGET): $(OBJ)
-$(CC) $^ -o $@
uart_temp.hex: $(TARGET)
-$(PACKIHX) $(TARGET) > uart_temp.hex
flash:
-stcgal -P stc89 -p COM3 .\uart_temp.hex
#led.bin:led.hex
# objcopy -I ihex -O binary led.hex led.bin
#led.hex:main.ihx
# packihx main.ihx > led.hex
# led.bin:main.ihx
# makebin main.ihx led.bin