
all : 	bin/animClock bin/animSquare bin/animTree \
	bin/blueTriangle bin/bracelet bin/burst \
	bin/catalog bin/pillar \
	bin/plotSin2Sin bin/simpleLine bin/snowflake bin/spiral \
	bin/thickCircle \
	bin/tree bin/treeColor bin/treeFrac \
	bin/ant bin/antFade \
	bin/spin \
	bin/styrene
	

# --- Vector demos

bin/animClock : src/Demo/AnimClock.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/AnimClock.hs -o bin/animClock

bin/animSquare : src/Demo/AnimSquare.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/AnimSquare.hs -o bin/animSquare

bin/animTree : src/Demo/AnimTree.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/AnimTree.hs -o bin/animTree

bin/blueTriangle : src/Demo/BlueTriangle.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/BlueTriangle.hs -o bin/blueTriangle

bin/bracelet : src/Demo/Bracelet.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Bracelet.hs -o bin/bracelet
 
bin/burst : src/Demo/Burst.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Burst.hs -o bin/burst

bin/catalog : src/Demo/Catalog.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Catalog.hs -o bin/catalog

bin/pillar : src/Demo/Pillar.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Pillar.hs -o bin/pillar

bin/plotSin2Sin : src/Demo/PlotSin2Sin.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/PlotSin2Sin.hs -o bin/plotSin2Sin

bin/simpleLine : src/Demo/SimpleLine.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/SimpleLine.hs -o bin/simpleLine

bin/snowflake : src/Demo/Snowflake.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Snowflake.hs -o bin/snowflake

bin/spiral : src/Demo/Spiral.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Spiral.hs -o bin/spiral

bin/thickCircle : src/Demo/ThickCircle.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/ThickCircle.hs -o bin/thickCircle

bin/tree : src/Demo/Tree.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/Tree.hs -o bin/tree

bin/treeColor : src/Demo/TreeColor.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/TreeColor.hs -o bin/treeColor

bin/treeFrac : src/Demo/TreeFrac.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Demo/TreeFrac.hs -o bin/treeFrac

# --
bin/ant :  src/CA/Ant/Main.hs
	ghc -O2 -fglasgow-exts -isrc -isrc/CA/Ant --make src/CA/Ant/Main.hs -o bin/ant

bin/antFade :  src/CA/AntFade/Main.hs
	ghc -O2 -fglasgow-exts -isrc -isrc/CA/AntFade --make src/CA/AntFade/Main.hs -o bin/antFade

bin/spin : src/CAVec/Spin/Main.hs
	ghc -O2 -fglasgow-exts -isrc -isrc/CAVec/Spin --make src/CAVec/Spin/Main.hs -o bin/spin

bin/styrene: src/Styrene/Main.hs src/Styrene/Wrapper.hs
	ghc -O2 -fglasgow-exts -isrc --make src/Styrene/Main.hs -o bin/styrene

# -- clean
.PHONY	: clean
clean	: 
	@echo "* Cleaning up"

	@rm -f  make/Makefile.deps \
		bin/*
	
	@find src \
			-name "*.o" \
		-o	-name "*.hi" \
		-follow | xargs -n 1 rm -f
		
	@echo



# -- build documents for GL library
glHs		= $(shell find src/Graphics -name "*.hs" -follow) \
		  $(shell find src/LSystem -name "*.hs" -follow) \
		  $(shell find src/CA/Wrapper.hs) \
		  $(shell find src/CAVec/Wrapper.hs) \
		  src/CA/Wrapper.hs


.PHONY	: doc
doc	: $(glHs)
	@echo "* Building documentation"
	@haddock -h -o doc --ignore-all-exports $^ 

