TEX_SVG=Swordman.svg Sword.svg

dist/.textures: $(TEX_SVG)
	mkdir dist; echo
	inkscape --export-png=Swordman.png --export-area=0:0:1024:1024 --export-dpi=90 --export-background-opacity=0.0 Swordman.svg
	inkscape --export-png=Sword.png --export-area=0:0:512:512 --export-dpi=90 --export-background-opacity=0.0 Sword.svg
	touch dist/.textures

clean:
	rm -rf dist

dist/.obj: swordman20130610.blend $(TEX_SVG)
	make dist/.textures
	mkdir dist/obj ; echo
	cp swordman20130610.blend dist/obj
	cp Sword.png dist/obj
	cp Swordman.png dist/obj
	cd dist/obj; sh $(DEVUTIL)/blend2obj.sh swordman20130610.blend swordman20130610.obj ; echo
	cd dist/obj; zip swordman20130610.zip swordman20130610.mtl swordman20130610.obj Swordman.png Sword.png
	touch dist/.obj

dist/.ogre: swordman20130610.blend $(TEX_SVG)
	make dist/.textures
	mkdir dist/ogre ; echo
	cd dist/ogre; sh $(DEVUTIL)/blend2ogre.sh $(DEVDATA)/swordman20130610/swordman20130610.blend ./swordman20130610.scene ; echo
	cd dist/ogre; rm Sword.skeleton.xml
	cd dist/ogre; xqilla -u -i Sword.mesh.xml $(DEVDATA)/del-skeleton.xq
	if [ ! -f dist/ogre/Swordman.mesh.xml ]; then exit -1; fi
	if [ ! -f dist/ogre/Swordman.skeleton.xml ]; then exit -1; fi
	if [ ! -f dist/ogre/Swordman.material ]; then exit -1; fi
	if [ ! -f dist/ogre/Swordman.png ]; then exit -1; fi
	if [ ! -f dist/ogre/Sword.mesh.xml ]; then exit -1; fi
	if [ ! -f dist/ogre/Sword.material ]; then exit -1; fi
	if [ ! -f dist/ogre/Sword.png ]; then exit -1; fi
	touch dist/.ogre

