X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=savezelda.git;a=blobdiff_plain;f=Makefile;fp=Makefile;h=a5a51207d2f32e8e9ba6b2b8c1acb2ab7230c9f0;hp=278c630fb04f31b5df1b6b11a2da62fa042772c4;hb=e1ede7aa2cb1840add9ba88901c7495deb2b37e3;hpb=15edfaae0fe106910d059e91f8cb4f691cc50da4 diff --git a/Makefile b/Makefile index 278c630..a5a5120 100644 --- a/Makefile +++ b/Makefile @@ -41,111 +41,22 @@ else endif -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 > $@ +all: .version: FORCE $(Q)./describe.sh > .$@-tmp $(Q)cmp -s $@ .$@-tmp || cp .$@-tmp $@ $(Q)rm .$@-tmp -$(ppms): %.ppm: %.png - @echo " PPM $@" - $(Q)convert $< $@ - -zero16k: - $(Q)dd if=/dev/zero bs=16384 count=1 2>/dev/null > $@ - -FAILURE: - $(Q)echo FAILURE > $@ - -$(loader): FORCE .version +all: FORCE .version $(Q)$(MAKE) -C loader + $(Q)$(MAKE) -C twilight + $(Q)$(MAKE) -C lego FORCE: clean: - -rm -f $(targets) $(saves) $(elfs) $(exploit-objs) $(objs) $(slots) - -rm -f .version title.bin zero16k FAILURE + -rm -f .version $(MAKE) -C loader clean + $(MAKE) -C twilight clean + $(MAKE) -C lego clean