make: allow multiple source files
This commit is contained in:
parent
b3b2eb4782
commit
9b5e9bb2b3
12
Makefile
12
Makefile
|
@ -1,15 +1,21 @@
|
|||
CC := sdcc
|
||||
CFLAGS := -mstm8 --std-c99 --opt-code-size --Werror
|
||||
LDFLAGS = -mstm8 --out-fmt-ihx -lstm8
|
||||
FIRMWARE := main
|
||||
SRC_FILES := $(wildcard *.c)
|
||||
OBJ_FILES := $(patsubst %.c,%.rel,$(SRC_FILES))
|
||||
|
||||
all: $(FIRMWARE).ihx
|
||||
|
||||
%.ihx: %.c stm8s.h
|
||||
$(CC) $(CFLAGS) --out-fmt-ihx $<
|
||||
$(FIRMWARE).ihx: $(OBJ_FILES)
|
||||
$(CC) $(LDFLAGS) $^ -o $@
|
||||
size $@
|
||||
|
||||
%.rel: %.c %.h
|
||||
$(CC) $(CFLAGS) --compile-only $<
|
||||
|
||||
flash: $(FIRMWARE).ihx
|
||||
stm8flash -c stlinkv2 -p stm8s103f3 -w $<
|
||||
|
||||
clean:
|
||||
rm -f $(FIRMWARE).asm $(FIRMWARE).ihx $(FIRMWARE).cdb $(FIRMWARE).lst $(FIRMWARE).map $(FIRMWARE).lk $(FIRMWARE).rel $(FIRMWARE).rst $(FIRMWARE).sym
|
||||
rm -f $(FIRMWARE).asm $(FIRMWARE).ihx $(FIRMWARE).cdb $(FIRMWARE).lst $(FIRMWARE).map $(FIRMWARE).lk $(FIRMWARE).rel $(FIRMWARE).rst $(FIRMWARE).sym $(OBJ_FILES)
|
||||
|
|
Loading…
Reference in New Issue