PRJCLASS=./build/assets.jar:./build/classes:$(JME3CLASS)
PRJPATH=$(DEVPRJ)/viewer20130722
J3OCONV=java -ea -cp $(DEVUTIL)/dist:$(JME3CLASS):$(PRJPATH)/build/classes mn.jp.kekkouyakan.devutil.J3oConverter .:$(COMMONASSETS)

compile:
	if [ ! -d lib ]; then make lib_dir ; fi
	ant compile

lib_dir:
	rm -rf lib; echo
	mkdir lib
	ln.sh $(DEVHOME)/lib20130723/common lib
	ln.sh $(DEVHOME)/lib20130723/jme3 lib

clean:
	rm -rf tmp ; echo
	rm -rf mydist ; echo
	ant clean
	cd jnlp; make clean

ctags:
	ctags -R lib src

run:
	#java -esa -cp $(PRJCLASS) mygame.Main file://$(PRJPATH)/mydist/data/assets.zip
	java -esa -cp $(PRJCLASS) mygame.Main env:ASSETS_PATH

utilsw:
	java -esa -cp $(PRJCLASS) mygame.DressUtil tmp/hoge.j3o $(PRJPATH)/mydist/data/swordman20130610.zip swordman20130610/Swordman.j3o hand.equip.R swordman20130610/Sword.j3o
	cd tmp; $(J3OCONV) hoge.j3o

dd:
	make compile
	make mydist/data/.sahagin20130614
	make mydist/data/.swordman20130610
	make mydist/data/.minotauros20130619
	make mydist/data/.orc20130628
	make mydist/data/.kobold20130702
	make mydist/data/.yeti20131015
	make mydist/data/.bat20131020
	make mydist/data/.cat20131026
	cd mydist/data/; zip -r assets.zip sahagin20130614 swordman20130610 minotauros20130619 orc20130628 kobold20130702 yeti20131015 bat20131020 cat20131026

mydist/data/.cat20131026.ogre: $(DEVDATA)/cat20131026/cat20131026.blend
	cd $(DEVDATA)/cat20131026; make dist/.kuro20131026
	cd $(DEVDATA)/cat20131026; make dist/.shiro20131026
	cd $(DEVDATA)/cat20131026; make dist/.kuroshiro20131026
	cd $(DEVDATA)/cat20131026; make dist/.hai20131026
	cd $(DEVDATA)/cat20131026; make dist/.haishiro20131026
	cd $(DEVDATA)/cat20131026; make dist/.mike20131026
	cd $(DEVDATA)/cat20131026; make dist/.kizitora20131026
	cd $(DEVDATA)/cat20131026; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/cat20131026; echo
	cp -r $(DEVDATA)/cat20131026/dist/ogre tmp/cat20131026
	cd tmp; $(J3OCONV) cat20131026/Cat.mesh.xml -n cat20131026/Cat
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/cat20131026; echo
	mkdir mydist/data/cat20131026
	mv tmp/cat20131026/Cat.j3o mydist/data/cat20131026
	mv tmp/cat20131026/Cat.png mydist/data/cat20131026
	cp $(DEVDATA)/cat20131026/dist/kuro20131026/Cat.png mydist/data/cat20131026/kuro20131026.png
	cp $(DEVDATA)/cat20131026/dist/shiro20131026/Cat.png mydist/data/cat20131026/shiro20131026.png
	cp $(DEVDATA)/cat20131026/dist/kuroshiro20131026/Cat.png mydist/data/cat20131026/kuroshiro20131026.png
	cp $(DEVDATA)/cat20131026/dist/hai20131026/Cat.png mydist/data/cat20131026/hai20131026.png
	cp $(DEVDATA)/cat20131026/dist/haishiro20131026/Cat.png mydist/data/cat20131026/haishiro20131026.png
	cp $(DEVDATA)/cat20131026/dist/mike20131026/Cat.png mydist/data/cat20131026/mike20131026.png
	cp $(DEVDATA)/cat20131026/dist/kizitora20131026/Cat.png mydist/data/cat20131026/kizitora20131026.png
	mv mydist/data/cat20131026/kizitora20131026.png mydist/data/cat20131026/Cat.png
	touch mydist/data/.cat20131026.ogre

mydist/data/.cat20131026: $(DEVDATA)/cat20131026/cat20131026.blend data/cat20131026.j3x
	make mydist/data/.cat20131026.ogre
	$(J3OCONV) data/cat20131026.j3x tmp/cat20131026/index.j3o
	mv tmp/cat20131026/index.j3o mydist/data/cat20131026
	cd mydist/data; zip -r cat20131026.zip cat20131026
	cd mydist/data; jar cvf cat20131026.jar cat20131026
	touch mydist/data/.cat20131026

