all: belugaboot.bin sguppyboot.bin


stage2.o: stage2.s
		ca65 -o $@ $<

stage2.bin: stage2.cfg stage2.o
		ld65 -o $@ -C stage2.cfg stage2.o

stage1_stackpush.inc: stage2.bin
		hexdump -e '/1 "stackpush #$$%02X\n"' $<|tac > $@
stage2_sz.inc: stage2.bin
		echo stage2_size = $(shell stat --printf="%s" $<) > $@


belugaboot.o: bootsector.s stage1_stackpush.inc stage2_sz.inc
		ca65 -DBELUGA -o $@ $<

belugaboot.bin: belugaboot.o bootsector.cfg
		ld65 -m belugaboot.map -o $@ -C bootsector.cfg $<

sguppyboot.o: bootsector.s stage1_stackpush.inc stage2_sz.inc
		ca65 -DSUPERGUPPY -o $@ $<

sguppyboot.bin: sguppyboot.o bootsector.cfg
		ld65 -m sguppyboot.map -o $@ -C bootsector.cfg $<

