TEX_SVG=Vehicle.svg Bob.svg Alice.svg

dist/.textures: $(TEX_SVG)
	mkdir dist; echo
	inkscape --export-png=Vehicle.png --export-area=0:0:512:512 --export-dpi=90 --export-background-opacity=0.0 Vehicle.svg
	inkscape --export-png=Bob.png --export-area=0:0:256:256 --export-dpi=90 --export-background-opacity=0.0 Bob.svg
	inkscape --export-png=Alice.png --export-area=0:0:512:512 --export-dpi=90 --export-background-opacity=0.0 Alice.svg
	touch dist/.textures

dist/.obj: w20130826.blend $(TEX_SVG)
	make dist/.textures
	mkdir dist/obj ; echo
	cp w20130826.blend dist/obj
	cp Vehicle.png dist/obj
	cp Bob.png dist/obj
	cp Alice.png dist/obj
	cd dist/obj; sh $(DEVUTIL)/blend2obj.sh w20130826.blend w20130826.obj ; echo
	cd dist/obj; zip w20130826.zip w20130826.mtl w20130826.obj Vehicle.png
	cd dist/obj; zip w20130826.zip w20130826.mtl w20130826.obj Bob.png
	cd dist/obj; zip w20130826.zip w20130826.mtl w20130826.obj Alice.png
	touch dist/.obj

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

clean:
	rm -rf dist
