# TeaseOS 0.8                      by tatsu
# Please use TeaseOS self-responsibility
# If you wanna compile this, you must type.
#    make configure
#    make
TOOLPATH = ../z_tools/
MAKE	 = $(TOOLPATH)make.exe -r
EDIMG	 = $(TOOLPATH)edimg.exe
IMGTOL	 = $(TOOLPATH)imgtol.com
COPY	 = copy
DEL		 = del

default:
	$(MAKE) run

teaseos.img: teaseos/ipl.bin teaseos/teaseos.sys \
	invader/invader.hrb calc/calc.hrb memo/memo.hrb \
	mplay/mplay.hrb iview/iview.hrb test/test.hrb nihongo.fnt \
	back.jpg bview/bview.hrb mine/mine.hrb settings.txt
	$(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: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:bview/bview.hrb to:@: \
	copy from:mine/mine.hrb to:@: \
	copy from:settings.txt to:@: \
	imgout:teaseos.img

configure:
	$(COPY) stdlib.h ..\z_tools\haribote\stdlib.h
	$(COPY) setjmp.h ..\z_tools\haribote\setjmp.h
	$(COPY) stdio.h ..\z_tools\haribote\stdio.h

img:
	$(MAKE) -C teaseos
	$(MAKE) -C api
	$(MAKE) -C kozos
	$(MAKE) -C invader
	$(MAKE) -C calc
	$(MAKE) -C memo
	$(MAKE) -C mplay
	$(MAKE) -C iview
	$(MAKE) -C test
	$(MAKE) -C bview
	$(MAKE) -C mine
	$(MAKE) teaseos.img

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

run0:
	$(MAKE) img
	$(MAKE) -C ../z_tools/qemu

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

clean:
	$(MAKE) -C teaseos clean
	$(MAKE) -C api clean
	$(MAKE) -C kozos 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
	$(MAKE) -C bview clean
	$(MAKE) -C mine clean
	$(DEL) teaseos.img
