QEMU=/mnt/work/build/qemu-1.2.2/i386-softmmu/qemu-system-i386
KOLIBRI_IMG_PATH=.
HDA_PATH=.

all: torrent.obj sabaxar narspi

torrent.obj : torrent.asm torrent.inc tracker.asm peer.asm bencode.asm percent.asm
	fasm $< $@

sabaxar: sabaxar.asm torrent.inc
	fasm $< $@

narspi: narspi.asm torrent.inc
	fasm $< $@

run : all
	mcopy -vmoi $(KOLIBRI_IMG_PATH)/kolibri.img torrent.obj ::lib/torrent.obj
	$(QEMU) -m 128 -fda $(KOLIBRI_IMG_PATH)/kolibri.img -boot a -vga vmware -net nic,model=rtl8139 -net user -hda fat:$(HDA_PATH)

clean :
	rm -f torrent.obj sabaxar narspi

.PHONY: all clean run
