.PHONY: clean client boot test

all: boot client test

client:
	@$(MAKE) -C client

boot:
	@$(MAKE) -C stub
	@$(MAKE) -C loader
	@$(DEVKITPPC)/bin/bin2s -a 32 stub/stub.bin > \
		boot/source/stub_bin.S
	@$(DEVKITPPC)/bin/bin2s -a 32 loader/loader.dol > \
		boot/source/loader_dol.S
	@$(MAKE) -C boot

test:
	@$(MAKE) -C test

clean:
	@$(MAKE) -C client clean
	@$(MAKE) -C stub clean
	@$(MAKE) -C loader clean
	@$(MAKE) -C boot clean
	@$(MAKE) -C test clean
	@rm -f boot/source/stub_bin.S boot/source/loader_dol.S

install:
	@$(MAKE) -C client install

testupload: client test
	client/geckoupload test/test.dol

selfupdate: client boot
	client/geckoupload boot/geckoloader.dol

twilight: boot
	@echo i dont know what im doing
#	dd if=boot/geckoloader.elf of=/dev/sdd bs=512 seek=2048 && sync

release: boot
	$(DEVKITPPC)/bin/powerpc-gekko-strip -g boot/geckoloader.elf
	cp boot/geckoloader.elf boot/geckoloader.dol test/test.dol .

