-targets := rzde-3.2.bin rzde-3.3.bin rzde-3.4.bin
-targets += rzdj-3.2.bin rzdj-3.3.bin rzdj-3.4.bin
-targets += rzdp-3.2.bin rzdp-3.3.bin rzdp-3.4.bin
-targets-short := rzde rzdj rzdp
-
-objs := twilight.o
-
-ppms := $(targets-short:%=%-icon.ppm) generic-banner.ppm
-assets := title.bin $(ppms)
-
-loader := loader/loader.bin
-
-
-titleid = $(shell perl titleid.pl $(1))
-
-
-# System menu 3.3 checks for the exploit, when a) you copy a save from SD,
-# and b) when the menu starts up; but for a) it only looks at the first
-# zeldaTp.dat file, and for b) it allows any file of non-aligned length.
-#
-# System menu 3.4 only looks at the last file in the wad when installing.
-#
-# System menu 4.0 finally avoids such silly bugs.
-
-define twintig
- D=$(call titleid,$(1)); \
- $(TOOLS)/twintig $$D $@ toc-$1
-endef
-
-
-all: $(targets)
-
-$(filter %-3.2.bin,$(targets)): %-3.2.bin: %.data
-$(filter %-3.3.bin,$(targets)): %-3.3.bin: %.data zero16k
-$(filter %-3.4.bin,$(targets)): %-3.4.bin: %.data FAILURE
-$(targets): %.bin: toc-% $(assets)
- @echo " TWINTIG $@"
- $(Q)$(call twintig,$*)
-
-saves := $(targets-short:%=%.data)
-
-rzde.data: rzde0.slot rzde2.slot
-rzdp.data: rzdp0.slot
-rzdj.data: rzdj0.slot
-$(saves): $(loader)
- @echo " ZELDAPACK $@"
- $(Q)./pack.sh $@ $(filter %.slot,$^)
- $(Q)$(TOOLS)/zelda-cksum $@
- $(Q)cat $(loader) >> $@
- $(Q)printf '\0' >> $@
-
-slots := rzde0.slot rzde2.slot rzdj0.slot rzdp0.slot
-
-$(slots): %.slot: %.elf
- @echo " OBJCOPY $@"
- $(Q)$(OBJCOPY) -Obinary $< $@
-
-elfs := $(slots:.slot=.elf)
-
-rzde0.elf: baddr := 0x8046a3e0+0
-rzde2.elf: baddr := 0x804519e0+0x0a94
-rzdj0.elf: baddr := 0x8044f860+0
-rzdp0.elf: baddr := 0x804522e0+0
-$(elfs): %.elf: twilight.lds %.o $(objs)
- @echo " LINK $@"
- $(Q)$(LD) --defsym baddr=$(baddr) -T $^ -o $@
-
-exploit-objs := $(elfs:.elf=.o)
-
-$(exploit-objs): slot-name := Twilight Hack
-rzde0.o: slot-name := TwilightHack0
-rzde2.o: slot-name := TwilightHack2
-$(exploit-objs): %.o: start.S head.b
- @echo " ASSEMBLE $@"
- $(Q)$(CC) $(CFLAGS) -D NAME="$(slot-name)" -c $< -o $@
-
-%.o: %.c
- @echo " COMPILE $@"
- $(Q)$(CC) $(CFLAGS) -c $< -o $@
-
-title.bin: .version
- @echo " TITLEBIN $@"
- $(Q)perl make-title-bin.pl > $@