-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (40 loc) · 1.82 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
TARGET = jaysos.gba
ELF = jaysos.elf
KERNOBJ = kernel.o main.o uart.o semaphore.o cond_lock.o msg_queue.o ui_mgr.o util.o malloc.o printf.o libgbfs.o apps/shell.o apps/breakout.o apps/life.o apps/stats.o
KERNSRC = kernel.c kernel.h main.c gba.h uart.c semaphore.c cond_lock.c msg_queue.c ui_mgr.c util.c malloc.c printf.c libgfs.c apps/shell.c apps/breakout.c apps/life.c apps/stats.c
WABASRC = waba/vm/waba.c waba/vm/jaysos/nmjaysos_a.c waba/vm/jaysos/nmjaysos_b.c waba/vm/jaysos/nmjaysos_c.c
WABAOBJ = waba/vm/waba.o waba/vm/jaysos/nmjaysos_a.o waba/vm/jaysos/nmjaysos_b.o waba/vm/jaysos/nmjaysos_c.o
# relative to waba/examples
WABADEMOS = Controls/*.java ImageSplit/*.java ImageView/*.java CoreTest/*.java HelloWorldWABA/*.java Life/*.java Lines/*.java PocketWatch/*.java
SRC = $(KERNSRC) $(WABASRC)
OBJ = $(KERNOBJ) $(WABAOBJ)
INCLUDE = -I. -Iwaba/vm -Iwaba/vm/jaysos
### crt, script and libraries
CRT = lowlevel.o
LDSCRIPT = gba.ld.script
LIBS = -lgcc
### programs
AS = arm-thumb-elf-as -marm7 -mall
CC = arm-thumb-elf-gcc
ELF2BIN = ./gba-elf2bin
### program options
CFLAGS = -Wall -mcpu=arm7tdmi -ffreestanding -fomit-frame-pointer -O3 $(INCLUDE)
LFLAGS = -nostartfiles -nostdlib -Wl,-Ttext=0x08000000,-Tdata=0x03000000,-T,$(LDSCRIPT) $(CRT)
$(TARGET): $(ELF) waba/classfiles.gbfs
$(ELF2BIN) $(ELF) $(TARGET)
cat waba/classfiles.gbfs >> $(TARGET)
lowlevel.o: lowlevel.s
$(AS) -o lowlevel.o lowlevel.s
waba/classfiles.gbfs: $(addprefix waba/examples/, $(WABADEMOS))
cd waba/examples; \
javac $(WABADEMOS) -classpath ../classfiles -d ../classfiles
cd waba/classfiles; \
../../tools/gbfs ../classfiles.gbfs * ; \
cd ../..
$(ELF): $(OBJ) $(CRT)
$(CC) $(CFLAGS) $(LFLAGS) $(OBJ) -o $(ELF) $(LIBS)
clean:
rm -f $(OBJ) $(TARGET) $(BINARY) $(ELF) *~ *.log *.bak *.o
depend:
@makedepend $(INCLUDE) $(SRC)
# DO NOT DELETE