#####################################################################################################################################

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

#####################################################################################################################################

tsp.kdtree: kdtree/KDTree.hs kdtree/toureval.hs point.io/Point.hs
	ghc -fglasgow-exts -o tsp.kdtree point.io/Point.hs kdtree/KDTree.hs kdtree/toureval.hs

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

tsp.frp: frp/frp.hs  frp/toureval.hs point.io/Point.hs \
	 kdtree/nnkdtreeBool.hs kdtree/deleteBool.hs kdtree/kdtreeBool.hs \
	 kdtree/KDTree.hs nn/nn.hs
	ghc -fglasgow-exts -o tsp.frp point.io/Point.hs kdtree/kdtreeBool.hs kdtree/KDTree.hs \
	kdtree/deleteBool.hs kdtree/nnkdtreeBool.hs nn/nn.hs frp/frp.hs frp/toureval.hs

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

tsp.pqgreedy: pqgreedy/pqgreedy.hs point.io/Point.hs pqgreedy/toureval.hs \
	      kdtree/deleteInt.hs kdtree/nnkdtreeInt.hs kdtree/kdtreeInt.hs pq/Binpq.hs
	ghc -o tsp.pqgreedy point.io/Point.hs kdtree/kdtreeInt.hs kdtree/deleteInt.hs \
			    kdtree/nnkdtreeInt.hs pq/Binpq.hs pqgreedy/pqgreedy.hs pqgreedy/toureval.hs

#####################################################################################################################################

prof.kdtree: tsp.kdtree
	ghc -prof -auto-all -fglasgow-exts -o KDTREE point.io/Point.hs kdtree/KDTree.hs kdtree/toureval.hs

prof.nn: tsp.nn
	ghc  -prof -auto-all -o NN point.io/Point.hs kdtree/kdtreeBool.hs \
				kdtree/nnkdtreeBool.hs kdtree/deleteBool.hs nn/nn.hs nn/toureval.hs
# 	gzip -dc test.data/att48.tsp.gz | test.data/frtsplib.pl | ./NN +RTS -p

prof.frp: tsp.frp
	ghc  -prof -auto-all -o FRP point.io/Point.hs kdtree/kdtreeBool.hs \
				kdtree/nnkdtreeBool.hs kdtree/deleteBool.hs nn/nn.hs nn/toureval.hs
# 	gzip -dc test.data/att48.tsp.gz | test.data/frtsplib.pl | ./FRP +RTS -p

prof.greedy: tsp.greedy
	ghc  -prof -auto-all -o GREEDY point.io/Point.hs greedy/greedy.hs greedy/toureval.hs
# 	gzip -dc test.data/att48.tsp.gz | test.data/frtsplib.pl | ./GREEDY +RTS -p

prof.pqgreedy: tsp.pqgreedy
	ghc  -prof -auto-all -o PQGREEDY point.io/Point.hs kdtree/kdtreeInt.hs kdtree/deleteInt.hs \
					kdtree/nnkdtreeInt.hs pq/Binpq.hs pqgreedy/pqgreedy.hs pqgreedy/toureval.hs
# 	gzip -dc test.data/att48.tsp.gz | test.data/frtsplib.pl | ./PQGREEDY +RTS -p

#####################################################################################################################################

artigo: doc/artigo.tex
	pdflatex -o artigo.pdf doc/artigo.tex
	pdflatex -o artigo.pdf doc/artigo.tex
	
####################################################################################################################################

clear:
	rm -fv */*.hi */*.o *.prof tsp.* NN FRP GREEDY PQGREEDY KDTREE *.pdf *.log *.aux *.out

####################################################################################################################################
