mirror of
https://github.com/zladx/LADX-Disassembly.git
synced 2024-11-23 12:59:39 +00:00
Makefile: make the linker rules generic
Rather than re-defining the linker rules, only specify the linker options in a variable.
This commit is contained in:
parent
e75107881d
commit
acddec4425
81
Makefile
81
Makefile
@ -37,109 +37,93 @@ gfx_files = $(shell find src/gfx -type f -name '*.png')
|
||||
asm_files += $(shell find revisions -type f -name '*.asm')
|
||||
gfx_files += $(shell find revisions -type f -name '*.png')
|
||||
|
||||
deps = $(asm_files) $(gfx_files:.png=.2bpp)
|
||||
|
||||
#
|
||||
# Generic rules
|
||||
#
|
||||
|
||||
# Compile a PNG file to a 2BPP file
|
||||
%.2bpp: %.png
|
||||
$(2BPP) -o $@ $<
|
||||
|
||||
deps = $(asm_files) $(gfx_files:.png=.2bpp)
|
||||
# Link an object file to a GBC file
|
||||
%.gbc: src/main.%.o
|
||||
$(LD) $(LDFLAGS) $($*_ld_opt) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) $($*_fx_opt) $@
|
||||
|
||||
#
|
||||
# Japanese
|
||||
#
|
||||
|
||||
games += azlj.gbc
|
||||
j0_obj = src/main.azlj.o
|
||||
src/main.azlj.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=JP -DVERSION=0 -i revisions/J0/src/ -i src/ -o $@ $<
|
||||
azlj.gbc: $(j0_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 0 --title "ZELDA" $@
|
||||
azlj_fx_opt = --rom-version 0 --title "ZELDA"
|
||||
|
||||
games += azlj-r1.gbc
|
||||
j1_obj = src/main.azlj-1.o
|
||||
src/main.azlj-1.o: src/main.asm $(deps)
|
||||
src/main.azlj-r1.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=JP -DVERSION=1 -i revisions/J1/src/ -i revisions/J0/src/ -i src/ -o $@ $<
|
||||
azlj-r1.gbc: $(j1_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 1 --title "ZELDA" $@
|
||||
azlj-r1_fx_opt = --rom-version 1 --title "ZELDA"
|
||||
|
||||
|
||||
games += azlj-r2.gbc
|
||||
j2_obj = src/main.azlj-2.o
|
||||
src/main.azlj-2.o: src/main.asm $(deps)
|
||||
src/main.azlj-r2.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=JP -DVERSION=2 -i revisions/J2/src/ -i revisions/J1/src/ -i revisions/J0/src/ -i src/ -o $@ $<
|
||||
azlj-r2.gbc: $(j2_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 2 --title "ZELDA" --game-id "AZLJ" $@
|
||||
azlj-r2_fx_opt = --rom-version 2 --title "ZELDA" --game-id "AZLJ"
|
||||
|
||||
#
|
||||
# German
|
||||
#
|
||||
|
||||
games += azlg.gbc
|
||||
g0_obj = src/main.azlg.o
|
||||
src/main.azlg.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=DE -DVERSION=0 -i revisions/G0/src/ -i src/ -o $@ $<
|
||||
azlg.gbc: $(g0_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 0 --non-japanese --title "ZELDA" $@
|
||||
azlg_fx_opt = --rom-version 0 --non-japanese --title "ZELDA"
|
||||
|
||||
games += azlg-r1.gbc
|
||||
g1_obj = src/main.azlg-1.o
|
||||
src/main.azlg-1.o: src/main.asm $(deps)
|
||||
src/main.azlg-r1.o: src/main.asm $(deps) azlj-r2.gbc
|
||||
$(ASM) $(ASFLAGS) -DLANG=DE -DVERSION=1 -i revisions/G1/src/ -i revisions/G0/src/ -i src/ -o $@ $<
|
||||
azlg-r1.gbc: $(g1_obj) azlj-r2.gbc
|
||||
$(LD) $(LDFLAGS) -O "azlj-r2.gbc" -n $*.sym -o $@ $<
|
||||
$(FX) $(FXFLAGS) --rom-version 1 --non-japanese --title "ZELDA" --game-id "AZLD" $@
|
||||
azlg-r1_ld_opt = -O azlj-r2.gbc
|
||||
azlg-r1_fx_opt = --rom-version 1 --non-japanese --title "ZELDA" --game-id "AZLD"
|
||||
|
||||
#
|
||||
# French
|
||||
#
|
||||
|
||||
games += azlf.gbc
|
||||
f0_obj = src/main.azlf.o
|
||||
src/main.azlf.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=FR -DVERSION=0 -i revisions/F0/src/ -i src/ -o $@ $<
|
||||
azlf.gbc: $(f0_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 0 --non-japanese --title "ZELDA" $@
|
||||
azlf_fx_opt = --rom-version 0 --non-japanese --title "ZELDA"
|
||||
|
||||
games += azlf-r1.gbc
|
||||
f1_obj = src/main.azlf-1.o
|
||||
src/main.azlf-1.o: src/main.asm $(deps)
|
||||
src/main.azlf-r1.o: src/main.asm $(deps) azlg-r1.gbc
|
||||
$(ASM) $(ASFLAGS) -DLANG=FR -DVERSION=1 -i revisions/F1/src/ -i revisions/F0/src/ -i src/ -o $@ $<
|
||||
azlf-r1.gbc: $(f1_obj) azlg-r1.gbc
|
||||
$(LD) $(LDFLAGS) -O "azlg-r1.gbc" -n $*.sym -o $@ $<
|
||||
$(FX) $(FXFLAGS) --rom-version 1 --non-japanese --title "ZELDA" --game-id "AZLF" $@
|
||||
azlf-r1_ld_opt = -O azlg-r1.gbc
|
||||
azlf-r1_fx_opt = --rom-version 1 --non-japanese --title "ZELDA" --game-id "AZLF"
|
||||
|
||||
#
|
||||
# English
|
||||
#
|
||||
|
||||
games += azle.gbc
|
||||
e0_obj = src/main.azle.o
|
||||
src/main.azle.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=EN -DVERSION=0 -i src/ -o $@ $<
|
||||
azle.gbc: $(e0_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 0 --non-japanese --title "ZELDA" $@
|
||||
azle_fx_opt = --rom-version 0 --non-japanese --title "ZELDA"
|
||||
|
||||
games += azle-r1.gbc
|
||||
e1_obj = src/main.azle-1.o
|
||||
src/main.azle-1.o: src/main.asm $(deps)
|
||||
src/main.azle-r1.o: src/main.asm $(deps)
|
||||
$(ASM) $(ASFLAGS) -DLANG=EN -DVERSION=1 -i revisions/E1/src/ -i src/ -o $@ $<
|
||||
azle-r1.gbc: $(e1_obj)
|
||||
$(LD) $(LDFLAGS) -n $*.sym -o $@ $^
|
||||
$(FX) $(FXFLAGS) --rom-version 1 --non-japanese --title "ZELDA" $@
|
||||
azle-r1_fx_opt = --rom-version 1 --non-japanese --title "ZELDA"
|
||||
|
||||
games += azle-r2.gbc
|
||||
e2_obj = src/main.azle-2.o
|
||||
src/main.azle-2.o: src/main.asm $(deps)
|
||||
src/main.azle-r2.o: src/main.asm $(deps) azlf-r1.gbc
|
||||
$(ASM) $(ASFLAGS) -DLANG=EN -DVERSION=2 -i revisions/E2/src/ -i revisions/E1/src/ -i src/ -o $@ $<
|
||||
azle-r2.gbc: $(e2_obj) azlf-r1.gbc
|
||||
$(LD) $(LDFLAGS) -O "azlf-r1.gbc" -n $*.sym -o $@ $<
|
||||
$(FX) $(FXFLAGS) --rom-version 2 --non-japanese --title "ZELDA" --game-id "AZLE" $@
|
||||
azle-r2_ld_opt = -O azlf-r1.gbc
|
||||
azle-r2_fx_opt = --rom-version 2 --non-japanese --title "ZELDA" --game-id "AZLE"
|
||||
|
||||
#
|
||||
# General rules
|
||||
# Main targets
|
||||
#
|
||||
|
||||
# By default, build the US 1.0 revision.
|
||||
@ -159,7 +143,6 @@ test-all: build-all
|
||||
all: build-all test-all
|
||||
|
||||
clean:
|
||||
rm -f $(obj)
|
||||
rm -f $(games)
|
||||
rm -f $(games:.gbc=.o)
|
||||
rm -f $(games:.gbc=.map)
|
||||
|
Loading…
Reference in New Issue
Block a user