forked from jayceekaycee/RedPlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (52 loc) · 1.32 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
PYTHON := python
.SUFFIXES: .asm .tx .o .gbc
.PHONY: all clean red blue compare
.SECONDEXPANSION:
TEXTQUEUE :=
RED_OBJS := \
pokered.o \
audio_red.o \
wram.o \
text.o
BLUE_OBJS := \
pokeblue.o \
audio_blue.o \
wram.o \
text.o
OBJS := $(RED_OBJS) $(BLUE_OBJS)
OBJS := $(sort $(OBJS))
ROMS := pokered.gbc pokeblue.gbc
# generate dependencies for each object
$(shell $(foreach obj, $(OBJS), \
$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) extras/pokemontools/scan_includes.py $(obj:.o=.asm))) \
$(eval ALL_DEPENDENCIES += $($(obj:.o=)_DEPENDENCIES)) \
))
all: $(ROMS)
red: pokered.gbc
blue: pokeblue.gbc
compare: baserom.gbc pokered.gbc
cmp $^
redrle: extras/redtools/redrle.c
${CC} -o $@ $<
clean:
rm -f $(ROMS)
rm -f $(OBJS)
find . -iname '*.tx' -exec rm {} +
rm -f redrle
baserom.gbc: ;
@echo "Wait! Need baserom.gbc first. Check README for details." && false
%.asm: ;
.asm.tx:
$(eval TEXTQUEUE += $<)
@rm -f $@
$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
@$(PYTHON) prequeue.py $(TEXTQUEUE)
@$(eval TEXTQUEUE :=)
rgbasm -o $@ $*.tx
OPTIONS = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03
pokered.gbc: $(RED_OBJS)
rgblink -n $*.sym -m $*.map -o $@ $^
rgbfix $(OPTIONS) -t "POKEMON RED" $@
pokeblue.gbc: $(BLUE_OBJS)
rgblink -n $*.sym -m $*.map -o $@ $^
rgbfix $(OPTIONS) -t "POKEMON BLUE" $@