-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (39 loc) · 1.3 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
CC = thumb-elf-gcc
AS = thumb-elf-as
OBJCOPY = thumb-elf-objcopy
.SFILES = crt0.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 0x08000000 -Tbss 0x03000000 \
-L$(AGBLIB) -lagbsyscall
DEPENDFILE = multi_boot.dep
MAPFILE = multi_boot.map
TARGET_ELF = multi_boot.elf
TARGET_BIN = multi_boot.bin
CLIENT_OFILE = demo_LZ.o
default:
@$(MAKE) -f MakefileClient
@$(MAKE) $(TARGET_BIN)
$(TARGET_BIN): $(TARGET_ELF)
$(OBJCOPY) -v -O binary $< $@
$(TARGET_ELF): $(.OFILES) Makefile $(DEPENDFILE) $(CLIENT_OFILE)
@echo > $(MAPFILE)
$(CC) -g -o $@ $(.OFILES) $(CLIENT_OFILE) -Wl,$(LDFLAGS)
.PHONY: all clean depend
all: clean default
clean:
@$(MAKE) -f MakefileClient clean
-rm $(.OFILES) $(DEPENDFILE) $(MAPFILE) $(TARGET_ELF) $(TARGET_BIN)
depend:
@$(MAKE) -f MakefileClient depend
$(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)
$(DEPENDFILE):
true $(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)
include Gasdepend
include $(DEPENDFILE)