TOOLPATH = ../z_tools/

MAKE	 = $(TOOLPATH)make.exe -r
EDIMG	 = $(TOOLPATH)edimg.exe
IMGTOL	 = $(TOOLPATH)imgtol.com
COPY	 = copy
DEL		 = del

# ftHg
default:
	$(MAKE) run

# t@CK
teaseos.img : teaseos/ipl.bin teaseos/teaseos.sys \
	bball/bball.hrb invader/invader.hrb calc/calc.hrb memo/memo.hrb \
	mplay/mplay.hrb iview/iview.hrb test/test.hrb
	$(EDIMG) imgin:$(TOOLPATH)fdimg0at.tek \
	wbinimg src:teaseos/ipl.bin len:512 from:0 to:0 \
	copy from:teaseos/teaseos.sys to:@: \
	copy from:nihongo.fnt to:@: \
	copy from:bball/bball.hrb to:@: \
	copy from:invader/invader.hrb to:@: \
	copy from:calc/calc.hrb to:@: \
	copy from:memo/memo.hrb to:@: \
	copy from:mplay/mplay.hrb to:@: \
	copy from:iview/iview.hrb to:@: \
	copy from:test/test.hrb to:@: \
	copy from:daiku.mml to:@: \
	copy from:back.jpg to:@: \
	copy from:readme.txt to:@: \
	imgout:teaseos.img

# R}h
img:
	$(MAKE) -C apilib
	$(MAKE) -C teaseos
	$(MAKE) -C bball
	$(MAKE) -C invader
	$(MAKE) -C calc
	$(MAKE) -C memo
	$(MAKE) -C mplay
	$(MAKE) -C iview
	$(MAKE) -C test
	$(MAKE) teaseos.img

run:
	$(MAKE) img
	$(COPY) teaseos.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C ../z_tools/qemu

install:
	$(MAKE) img
	$(IMGTOL) w a: teaseos.img

clean:
	$(MAKE) -C apilib clean
	$(MAKE) -C teaseos clean
	$(MAKE) -C bball clean
	$(MAKE) -C invader clean
	$(MAKE) -C calc clean
	$(MAKE) -C memo clean
	$(MAKE) -C mplay clean
	$(MAKE) -C iview clean
	$(MAKE) -C test clean
