all: tsp.nn tsp.frp tsp.greedy tsp.pqgreedy doc

tsp.nn: nn/nn.hs nn/toureval.hs point.io/Point.hs kdtree/kdtree.hs
	ghc -o tsp.nn point.io/Point.hs kdtree/kdtree.hs nn/nn.hs nn/toureval.hs

tsp.frp: frp/frp.hs  frp/toureval.hs point.io/Point.hs kdtree/kdtree.hs nn/nn.hs
	ghc -o tsp.frp point.io/Point.hs kdtree/kdtree.hs nn/nn.hs frp/frp.hs frp/toureval.hs

tsp.greedy: greedy/greedy.hs point.io/Point.hs kdtree/kdtree.hs greedy/toureval.hs
	ghc -o tsp.greedy point.io/Point.hs kdtree/kdtree.hs greedy/greedy.hs greedy/toureval.hs

tsp.pqgreedy: pqgreedy/pqgreedy.hs point.io/Point.hs pqgreedy/toureval.hs \
	      kdtree/kdtree.hs
	ghc -o tsp.pqgreedy point.io/Point.hs kdtree/kdtree.hs greedy/greedy.hs\
		pqgreedy/pqgreedy.hs pqgreedy/toureval.hs

prof: prof.nn prof.frp prof.greedy prof.pqgreedy

prof.nn: tsp.nn
	ghc  -prof -auto-all -o prof.tsp.nn point.io/Point.hs kdtree/kdtree.hs nn/nn.hs nn/toureval.hs

prof.frp: tsp.frp
	ghc  -prof -auto-all -o prof.tsp.frp point.io/Point.hs kdtree/kdtree.hs nn/nn.hs \
		frp/frp.hs frp/toureval.hs


prof.greedy: tsp.greedy
	ghc  -prof -auto-all -o prof.tsp.greedy point.io/Point.hs kdtree/kdtree.hs greedy/greedy.hs greedy/toureval.hs


prof.pqgreedy: tsp.pqgreedy
	ghc  -prof -auto-all -o prof.tsp.pqgreedy point.io/Point.hs kdtree/kdtree.hs greedy/greedy.hs\
		pqgreedy/pqgreedy.hs pqgreedy/toureval.hs


clear:
	rm -fv nn/*.hi frp/*.hi pq/*.hi pqgreedy/*.hi greedy/*.hi kdtree/*.hi point.io/*.hi \
		nn/*.o frp/*.o pq/*.o pqgreedy/*.o greedy/*.o kdtree/*.o point.io/*.o \
		*.aux *.ps *.dvi *.log *.pdf  *.out\
		tsp.nn tsp.frp tsp.greedy tsp.pqgreedy Kdtree prof.*

tex:
	latex doc/artigo.tex

dvips:
	dvips -o artigo.ps artigo.dvi

doc:	tex dvips
	ps2pdf artigo.ps

Kdtree: kdtree/kdtree.hs  kdtree/toureval.hs point.io/Point.hs kdtree/kdtree.hs
	ghc -o Kdtree point.io/Point.hs kdtree/kdtree.hs  kdtree/toureval.hs

prof.kdtree:
	ghc  -prof -auto-all -o prof.kdtree point.io/Point.hs kdtree/kdtree.hs  kdtree/toureval.hs


