-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (27 loc) · 863 Bytes
/
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
.SFILES = jaig.s
.OFILES = $(.SFILES:.s=.o)
.AFILES =
ASFLAGS = -I$(AGBINC) -mthumb-interwork
CFLAGS = -g -c -O2 -I$(AGBINC) -mthumb-interwork -nostdlib #-DNDEBUG
LDFLAGS += -Map $(MAPFILE) -nostartfiles \
-Ttext 0x08000000 -Tbss 0x03000000
MAPFILE = jaig.map
TARGET_ELF = jaig.elf
TARGET_BIN = jaig.bin
.SUFFIXES: .bin
.bin.o:
objcopy -v -I binary -O elf32-little $< $@
$(TARGET_BIN): $(TARGET_ELF)
objcopy -v -O binary $< $@
$(TARGET_ELF): $(.OFILES) Makefile $(DEPENDFILE)
@echo > $(MAPFILE)
$(CC) -g -o $@ $(.OFILES) -Wl,$(LDFLAGS)
.PHONY: all clean depend
all: clean depend $(TARGET_BIN)
clean:
-rm $(.OFILES) $(DEPENDFILE) $(TARGET_ELF)
depend:
$(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)
$(DEPENDFILE):
$(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)
include Gasdepend