forked from Herringway/ebsrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (62 loc) · 2.24 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
74
75
76
77
78
79
80
81
82
83
84
85
all: earthbound
.SUFFIXES:
%: %,v
%: RCS/%,v
%: RCS/%
%: s.%
%: SCCS/s.%
CA65FLAGS = -t none --cpu 65816 --bin-include-dir src --include-dir src --include-dir include
LD65FLAGS = -C snes.cfg
.PHONY: earthbound proto19950327 mother2 depsjp depsusa depsusaproto extract extractproto extractjp
JPSRCDIR = src/bankconfig/JP
USSRCDIR = src/bankconfig/US
USPROTOSRCDIR = src/bankconfig/US19950327
earthbound: depsusa earthbound.sfc
proto19950327: depsusaproto earthbound-1995-03-27.sfc
mother2: depsjp mother2.sfc
ifeq ($(MAKECMDGOALS),mother2)
CA65FLAGS += -D JPN
include $(wildcard $(JPSRCDIR)/*.dep)
else ifeq ($(MAKECMDGOALS),proto19950327)
CA65FLAGS += -D USA -D PROTOTYPE19950327
include $(wildcard $(USPROTOSRCDIR)/*.dep)
else
CA65FLAGS += -D USA
include $(wildcard $(USSRCDIR)/*.dep)
endif
JPSRCS = $(wildcard $(JPSRCDIR)/*.asm)
JPOBJS = $(patsubst %.asm, %.o, $(JPSRCS))
USSRCS = $(wildcard $(USSRCDIR)/*.asm)
USOBJS = $(patsubst %.asm, %.o, $(USSRCS))
USPROTOSRCS = $(wildcard $(USPROTOSRCDIR)/*.asm)
USPROTOOBJS = $(patsubst %.asm, %.o, $(USPROTOSRCS))
%.dep: %.asm
ca65 $(CA65FLAGS) --listing "$(patsubst %.dep,%.lst,$@)" --create-dep "$@" "$<"
mother2.sfc: $(JPOBJS)
ld65 $(LD65FLAGS) --mapfile "$(patsubst %.sfc,%.map,$@)" -o "$@" $^
earthbound.sfc: $(USOBJS)
ld65 $(LD65FLAGS) --mapfile "$(patsubst %.sfc,%.map,$@)" -o "$@" $^
earthbound-1995-03-27.sfc: $(USPROTOOBJS)
ld65 $(LD65FLAGS) --mapfile "$(patsubst %.sfc,%.map,$@)" -o "$@" $^
mother2.dbg: $(JPOBJS)
ld65 $(LD65FLAGS) --dbgfile "$@" $^
earthbound.dbg: $(USOBJS)
ld65 $(LD65FLAGS) --dbgfile "$@" $^
earthbound-1995-03-27.dbg: $(USPROTOOBJS)
ld65 $(LD65FLAGS) --dbgfile "$@" $^
# ca65 requires all bin files to be present for generating .dep files, so make sure they're present first
depsjp: src/spc700/main.spc700.bin $(JPSRCS:.asm=.dep)
depsusa: src/spc700/main.spc700.bin $(USSRCS:.asm=.dep)
depsusaproto: src/spc700/main.spc700.bin $(USPROTOSRCS:.asm=.dep)
extract:
ebbinex "earthbound.yml" "donor.sfc"
extractproto:
ebbinex "earthbound-1995-03-27.yml" "donor-1995-03-27.sfc"
extractjp:
ebbinex "mother2.yml" "donorm2.sfc"
%.o: %.asm
ca65 $(CA65FLAGS) --listing "$(patsubst %.o,%.lst,$@)" -o "$@" "$<"
%.spc700.bin: %.spc700.s
spcasm -f plain "$<" "$@"
%.bin: %.uncompressed
inhal -n $< $@