TOOLPATH = ../z_tools/
INCPATH  = ../z_tools/haribote/

MAKE     = make.exe -r
EDIMG    = $(TOOLPATH)edimg.exe
IMGTOL   = $(TOOLPATH)imgtol.com
MKISOFS  = cdrtools-1.11a12-win32-bin/mkisofs
COPY     = cp
DEL      = rm

# ftHg

default :
	cd haribote && $(MAKE)
	$(MAKE) haribote.img

# t@CK

haribote.iso : Makefile
	cd haribote && $(MAKE)
	$(COPY) haribote/iplcd.bin cd/
	$(MKISOFS) -hard-disk-boot -b iplcd.bin -o ./haribote.iso  ./cd

#haribote.img : Makefile
#	cd haribote && $(MAKE)
#	perl makefat.pl > fatrootdir
#	perl hdimage.pl -i=0,haribote/mbr.bin -i=0x3f,haribote/iplhd.bin -i=0x281,haribote/haribote.sys -i=0x27f,fatrootdir -s=0x372 -o $@

haribote.img : Makefile fat.fatdef
	cd haribote && $(MAKE)
	./fatmgr.exe



haribote.img : haribote/mbr.bin haribote/iplhd.bin haribote/haribote.sys

# R}h

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

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

full :
	$(MAKE) clean
	$(MAKE)

run_full :
	$(MAKE) full
	$(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C ../z_tools/qemu

install_full :
	$(MAKE) full
	$(IMGTOL) w a: haribote.img

run_os :
	$(MAKE) -C haribote
	$(MAKE) run

clean :
	cd haribote && $(MAKE) clean
	-$(DEL) haribote.img
# Ȃ

src_only :
	$(MAKE) clean
	-$(DEL) haribote.img

clean_full :
	$(MAKE) -C haribote		clean
	$(MAKE) -C apilib		clean

src_only_full :
	$(MAKE) -C haribote		src_only
	$(MAKE) -C apilib		src_only
	-$(DEL) haribote.img

refresh :
	$(MAKE) full
	$(MAKE) clean_full
	-$(DEL) haribote.img
