forked from gicking/STM8_serial_flasher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·38 lines (28 loc) · 1.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Project: STM8_serial_flasher
CC = gcc
CFLAGS = -c -Wall -pedantic -I./STM8_Routines
LDFLAGS = -g3 -lm
SOURCES = bootloader.c hexfile.c main.c misc.c serial_comm.c
INCLUDES = globals.h misc.h bootloader.h hexfile.h serial_comm.h main.h
STM8FLASH = STM8_Routines/E_W_ROUTINEs_128K_ver_2.1.s19 STM8_Routines/E_W_ROUTINEs_128K_ver_2.0.s19 STM8_Routines/E_W_ROUTINEs_256K_ver_1.0.s19 STM8_Routines/E_W_ROUTINEs_32K_ver_1.3.s19 STM8_Routines/E_W_ROUTINEs_128K_ver_2.1.s19 STM8_Routines/E_W_ROUTINEs_32K_ver_1.4.s19 STM8_Routines/E_W_ROUTINEs_128K_ver_2.2.s19 STM8_Routines/E_W_ROUTINEs_32K_ver_1.0.s19 STM8_Routines/E_W_ROUTINEs_128K_ver_2.4.s19 STM8_Routines/E_W_ROUTINEs_32K_ver_1.2.s19
STM8INCLUDES = $(STM8FLASH:.s19=.h)
OBJDIR = Objects
OBJECTS = $(patsubst %.c, $(OBJDIR)/%.o, $(SOURCES))
BIN = STM8_serial_flasher
RM = rm -fr
.PHONY: clean all default objects
.PRECIOUS: $(BIN) $(OBJECTS)
default: $(BIN) $(OBJDIR)
all: $(STM8INCLUDES) $(SOURCES) $(BIN)
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
${RM} $(OBJECTS) $(OBJDIR) $(BIN) $(BIN).exe *~ .DS_Store
%.h: %.s19 $(STM8FLASH)
xxd -i $< > $@
# link application
$(BIN): $(OBJECTS) $(OBJDIR)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
# compile all *c files
$(OBJDIR)/%.o: %.c $(SOURCES) $(INCLUDES) $(STM8INCLUDES) $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@