summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile99
-rw-r--r--audio.asm1
-rw-r--r--compare.sh11
-rw-r--r--text.asm1
-rwxr-xr-xyellow/audio.asm2
-rwxr-xr-xyellow/main.asm1
-rwxr-xr-xyellow/text.asm2
-rwxr-xr-xyellow/wram.asm1
8 files changed, 37 insertions, 81 deletions
diff --git a/Makefile b/Makefile
index 2819262e..3447dda6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,85 +1,56 @@
-# Build Yellow.
-roms := pokeyellow.gbc
-
-
-.PHONY: all clean yellow compare
-
-all: $(roms)
-yellow: pokeyellow.gbc
-
-versions := yellow
-
-
-# Header options for rgbfix.
-cgb_opt = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03
-
-yellow_opt = $(cgb_opt) -t "POKEMON YELLOW"
-
-
-# If your default python is 3, you may want to change this to python27.
PYTHON := python
-
-# md5sum -c is used to compare rom hashes. The options may vary across platforms.
MD5 := md5sum -c --quiet
+2bpp := $(PYTHON) gfx.py 2bpp
+1bpp := $(PYTHON) gfx.py 1bpp
+pcm := $(PYTHON) extras/pokemontools/pcm.py pcm
+pic := $(PYTHON) extras/pokemontools/pic.py compress
+includes := $(PYTHON) extras/pokemontools/scan_includes.py
-# The compare target is a shortcut to check that the build matches the original roms exactly.
-# This is for contributors to make sure a change didn't affect the contents of the rom.
-# More thorough comparison can be made by diffing the output of hexdump -C against both roms.
-compare: yellow
- @$(MD5) roms.md5
+objs := \
+ audio.o \
+ main.o \
+ text.o \
+ wram.o
+$(foreach obj, $(objs:.o=), \
+ $(eval $(obj)_dep := $(shell $(includes) $(obj).asm)) \
+)
-# Clear the default suffixes.
.SUFFIXES:
.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic .wav .pcm
-
-# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
-
# Suppress annoying intermediate file deletion messages.
.PRECIOUS: %.2bpp
+.PHONY: all clean yellow compare
-# Filepath shortcuts to avoid overly long recipes.
-poketools := extras/pokemontools
-gfx := $(PYTHON) gfx.py
-pcm := $(PYTHON) $(poketools)/pcm.py
-pic := $(PYTHON) $(poketools)/pic.py
-includes := $(PYTHON) $(poketools)/scan_includes.py
+rom := pokeyellow.gbc
+all: $(rom)
+yellow: $(rom)
-# Collect file dependencies for objects in yellow/.
-$(foreach ver, $(versions), \
- $(eval $(ver)_asm := $(shell find $(ver) -iname '*.asm')) \
- $(eval $(ver)_obj := $($(ver)_asm:.asm=.o)) \
- $(eval all_obj += $($(ver)_obj)) \
-)
-$(foreach obj, $(all_obj), \
- $(eval $(obj:.o=)_dep := $(shell $(includes) $(obj:.o=.asm))) \
-)
-
-
-%.png: ;
-%.2bpp: %.png ; @$(gfx) 2bpp $<
-%.1bpp: %.png ; @$(gfx) 1bpp $<
-%.pic: %.2bpp ; @$(pic) compress $<
+# For contributors to make sure a change didn't affect the contents of the rom.
+compare: yellow
+ @$(MD5) roms.md5
-%.wav: ;
-%.pcm: %.wav $(poketools)/pcm.py ; @$(pcm) pcm $<
+clean:
+ rm -f $(rom) $(objs) $(rom:.gbc=.sym)
+ find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' -o -iname '*.pcm' \) -exec rm {} +
-# Assemble source files into objects.
-$(all_obj): $$*.asm $$($$*_dep)
+%.asm: ;
+$(objs): %.o: %.asm $$(%_dep)
rgbasm -h -o $@ $*.asm
-# Make a symfile for debugging.
-link_opt = -n poke$*.sym
+opts = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 -t "POKEMON YELLOW"
-# Link objects together to build a rom.
-poke%.gbc: $$(%_obj)
- rgblink $(link_opt) -o $@ $^
- rgbfix $($*_opt) $@
+$(rom): $(objs)
+ rgblink -n $*.sym -o $@ $^
+ rgbfix $(opts) $@
+%.png: ;
+%.2bpp: %.png ; @$(2bpp) $<
+%.1bpp: %.png ; @$(1bpp) $<
+%.pic: %.2bpp ; @$(pic) $<
-clean:
- rm -f $(roms) $(all_obj) poke*.sym
- find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' -o -iname '*.pcm' \) -exec rm {} +
+%.wav: ;
+%.pcm: %.wav ; @$(pcm) $<
diff --git a/audio.asm b/audio.asm
index 23badb6b..aa88667a 100644
--- a/audio.asm
+++ b/audio.asm
@@ -1,3 +1,4 @@
+INCLUDE "charmap.asm"
AUDIO_1 EQU $2
AUDIO_2 EQU $8
diff --git a/compare.sh b/compare.sh
deleted file mode 100644
index 6ef030bb..00000000
--- a/compare.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# Compares baserom.gbc and pokeyellow.gbc
-
-# create baserom.txt if necessary
-if [ ! -f baserom.txt ]; then
- hexdump -C baserom.gbc > baserom.txt
-fi
-
-hexdump -C pokeyellow.gbc > pokeyellow.txt
-
-diff -u baserom.txt pokeyellow.txt | less \ No newline at end of file
diff --git a/text.asm b/text.asm
index ce6f9be3..97612edc 100644
--- a/text.asm
+++ b/text.asm
@@ -1,3 +1,4 @@
+INCLUDE "charmap.asm"
INCLUDE "constants/text_constants.asm"
TEXT_1 EQU $26
TEXT_2 EQU $27
diff --git a/yellow/audio.asm b/yellow/audio.asm
deleted file mode 100755
index b61fccd8..00000000
--- a/yellow/audio.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "charmap.asm"
-INCLUDE "audio.asm" \ No newline at end of file
diff --git a/yellow/main.asm b/yellow/main.asm
deleted file mode 100755
index e071bfde..00000000
--- a/yellow/main.asm
+++ /dev/null
@@ -1 +0,0 @@
-INCLUDE "main.asm" \ No newline at end of file
diff --git a/yellow/text.asm b/yellow/text.asm
deleted file mode 100755
index 6c118c73..00000000
--- a/yellow/text.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "charmap.asm"
-INCLUDE "text.asm"
diff --git a/yellow/wram.asm b/yellow/wram.asm
deleted file mode 100755
index 98057cd2..00000000
--- a/yellow/wram.asm
+++ /dev/null
@@ -1 +0,0 @@
-INCLUDE "wram.asm"