-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (49 loc) · 1.26 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
PREFIX = /usr/local
ARCH = h8300-elf
BINDIR = $(PREFIX)/bin
ADDNAME = $(ARCH)-
AR = $(BINDIR)/$(ADDNAME)ar
AS = $(BINDIR)/$(ADDNAME)as
CC = $(BINDIR)/$(ADDNAME)gcc
LD = $(BINDIR)/$(ADDNAME)ld
NM = $(BINDIR)/$(ADDNAME)nm
OBJCOPY = $(BINDIR)/$(ADDNAME)objcopy
OBJDUMP = $(BINDIR)/$(ADDNAME)objdump
RANLIB = $(BINDIR)/$(ADDNAME)ranlib
STRIP = $(BINDIR)/$(ADDNAME)strip
H8WRITE = $(BINDIR)/h8write
H8WRITE_SERDEV = com1
OBJS = vector.o startup.o main.o
OBJS += lib.o
OBJS += led.o sw.o Pool.o
# OBJS += sci.o ringbuf.o intr.o
OBJS += serial.o
OBJS += cmd_map.o StrToken.o
TARGET = kzload
CFLAGS = -Wall -mh -nostdinc -nostdlib -fno-builtin
CFLAGS += -I. -I./include
CFLAGS += -Os
CFLAGS += -DKZLOAD
LFLAGS = -static -T ld.scr -L.
.SUFFIXES: .c .o
.SUFFIXES: .s .o
.SUFFIXES: .S .o
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $(TARGET) $(CFLAGS) $(LFLAGS)
cp $(TARGET) $(TARGET).elf
$(STRIP) $(TARGET)
# readelf -a $(TARGET).elf > readelf.log
.c.o: $<
$(CC) -c $(CFLAGS) $<
.s.o: $<
$(CC) -c $(CFLAGS) $<
.S.o: $<
$(CC) -c $(CFLAGS) $<
$(TARGET).mot: $(TARGET)
$(OBJCOPY) -O srec $(TARGET) $(TARGET).mot
image: $(TARGET).mot
write: $(TARGET).mot
$(H8WRITE) -3048 $(TARGET).mot $(H8WRITE_SERDEV)
clean:
rm -f $(OBJS) $(TARGET) $(TARGET).elf $(TARGET).mot