# TeaseOS 1.0                      by tatsu
# Please use TeaseOS for self-responsibility
# Please type this if you wanna build TeaseOS
#	make config
#	make backhground
#   make
TOOLPATH = ../z_tools/
MAKE	 = $(TOOLPATH)make.exe -r
EDIMG	 = $(TOOLPATH)edimg.exe
IMGTOL	 = $(TOOLPATH)imgtol.com
BIM2BIN	 = $(TOOLPATH)bim2bin.exe
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 data/nihongo.fnt \
	data/back.jpg bview/bview.hrb mine/mine.hrb data/settings.tl \
	pres/pres.hrb data/daiku.mml data/test.tp data/test.jpg
	$(EDIMG) imgin:$(TOOLPATH)fdimg0at.tek \
	wbinimg src:teaseos/ipl.bin len:512 from:0 to:0 \
	copy from:teaseos/teaseos.sys to:@: \
	copy from:data/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:data/daiku.mml to:@: \
	copy from:data/back.jpg to:@: \
	copy from:bview/bview.hrb to:@: \
	copy from:mine/mine.hrb to:@: \
	copy from:data/settings.tl to:@: \
	copy from:pres/pres.hrb to:@: \
	copy from:data/test.tp to:@: \
	copy from:data/test.jpg to:@: \
	imgout:teaseos.img

config:
	$(COPY) headers ..\z_tools\haribote

background:
	$(BIM2BIN) -osacmp in:data/back_.jpg out:data/back.jpg

img:
	$(MAKE) -C tlisp
	$(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) -C pres
	$(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 tlisp 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
	$(MAKE) -C pres clean
	$(DEL) teaseos.img
