-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
40 lines (28 loc) · 1.23 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
all: earthboundzero
earthboundzero: depsusa build/earthbound.nes
BUILDDIR = build
CA65FLAGS = -t none --cpu 6502 --bin-include-dir src --include-dir src
LD65FLAGS = -C nes.cfg
USID = usa
SRCDIR = src
USSRCS = $(wildcard $(SRCDIR)/prg/*.asm) src/chr/chr.asm src/header.asm src/ram.asm src/mmc3ram.asm
USOBJS = $(subst $(SRCDIR), $(BUILDDIR)/usa, $(patsubst %.asm, %.o, $(USSRCS)))
$(BUILDDIR)/usa%.dep: $(SRCDIR)/%.asm
@$(call mkdir, $(@D))
ca65 $(CA65FLAGS) --listing "$(strip $(subst $(SRCDIR), $(BUILDDIR)/usa, $(patsubst %.dep,%.lst,$@)))" --create-dep "$(strip $(subst $(SRCDIR), $(BUILDDIR), $@))" -o "$(patsubst %.dep,%.o,$@)" "$<"
build/earthbound.dbg: $(USOBJS)
ld65 $(LD65FLAGS) --dbgfile "$@" $^
include $(wildcard $(BUILDDIR)/$(USID)/*.dep)
ifeq ($(shell echo "check_quotes"),"check_quotes")
mkdir = mkdir $(subst /,\,$(1)) > nul 2>&1 || (exit 0)
else
mkdir = mkdir -p $(1)
endif
build/earthbound.nes: $(USOBJS)
ld65 -o $@ $(LD65FLAGS) $^
depsusa: $(subst $(SRCDIR), $(BUILDDIR)/usa, $(USSRCS:.asm=.dep))
extract:
dub run ebbinex -- "donor.nes" "src/bin"
$(BUILDDIR)/usa%.o: $(SRCDIR)/%.asm
@$(call mkdir, $(@D))
ca65 $(CA65FLAGS) --listing "$(strip $(subst $(SRCDIR), $(BUILDDIR)/usa, $(patsubst %.o,%.lst,$@)))" -o "$@" "$<"