mydist/data/.bat20131020.ogre: $(DEVDATA)/bat20131020/bat20131020.blend
	cd $(DEVDATA)/bat20131020; make dist/.white20131020
	cd $(DEVDATA)/bat20131020; make dist/.purple20131020
	cd $(DEVDATA)/bat20131020; make dist/.blue20131020
	cd $(DEVDATA)/bat20131020; make dist/.texture
	cd $(DEVDATA)/bat20131020; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/bat20131020; echo
	cp -r $(DEVDATA)/bat20131020/dist/ogre tmp/bat20131020
	cd tmp; $(J3OCONV) bat20131020/Bat.mesh.xml -n bat20131020/Bat
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/bat20131020; echo
	mkdir mydist/data/bat20131020
	mv tmp/bat20131020/Bat.j3o mydist/data/bat20131020
	mv tmp/bat20131020/Bat.png mydist/data/bat20131020
	cp $(DEVDATA)/bat20131020/dist/blue20131020/Bat.png mydist/data/bat20131020/blue20131020.png
	cp $(DEVDATA)/bat20131020/dist/purple20131020/Bat.png mydist/data/bat20131020/purple20131020.png
	cp $(DEVDATA)/bat20131020/dist/white20131020/Bat.png mydist/data/bat20131020/white20131020.png
	touch mydist/data/.bat20131020.ogre

mydist/data/.bat20131020: $(DEVDATA)/bat20131020/bat20131020.blend data/bat20131020.j3x
	make mydist/data/.bat20131020.ogre
	$(J3OCONV) data/bat20131020.j3x tmp/bat20131020/index.j3o
	mv tmp/bat20131020/index.j3o mydist/data/bat20131020
	cd mydist/data; zip -r bat20131020.zip bat20131020
	cd mydist/data; jar cvf bat20131020.jar bat20131020
	touch mydist/data/.bat20131020

mydist/data/.yeti20131015.ogre: $(DEVDATA)/yeti20131015/yeti20131015.blend
	cd $(DEVDATA)/yeti20131015; make dist/.blue20131015
	cd $(DEVDATA)/yeti20131015; make dist/.texture
	cd $(DEVDATA)/yeti20131015; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/yeti20131015; echo
	cp -r $(DEVDATA)/yeti20131015/dist/ogre tmp/yeti20131015
	cd tmp; $(J3OCONV) yeti20131015/Yeti.mesh.xml -n yeti20131015/Yeti
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/yeti20131015; echo
	mkdir mydist/data/yeti20131015
	mv tmp/yeti20131015/Yeti.j3o mydist/data/yeti20131015
	mv tmp/yeti20131015/Yeti.png mydist/data/yeti20131015
	cp $(DEVDATA)/yeti20131015/dist/blue20131015/Yeti.png mydist/data/yeti20131015/blue20131015.png
	touch mydist/data/.yeti20131015.ogre

mydist/data/.yeti20131015: $(DEVDATA)/yeti20131015/yeti20131015.blend data/yeti20131015.j3x
	make mydist/data/.yeti20131015.ogre
	$(J3OCONV) data/yeti20131015.j3x tmp/yeti20131015/index.j3o
	mv tmp/yeti20131015/index.j3o mydist/data/yeti20131015
	cd mydist/data; zip -r yeti20131015.zip yeti20131015
	cd mydist/data; jar cvf yeti20131015.jar yeti20131015
	touch mydist/data/.yeti20131015

mydist/data/.sahagin20130614.ogre: $(DEVDATA)/sahagin20130614/sahagin20130614.blend
	cd $(DEVDATA)/sahagin20130614; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/sahagin20130614; echo
	cp -r $(DEVDATA)/sahagin20130614/dist/ogre tmp/sahagin20130614
	cd tmp; $(J3OCONV) sahagin20130614/Sahagin.mesh.xml -n sahagin20130614/Sahagin
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/sahagin20130614; echo
	mkdir mydist/data/sahagin20130614
	mv tmp/sahagin20130614/Sahagin.j3o mydist/data/sahagin20130614
	mv tmp/sahagin20130614/Sahagin.png mydist/data/sahagin20130614
	touch mydist/data/.sahagin20130614.ogre

