forked from DeqingSun/ch55xduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (30 loc) · 1006 Bytes
/
Makefile
File metadata and controls
43 lines (30 loc) · 1006 Bytes
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
39
40
41
42
43
BASENAME=$(shell basename $$(pwd))
EXECUTABLE=$(BASENAME).ihx
#SDCCBASE=/usr/local
SDCCBASE=/opt/sdcc
BINDIR=$(SDCCBASE)/bin
CC=$(BINDIR)/sdcc
LD=$(BINDIR)/sdld
LIBBASE=../../STM8S_StdPeriph_Driver
SDUINO=../../sduino/hardware/sduino/stm8/cores/sduino
PINS=../../sduino/hardware/sduino/stm8/variants/standard
CFLAGS= --debug -mstm8 -DF_CPU=2000000L -DSTM8S103 \
-I. -I$(SDUINO) -I$(LIBBASE)/inc -I$(PINS) -I/usr/share/sdcc/include/
LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s
OBJECTS=$(BASENAME).rel
SDOBJECTS=HardwareSerial.rel
.PHONY: all clean flash
#all: $(OBJECTS)
$(EXECUTABLE): $(OBJECTS) $(SDOBJECTS)
#test.rel wiring_digital.rel
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
$(OBJECTS) : %.rel : %.c
$(CC) -c $(CFLAGS) $^ -o $@
$(SDOBJECTS) : %.rel : $(SDUINO)/%.c
$(CC) -c $(CFLAGS) $^ -o $@
flash: $(EXECUTABLE)
stm8flash -cstlinkv2 -pstm8s103?3 -w $^
clean:
rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \
*.cdb *.adb *~ *.bak
rm -f $(EXECUTABLE)