summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--[-rwxr-xr-x]Makefile46
1 files changed, 21 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 6b2e814..f1a100e 100755..100644
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,23 @@
-.PHONY: all compare clean tidy
+.PHONY: all tools compare clean tidy
.SUFFIXES:
-.SUFFIXES: .asm .o .gbc .png
.SECONDEXPANSION:
+.PRECIOUS:
+.SECONDARY:
-# Build Pokemon Pinball.
ROM := pokepinball.gbc
OBJS := main.o wram.o sram.o
-# If your default python is 3, you may want to change this to python27.
-PYTHON := python
-PRET := pokemon-reverse-engineering-tools/pokemontools
-MD5 := md5sum -c --quiet
+MD5 := md5sum -c
-$(foreach obj, $(OBJS), \
- $(eval $(obj:.o=)_dep := $(shell $(PYTHON) $(PRET)/scan_includes.py $(obj:.o=.asm))) \
-)
-
-# Link objects together to build a rom.
all: $(ROM) compare
-# Assemble source files into objects.
-# Use rgbasm -h to use halts without nops.
-$(OBJS): $$*.asm $$($$*_dep)
- @$(PYTHON) $(PRET)/gfx.py 2bpp $(2bppq)
- @$(PYTHON) $(PRET)/gfx.py 1bpp $(1bppq)
- @$(PYTHON) $(PRET)/pcm.py pcm $(pcmq)
+ifeq (,$(filter tools clean tidy,$(MAKECMDGOALS)))
+Makefile: tools
+endif
+
+%.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
+%.o: %.asm $$(dep)
rgbasm -h -o $@ $<
$(ROM): $(OBJS) contents/contents.link
@@ -36,21 +28,25 @@ $(ROM): $(OBJS) contents/contents.link
compare: $(ROM)
@$(MD5) rom.md5
-# Remove files generated by the build process.
+tools:
+ $(MAKE) -C tools
+
tidy:
rm -f $(ROM) $(OBJS) $(ROM:.gbc=.sym) $(ROM:.gbc=.map)
+ $(MAKE) -C tools clean
clean: tidy
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pcm' \) -exec rm {} +
+%.interleave.2bpp: %.interleave.png
+ rgbgfx -o $@ $<
+ tools/gfx --interleave --png $< -o $@ $@
+
%.2bpp: %.png
- $(eval 2bppq += $<)
- @rm -f $@
+ rgbgfx -o $@ $<
%.1bpp: %.png
- $(eval 1bppq += $<)
- @rm -f $@
+ rgbgfx -d1 -o $@ $<
%.pcm: %.wav
- $(eval pcmq += $<)
- @rm -f $@
+ tools/pcm -o $@ $<