mydist/data/.sahagin20130614: $(DEVDATA)/sahagin20130614/sahagin20130614.blend data/sahagin20130614.j3x
	make mydist/data/.sahagin20130614.ogre
	$(J3OCONV) data/sahagin20130614.j3x tmp/sahagin20130614/index.j3o
	mv tmp/sahagin20130614/index.j3o mydist/data/sahagin20130614
	cd mydist/data; zip -r sahagin20130614.zip sahagin20130614
	cd mydist/data; jar cvf sahagin20130614.jar sahagin20130614
	touch mydist/data/.sahagin20130614

mydist/data/.swordman20130610.ogre: $(DEVDATA)/swordman20130610/swordman20130610.blend
	cd $(DEVDATA)/swordman20130610; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/swordman20130610; echo
	cp -r $(DEVDATA)/swordman20130610/dist/ogre tmp/swordman20130610
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/swordman20130610; echo
	mkdir mydist/data/swordman20130610
	cd tmp; $(J3OCONV) swordman20130610/Swordman.mesh.xml -n swordman20130610/Swordman
	mv tmp/swordman20130610/Swordman.j3o mydist/data/swordman20130610
	mv tmp/swordman20130610/Swordman.png mydist/data/swordman20130610
	cd tmp; $(J3OCONV) swordman20130610/Sword.mesh.xml -n swordman20130610/Sword
	mv tmp/swordman20130610/Sword.j3o mydist/data/swordman20130610
	mv tmp/swordman20130610/Sword.png mydist/data/swordman20130610
	touch mydist/data/.swordman20130610.ogre

mydist/data/.swordman20130610: $(DEVDATA)/swordman20130610/swordman20130610.blend data/swordman20130610.j3x
	make mydist/data/.swordman20130610.ogre
	$(J3OCONV) data/swordman20130610.j3x tmp/swordman20130610/index.j3o
	mv tmp/swordman20130610/index.j3o mydist/data/swordman20130610
	cd mydist/data; zip -r swordman20130610.zip swordman20130610
	cd mydist/data; jar cvf swordman20130610.jar swordman20130610
	touch mydist/data/.swordman20130610

mydist/data/.minotauros20130619.ogre: $(DEVDATA)/minotauros20130619/minotauros20130619.blend
	cd $(DEVDATA)/minotauros20130619; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/minotauros20130619; echo
	cp -r $(DEVDATA)/minotauros20130619/dist/ogre tmp/minotauros20130619
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/minotauros20130619; echo
	mkdir mydist/data/minotauros20130619
	cd tmp; $(J3OCONV) minotauros20130619/Minotauros.mesh.xml -n minotauros20130619/Minotauros
	mv tmp/minotauros20130619/Minotauros.j3o mydist/data/minotauros20130619
	mv tmp/minotauros20130619/Minotauros.png mydist/data/minotauros20130619
	cd tmp; $(J3OCONV) minotauros20130619/MinotaurosNoseRing.mesh.xml -n minotauros20130619/MinotaurosNoseRing
	mv tmp/minotauros20130619/MinotaurosNoseRing.j3o mydist/data/minotauros20130619
	mv tmp/minotauros20130619/MinotaurosNoseRing.png mydist/data/minotauros20130619
	cd tmp; $(J3OCONV) minotauros20130619/MinotaurosBell.mesh.xml -n minotauros20130619/MinotaurosBell
	mv tmp/minotauros20130619/MinotaurosBell.j3o mydist/data/minotauros20130619
	mv tmp/minotauros20130619/MinotaurosBell.png mydist/data/minotauros20130619
	cd tmp; $(J3OCONV) minotauros20130619/MinotaurosSkull.mesh.xml -n minotauros20130619/MinotaurosSkull
	mv tmp/minotauros20130619/MinotaurosSkull.j3o mydist/data/minotauros20130619
	mv tmp/minotauros20130619/MinotaurosSkull.png mydist/data/minotauros20130619
	cd tmp; $(J3OCONV) minotauros20130619/MinotaurosClub.mesh.xml -n minotauros20130619/MinotaurosClub
	mv tmp/minotauros20130619/MinotaurosClub.j3o mydist/data/minotauros20130619
	mv tmp/minotauros20130619/MinotaurosClub.png mydist/data/minotauros20130619
	touch mydist/data/.minotauros20130619.ogre

