pokepinball/Makefile
2024-03-17 09:27:05 -05:00

57 lines
1.1 KiB
Makefile

.PHONY: all tools compare clean tidy
.SUFFIXES:
.SECONDEXPANSION:
.PRECIOUS:
.SECONDARY:
ROM := pokepinball.gbc
OBJS := main.o wram.o sram.o hram.o
ifeq (,$(shell which sha1sum))
SHA1 := shasum
else
SHA1 := sha1sum
endif
all: $(ROM) compare
ifeq (,$(filter tools clean tidy,$(MAKECMDGOALS)))
Makefile: tools
endif
%.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
%.o: %.asm $$(dep)
rgbasm -h -Wunmapped-char=0 -l -o $@ $<
$(ROM): $(OBJS) contents/contents.link
rgblink -n $(ROM:.gbc=.sym) -m $(ROM:.gbc=.map) -l contents/contents.link -o $@ $(OBJS)
rgbfix -jsvc -k 01 -l 0x33 -m 0x1e -p 0 -r 02 -t "POKEPINBALL" -i VPHE $@
# For contributors to make sure a change didn't affect the contents of the rom.
compare: $(ROM)
@$(SHA1) -c rom.sha1
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
rgbgfx -o $@ $<
%.1bpp: %.png
rgbgfx -d1 -o $@ $<
%.pcm: %.wav
tools/pcm -o $@ $<