-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.mk
45 lines (35 loc) · 861 Bytes
/
common.mk
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
ARCH ?= -mthumb-interwork -march=armv4t
override CFLAGS += -std=gnu2x -g -Og -Wall -Werror -Wno-error=unused-variable -Wno-error=unused-label -I$(PWD)
CARCH ?= -mtune=arm7tdmi -ffreestanding -nostdlib
AFLAGS ?= -g
TARGET ?= arm-none-eabi-
CC = $(TARGET)gcc
AS = $(TARGET)as
LD = $(TARGET)ld
OBJCOPY = $(TARGET)objcopy
OBJDUMP = $(TARGET)objdump
%.o: %.S
$(CC) $(ARCH) $(AFLAGS) -c $< -o $@
%.o: %.s
$(AS) $(ARCH) $(AFLAGS) $< -o $@
%.o: %.c
$(CC) $(ARCH) $(CARCH) $(CFLAGS) -c $< -o $@
%.elf: %.o
$(LD) $< -o $@
%.gba: %.elf
$(OBJCOPY) -O binary $< $@
dump:
$(OBJDUMP) -D -j .text $(F)
clean:
find -regextype posix-extended \
-regex '.*\.(o|out|hex|elf|gba|glyph|binlst)' \
-exec rm -f {} \;
deploy:
mount /dev/disk/by-label/GBA /mnt
cp $< /mnt/$(notdir $<)
umount /mnt
sync
.SUFFIXES:
.INTERMEDIATE:
.SECONDARY:
.PHONY: all clean dump