SHELL=/bin/sh

###
###
#
# Do not edit this file.
# Definitions are in makefile.inc.
#
###
###


everything: 
	@echo ------======= TAGL22 ======-------
	@echo 
	@echo Make sure you have the right 'makefile.inc'
	@echo See readme.1st
	@echo 
	@echo STEP 1 : Dependancies
	@echo ---------------------
	make dep
	@echo 
	@echo STEP 2 : Library
	@echo ----------------
	make library
	@echo 
	@echo STEP 3 : Utilities
	@echo ------------------
	make util
	@echo
	@echo STEP 4 : Sample programs
	@echo ------------------------
	make Examples
	@echo
	@echo Installation completed.
	@echo examples programs are in bin.
	@echo library and drivers are in lib.
	@echo	
	@echo Running some examples
	@echo ---------------------
	@make -i test

util:
	cd src/utils; $(MAKE)
	cp config/genv bin


test:
	@echo Running some examples
	@echo ---------------------
	@sh -c "if [ -x `which wish` ]; then make tcltk; else make demo; fi"

dep:
	cd src/TAGL;       $(MAKE) dep
	cd src/processors; $(MAKE) dep

library:
	cd src/TAGL;       $(MAKE)
	cd src/processors; $(MAKE)

Examples:
	cd examples; $(MAKE)
	
Samples:
	cd examples; $(MAKE) samples

clean:
	find . -name "*~" -exec rm {} \;
	find . -name "*.o" -exec rm {} \;
	find . -name "*.a" -exec rm {} \;
	find . -name "core" -exec rm {} \;
	rm -f bin/* 	

dist: clean
	cd ..; tar cf tagl22.tar tagl22; gzip tagl22.tar; mv tagl22.tar.gz tagl22.tgz

demo:
	@echo "'make' is going to launch a few demos."
	@echo "There is also a Tcl/Tk interface for launching demos,"
	@echo "but it seems that Tcl/Tk is not installed on your system."
	@echo "Typing 'q' allows to quit a demo."
	@echo "Left   button + mouse move : rotating"
	@echo "Middle button + mouse move : panning"
	@echo "Right  button + mouse move : lighting"
	@echo "+/-                        : zooming in/out"
	@echo "See 'doc/rotate.doc' for more info."
	@cd data; ../bin/rotate -geom objects/teapot.geom -exec 'aws' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/teapot.geom -exec 's' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/teapot.geom -exec 'sw' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/apple_logo.geom -col objects/apple_logo.ipcol -exec 'Cswhhh' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/teapot.geom -tex textures/meditdn.tga -exec 'Cstuuw' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/teapot.geom -tex textures/2.tga -exec 'CstT' 2> /dev/null	
	@cd data; ../bin/rotate -geom objects/pear.geom -tex textures/2.tga -exec 'CstT' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/tref.geom -tex textures/cldsmap.tga -exec 'nCstT' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/cow.geom -tex textures/sunset2.tga -exec 'CstT' 2> /dev/null	
	@cd data; ../bin/rotate -geom objects/babem.geom -tex textures/refmap.tga -exec 'CstT++++++++++' 2> /dev/null
	@cd data; ../bin/rotate -geom objects/pear.geom -tex textures/raytrace.tga -exec 'CstT' 2> /dev/null
	@echo "The demo is over"
	@echo "You will be able to launch this demo again by typing 'make demo'."	
	@echo "There are more objects and textures in the 'data' directory"
	@echo "You can also install Tcl/Tk"

tcltk:
	@echo "It seems that Tcl/Tk is installed on your system."
	@echo "Launching GUI ..."
	@echo "You will be able to launch this again by typing 'make tcltk'"
	@echo "Or by typing 'wish -f tagl-menu' in the 'data' directory"
	@cd data; wish -f tagl-menu &
