forked from dism-exe/bn6f
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (68 loc) · 1.79 KB
/
Makefile
File metadata and controls
84 lines (68 loc) · 1.79 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
ifneq ($(DEVKITARM),)
include $(DEVKITARM)/base_tools
endif
# binary tools used in build
# (the arm-none-eabi toolchain should be in the path)
MAKE = make
CC = arm-none-eabi-gcc
AS = arm-none-eabi-as
LD = arm-none-eabi-ld
OBJCOPY = arm-none-eabi-objcopy
SHA1SUM = sha1sum
PY = py
# project paths
SRCDIR = asm
BIN = bin
CONST = constants
INC = include
# project files
SFILES = rom.s data.s ewram.s iwram.s
OFILES = $(addprefix $(OBJ),$(SFILES:.s=.o))
BUILD_NAME = bn6f
ROM = $(BUILD_NAME).gba
# build flags
COMPLIANCE_FLAGS = -g -I$(INC)
WFLAGS =
ARCH = -mcpu=arm7tdmi -march=armv4t -mthumb -mthumb-interwork
CDEBUG =
CFLAGS =
ASFLAGS = $(ARCH) $(WFLAGS) $(COMPLIANCE_FLAGS)
LDFLAGS = -Map $(BUILD_NAME).map
LIB =
# TODO: INTEGRATE SCAN INCLUDES
all: $(ROM)
@$(SHA1SUM) -c $(BUILD_NAME).sha1
$(ROM): %.elf
$(OBJCOPY) -O binary $(BUILD_NAME).elf $(ROM)
%.elf: $(OFILES)
$(LD) $(LDFLAGS) -o $(BUILD_NAME).elf -T ld_script.ld $(OFILES) $(LIB)
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
checksum:
@$(SHA1SUM) -c $(BUILD_NAME).sha1
fdiff:
$(PY) tools/fdiff.py $(BUILD_NAME).ign $(ROM) -s2
tail: $(ROM)
@# Create tail.bin using the tail location in current elf then compile again
$(PY) tools/gen_obj_tail.py $(BUILD_NAME).elf _$(ROM) bin/tail.bin 'tail'
@echo "Updated tail.bin!"
clean:
rm -f *.o
rm -f *.map
rm -f *.elf
rm -f *.gba
# Rule for how to translate a single c file into an object file.
%.o : %.c
echo compiling $<
echo $(CC) $(CFLAGS) -c $<
$(CC) $(CFLAGS) -E $< > $<.preout
$(CC) $(CFLAGS) -S $<
$(CC) $(CFLAGS) -c $<
echo done compiling $<
# Rule for how to generate the dependencies for the given files.
# -M gcc option generates dependencies.
%.d : %.c
@set -e; rm -f $@; \
$(CC) $(COMPLIANCE_FLAGS ) -M $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$