-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (42 loc) · 1.04 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
ARCH = -mthumb-interwork -march=armv4t
override CFLAGS += -Wall -mtune=arm7tdmi -ffreestanding -nostdlib -g
ASFLAGS = -g
TARGET = arm-none-eabi-
CC = $(TARGET)gcc
AS = $(TARGET)as
LD = $(TARGET)ld
OBJCOPY = $(TARGET)objcopy
OBJDUMP = $(TARGET)objdump
OBJS = header.o main.o glyph.o minmin.o text.o sound.o
#OBJS += ../aoc2020-gba/day1/day1.a
OBJS2 = header.o main2.o tile.o palette.o screen.o dma.o snake.o input.o arrow.o
all: 00-snake2.gba
glyph.o: font.s
%.o: %.S
$(CC) $(ARCH) $(ASFLAGS) -c $< -o $@
%.o: %.s
$(AS) $(ARCH) $(ASFLAGS) $< -o $@
%.o: %.c
$(CC) $(ARCH) $(CFLAGS) -c $< -o $@
%.lds: %.ld
$(CC) -E -P -x c $< -o $@
%.elf: %.o
$(LD) $< -o $@
00-snake2.elf: $(OBJS2) | gba.lds
$(LD) -T gba.lds $^ -o $@
00-snake.elf: $(OBJS) | gba.lds
$(LD) -T gba.lds $^ -o $@
%.gba: %.elf
$(OBJCOPY) -O binary $< $@
dump:
arm-none-eabi-objdump -D -j .text $(F)
clean:
rm -f *.o *.out *.hex *.elf
deploy: 00-snake2.gba
mount /dev/disk/by-label/GBA /mnt
cp $< /mnt/$<
umount /mnt
sync
.SUFFIXES:
.INTERMEDIATE:
.PHONY: all clean dump