2014-09-26 06:10:36 +00:00
|
|
|
.POSIX:
|
2020-06-29 23:49:22 +00:00
|
|
|
.PHONY: default build build-all test test-all all clean
|
2014-09-26 06:10:36 +00:00
|
|
|
|
2020-06-25 19:51:58 +00:00
|
|
|
#
|
|
|
|
# Dev tools binaries and options
|
|
|
|
#
|
|
|
|
2BPP := rgbgfx
|
|
|
|
|
|
|
|
ASM := rgbasm
|
|
|
|
ASFLAGS := --export-all
|
|
|
|
|
|
|
|
LD := rgblink
|
|
|
|
LDFLAGS :=
|
|
|
|
|
|
|
|
FX := rgbfix
|
|
|
|
FXFLAGS := \
|
2020-06-21 13:43:44 +00:00
|
|
|
--color-compatible \
|
|
|
|
--sgb-compatible \
|
|
|
|
--ram-size 0x03 \
|
|
|
|
--old-licensee 0x33 \
|
|
|
|
--new-licensee "01" \
|
|
|
|
--mbc-type 0x1B \
|
|
|
|
--pad-value 0xFF \
|
|
|
|
--validate
|
2014-06-28 01:05:25 +00:00
|
|
|
|
2016-10-08 22:55:07 +00:00
|
|
|
.SUFFIXES: .asm .o .gbc .png .2bpp
|
2014-09-26 05:31:54 +00:00
|
|
|
|
2020-06-21 13:13:03 +00:00
|
|
|
# Default target: build and test only the US 1.0 revision.
|
2020-06-21 13:46:50 +00:00
|
|
|
# (Use `make all` to build and test all targets.)
|
2020-06-21 13:13:03 +00:00
|
|
|
default: build test
|
2014-06-28 01:05:25 +00:00
|
|
|
|
|
|
|
# Objects are assembled from source.
|
2014-09-26 05:31:54 +00:00
|
|
|
# src/main.o is built from src/main.asm.
|
2016-10-08 22:55:07 +00:00
|
|
|
asm_files = $(shell find src -type f -name '*.asm')
|
|
|
|
gfx_files = $(shell find src/gfx -type f -name '*.png')
|
2020-06-01 17:41:37 +00:00
|
|
|
|
2020-06-29 23:04:13 +00:00
|
|
|
deps = $(asm_files) $(gfx_files:.png=.2bpp)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generic rules
|
|
|
|
#
|
|
|
|
|
|
|
|
# Compile a PNG file to a 2BPP file
|
2016-10-08 22:55:07 +00:00
|
|
|
%.2bpp: %.png
|
2018-03-27 13:15:31 +00:00
|
|
|
$(2BPP) -o $@ $<
|
2014-09-26 06:10:36 +00:00
|
|
|
|
2020-06-29 23:04:13 +00:00
|
|
|
# Link an object file to a GBC file
|
|
|
|
%.gbc: src/main.%.o
|
|
|
|
$(LD) $(LDFLAGS) $($*_ld_opt) -n $*.sym -o $@ $^
|
|
|
|
$(FX) $(FXFLAGS) $($*_fx_opt) $@
|
2014-06-28 01:05:25 +00:00
|
|
|
|
2020-06-30 00:13:40 +00:00
|
|
|
# Make may attempt to re-generate the Makefile; prevent this.
|
|
|
|
Makefile: ;
|
|
|
|
|
2020-06-01 17:41:37 +00:00
|
|
|
#
|
|
|
|
# Japanese
|
|
|
|
#
|
|
|
|
|
2020-06-29 23:15:45 +00:00
|
|
|
azlj_asm = $(shell find revisions/J0 -type f -name '*.asm')
|
|
|
|
azlj_gfx = $(shell find revisions/J0 -type f -name '*.png')
|
|
|
|
|
2020-06-01 17:41:37 +00:00
|
|
|
games += azlj.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlj.o: src/main.asm $(deps) $(azlj_asm) $(azlj_gfx:.png=.2bpp)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=JP -DVERSION=0 -i revisions/J0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlj_fx_opt = --rom-version 0 --title "ZELDA"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
games += azlj-r1.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlj-r1.o: src/main.asm $(deps) $(azlj_asm) $(azlj_gfx:.png=.2bpp)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=JP -DVERSION=1 -i revisions/J1/src/ -i revisions/J0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlj-r1_fx_opt = --rom-version 1 --title "ZELDA"
|
|
|
|
|
2020-06-01 17:41:37 +00:00
|
|
|
games += azlj-r2.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlj-r2.o: src/main.asm $(deps) $(azlj_asm) $(azlj_gfx:.png=.2bpp)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=JP -DVERSION=2 -i revisions/J2/src/ -i revisions/J1/src/ -i revisions/J0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlj-r2_fx_opt = --rom-version 2 --title "ZELDA" --game-id "AZLJ"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# German
|
|
|
|
#
|
|
|
|
|
2020-06-29 23:15:45 +00:00
|
|
|
azlg_asm = $(shell find revisions/G0 -type f -name '*.asm')
|
|
|
|
azlg_gfx = $(shell find revisions/G0 -type f -name '*.png')
|
|
|
|
|
2020-06-01 17:41:37 +00:00
|
|
|
games += azlg.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlg.o: src/main.asm $(deps) $(azlg_asm) $(azlg_gfx:.png=.2bpp)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=DE -DVERSION=0 -i revisions/G0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlg_fx_opt = --rom-version 0 --non-japanese --title "ZELDA"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
games += azlg-r1.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlg-r1.o: src/main.asm $(deps) $(azlg_asm) $(azlg_gfx:.png=.2bpp) azlj-r2.gbc
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=DE -DVERSION=1 -i revisions/G1/src/ -i revisions/G0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlg-r1_ld_opt = -O azlj-r2.gbc
|
|
|
|
azlg-r1_fx_opt = --rom-version 1 --non-japanese --title "ZELDA" --game-id "AZLD"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# French
|
|
|
|
#
|
|
|
|
|
2020-06-29 23:15:45 +00:00
|
|
|
azlf_asm = $(shell find revisions/F0 -type f -name '*.asm')
|
|
|
|
azlf_gfx = $(shell find revisions/F0 -type f -name '*.png')
|
|
|
|
|
2020-06-01 17:41:37 +00:00
|
|
|
games += azlf.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlf.o: src/main.asm $(deps) $(azlf_asm) $(azlf_gfx:.png=.2bpp)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=FR -DVERSION=0 -i revisions/F0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlf_fx_opt = --rom-version 0 --non-japanese --title "ZELDA"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
games += azlf-r1.gbc
|
2020-06-29 23:15:45 +00:00
|
|
|
src/main.azlf-r1.o: src/main.asm $(deps) $(azlf_asm) $(azlf_gfx:.png=.2bpp) azlg-r1.gbc
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=FR -DVERSION=1 -i revisions/F1/src/ -i revisions/F0/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azlf-r1_ld_opt = -O azlg-r1.gbc
|
|
|
|
azlf-r1_fx_opt = --rom-version 1 --non-japanese --title "ZELDA" --game-id "AZLF"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# English
|
|
|
|
#
|
|
|
|
|
|
|
|
games += azle.gbc
|
|
|
|
src/main.azle.o: src/main.asm $(deps)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=EN -DVERSION=0 -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azle_fx_opt = --rom-version 0 --non-japanese --title "ZELDA"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
games += azle-r1.gbc
|
2020-06-29 23:04:13 +00:00
|
|
|
src/main.azle-r1.o: src/main.asm $(deps)
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=EN -DVERSION=1 -i revisions/E1/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azle-r1_fx_opt = --rom-version 1 --non-japanese --title "ZELDA"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
|
|
|
games += azle-r2.gbc
|
2020-06-29 23:04:13 +00:00
|
|
|
src/main.azle-r2.o: src/main.asm $(deps) azlf-r1.gbc
|
2020-06-25 19:51:58 +00:00
|
|
|
$(ASM) $(ASFLAGS) -DLANG=EN -DVERSION=2 -i revisions/E2/src/ -i revisions/E1/src/ -i src/ -o $@ $<
|
2020-06-29 23:04:13 +00:00
|
|
|
azle-r2_ld_opt = -O azlf-r1.gbc
|
|
|
|
azle-r2_fx_opt = --rom-version 2 --non-japanese --title "ZELDA" --game-id "AZLE"
|
2020-06-01 17:41:37 +00:00
|
|
|
|
2020-06-21 13:13:03 +00:00
|
|
|
#
|
2020-06-29 23:04:13 +00:00
|
|
|
# Main targets
|
2020-06-21 13:13:03 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# By default, build the US 1.0 revision.
|
|
|
|
build: azle.gbc
|
|
|
|
|
|
|
|
# Build all revisions.
|
|
|
|
build-all: $(games)
|
|
|
|
|
|
|
|
# Test the default revision.
|
|
|
|
test: build
|
2020-06-29 22:34:24 +00:00
|
|
|
@tools/compare.sh ladx.md5 azle.gbc
|
2020-06-21 13:13:03 +00:00
|
|
|
|
|
|
|
# Test all revisions.
|
|
|
|
test-all: build-all
|
2020-06-29 22:34:24 +00:00
|
|
|
@tools/compare.sh ladx.md5 $(games)
|
2020-06-21 13:13:03 +00:00
|
|
|
|
|
|
|
all: build-all test-all
|
2020-06-21 13:11:06 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(games)
|
2020-06-29 23:49:22 +00:00
|
|
|
rm -f $(games:%.gbc=src/main.%.o)
|
2020-06-21 13:11:06 +00:00
|
|
|
rm -f $(games:.gbc=.map)
|
|
|
|
rm -f $(games:.gbc=.sym)
|
2020-06-29 23:49:22 +00:00
|
|
|
rm -f $(gfx_files:.png=.2bpp)
|
|
|
|
rm -f $(azlj_gfx:.png=.2bpp)
|
|
|
|
rm -f $(azlg_gfx:.png=.2bpp)
|
|
|
|
rm -f $(azlf_gfx:.png=.2bpp)
|