-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·73 lines (51 loc) · 1.9 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
PRODUCT_NAME = KathleenTynan-BitmojiJump
SOURCES = myLib.c main.c sprites.c text.c collisions.c background.c platforms.c start.c sound.c clouds.c instructions.c songs.c endScreens.c pause.c
DKPATH = /opt/devkitARM/bin
CCPATH = /usr/bin
VBASIM = wine /Users/kathleentynan/Documents/Spring2017/CS2261/vba.exe
FIND = find
COPY = cp -r
# --- File Names
ELF_NAME = $(PRODUCT_NAME).elf
ROM_NAME = $(PRODUCT_NAME).gba
BIN_NAME = $(PRODUCT_NAME)
#MODEL = -mthumb-interwork -mthumb
MODEL = -mthumb-interwork -marm -mlong-calls #This makes interrupts work
SPECS = -specs=gba.specs
# --- Archiver
AS = $(DKPATH)/arm-none-eabi-as
ASFLAGS = -mthumb-interwork
# --- Compiler
CC = $(DKPATH)/arm-none-eabi-gcc
CFLAGS = $(MODEL) -O2 -Wall -pedantic -Wextra -std=c99 -save-temps -D_ROM=$(ROM_NAME) -D_VBA=$(VBASIM)
# --- Linker
LD = $(DKPATH)/arm-none-eabi-gcc
LDFLAGS = $(SPECS) $(MODEL) -lm
# --- Object/Executable Packager
OBJCOPY = $(DKPATH)/arm-none-eabi-objcopy
OBJCOPYFLAGS = -O binary
# --- ROM Fixer
GBAFIX = $(DKPATH)/gbafix
# --- Delete
RM = rm -f
OBJECTS = $(SOURCES:.c=.o)
# --- Main build target
all : clean build
run : $(ROM_NAME)
$(VBASIM) $(ROM_NAME)
build : $(ROM_NAME)
# --- Build .elf file into .gba ROM file
$(ROM_NAME) : $(ELF_NAME)
$(OBJCOPY) $(OBJCOPYFLAGS) $(ELF_NAME) $(ROM_NAME)
$(GBAFIX) $(ROM_NAME)
# --- Build .o files into .elf file
$(ELF_NAME) : $(OBJECTS)
$(LD) $(OBJECTS) $(LDFLAGS) -o $@
# -- Build .c files into .o files
$(OBJECTS) : %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
$(RM) $(ROM_NAME)
$(RM) $(ELF_NAME)
$(RM) $(BIN_NAME)
$(RM) *.o