mydist/data/.minotauros20130619: $(DEVDATA)/minotauros20130619/minotauros20130619.blend data/minotauros20130619.j3x
	make mydist/data/.minotauros20130619.ogre
	$(J3OCONV) data/minotauros20130619.j3x tmp/minotauros20130619/index.j3o
	mv tmp/minotauros20130619/index.j3o mydist/data/minotauros20130619
	cd mydist/data; zip -r minotauros20130619.zip minotauros20130619
	cd mydist/data; jar cvf minotauros20130619.jar minotauros20130619
	touch mydist/data/.minotauros20130619

mydist/data/.orc20130628.ogre: $(DEVDATA)/orc20130628/orc20130628.blend
	cd $(DEVDATA)/orc20130628; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/orc20130628; echo
	cp -r $(DEVDATA)/orc20130628/dist/ogre tmp/orc20130628
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/orc20130628; echo
	mkdir mydist/data/orc20130628
	cd tmp; $(J3OCONV) orc20130628/Orc.mesh.xml -n orc20130628/Orc
	mv tmp/orc20130628/Orc.j3o mydist/data/orc20130628
	mv tmp/orc20130628/Orc.png mydist/data/orc20130628
	cd tmp; $(J3OCONV) orc20130628/OrcAxe.mesh.xml -n orc20130628/OrcAxe
	mv tmp/orc20130628/OrcAxe.j3o mydist/data/orc20130628
	mv tmp/orc20130628/OrcAxe.png mydist/data/orc20130628
	cd tmp; $(J3OCONV) orc20130628/OrcHelm.mesh.xml -n orc20130628/OrcHelm
	mv tmp/orc20130628/OrcHelm.j3o mydist/data/orc20130628
	mv tmp/orc20130628/OrcHelm.png mydist/data/orc20130628
	cd tmp; $(J3OCONV) orc20130628/OrcArmor.mesh.xml -n orc20130628/OrcArmor
	mv tmp/orc20130628/OrcArmor.j3o mydist/data/orc20130628
	mv tmp/orc20130628/OrcArmor.png mydist/data/orc20130628
	touch mydist/data/.orc20130628.ogre

mydist/data/.orc20130628: $(DEVDATA)/orc20130628/orc20130628.blend data/orc20130628.j3x
	make mydist/data/.orc20130628.ogre
	$(J3OCONV) data/orc20130628.j3x tmp/orc20130628/index.j3o
	mv tmp/orc20130628/index.j3o mydist/data/orc20130628
	cd mydist/data; zip -r orc20130628.zip orc20130628
	cd mydist/data; jar cvf orc20130628.jar orc20130628
	touch mydist/data/.orc20130628

mydist/data/.kobold20130702.ogre: $(DEVDATA)/kobold20130702/kobold20130702.blend
	cd $(DEVDATA)/kobold20130702; make dist/.ogre
	mkdir tmp; echo
	rm -rf tmp/kobold20130702; echo
	cp -r $(DEVDATA)/kobold20130702/dist/ogre tmp/kobold20130702
	mkdir mydist; echo
	mkdir mydist/data; echo
	rm -rf mydist/data/kobold20130702; echo
	mkdir mydist/data/kobold20130702
	cd tmp; $(J3OCONV) kobold20130702/Kobold.mesh.xml -n kobold20130702/Kobold
	mv tmp/kobold20130702/Kobold.j3o mydist/data/kobold20130702
	mv tmp/kobold20130702/Kobold.png mydist/data/kobold20130702
	cd tmp; $(J3OCONV) kobold20130702/KoboldSpear.mesh.xml -n kobold20130702/KoboldSpear
	mv tmp/kobold20130702/KoboldSpear.j3o mydist/data/kobold20130702
	mv tmp/kobold20130702/KoboldSpear.png mydist/data/kobold20130702
	cd tmp; $(J3OCONV) kobold20130702/KoboldArmor.mesh.xml -n kobold20130702/KoboldArmor
	mv tmp/kobold20130702/KoboldArmor.j3o mydist/data/kobold20130702
	mv tmp/kobold20130702/KoboldArmor.png mydist/data/kobold20130702
	touch mydist/data/.kobold20130702.ogre

mydist/data/.kobold20130702: $(DEVDATA)/kobold20130702/kobold20130702.blend data/kobold20130702.j3x
	make mydist/data/.kobold20130702.ogre
	$(J3OCONV) data/kobold20130702.j3x tmp/kobold20130702/index.j3o
	mv tmp/kobold20130702/index.j3o mydist/data/kobold20130702
	cd mydist/data; zip -r kobold20130702.zip kobold20130702
	cd mydist/data; jar cvf kobold20130702.jar kobold20130702
	touch mydist/data/.kobold20130702

