-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefileClient
66 lines (44 loc) · 1.4 KB
/
MakefileClient
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
CC = thumb-elf-gcc
AS = thumb-elf-as
OBJCOPY = thumb-elf-objcopy
.SFILES = crt0_multi_boot.s
.CFILES =
.OFILES = $(.SFILES:.s=.o) $(.CFILES:.c=.o)
AGBINC = $(AGBDIR)/include
AGBLIB = $(AGBDIR)/lib
ASFLAGS = -I$(AGBINC) -mthumb-interwork
CFLAGS = -g -O2 -I$(AGBINC) -mthumb-interwork \
-nostdlib #-DNDEBUG
LDFLAGS += -Map $(MAPFILE) -nostartfiles \
-Ttext 0x02000000 -Tbss 0x03000000 \
-L$(AGBLIB) -lagbsyscall
MAPFILE = client.map
TARGET_ELF = client.elf
TARGET_BIN = client.bin
COMP_OFILE = demo_LZ.o
COMP_BIN = demo_LZ.bin
DEMO_BIN = demo.bin
default:
@$(MAKE) -f MakefileDemo
@$(MAKE) -f MakefileClient $(TARGET_BIN)
@$(MAKE) -f MakefileClient compare
$(TARGET_BIN): $(TARGET_ELF)
$(OBJCOPY) -v -O binary $< $@
$(TARGET_ELF): $(.OFILES) Makefile $(COMP_OFILE)
@echo > $(MAPFILE)
$(CC) -g -o $@ $(.OFILES) $(COMP_OFILE) -Wl,$(LDFLAGS)
$(COMP_OFILE): $(COMP_BIN)
$(OBJCOPY) -I binary -O elf32-little $< $@
$(COMP_BIN): $(DEMO_BIN)
agbcomp -b -l $<
.PHONY: all compare clean depend
all: clean default
compare:
md5sum -c client.md5 || true
clean:
@$(MAKE) -f MakefileDemo clean
-rm $(.OFILES) $(MAPFILE) $(TARGET_ELF) $(TARGET_BIN) \
$(COMP_OFILE) $(COMP_BIN)
depend:
@$(MAKE) -f MakefileDemo depend
include GasdependClient