# These should have dependencies on the library too so we don't need to
# force recompilation each time.

all: hpc fusion

memcpy_extra: ../cbits/memcpy_extra.c
	$(CC) -O3 -c ../cbits/memcpy_extra.c

FLAGS=-fglasgow-exts -O2 -funbox-strict-fields -fdicts-cheap -fno-method-sharing -fmax-simplifier-iterations10 -fcpr-off -DSAFE -cpp -I../include
hpc: memcpy_extra
	rm -f run.tix
	ghc ${FLAGS} --make Properties/Test.hs -i.. -fhpc memcpy_extra.o -o run
	./run
	hpc markup run --exclude=Properties.Utils --exclude=Properties.Monomorphic.Base --exclude=Properties.Monomorphic.UVector

fusion: ./Fusion/*.hs ./Examples/*.hs
	( cd Fusion   && ghc -O --make Test.hs && ./Test )
	( cd Examples && ghc -O --make Test.hs && ./Test )

clean:
	rm -f *.html
	find . -name '*~'  -exec rm {} \;
	find . -name '*.hi' -exec rm {} \;
	find . -name '*.o'  -exec rm {} \;
	find . -name '*.log'  -exec rm {} \;
	find ../Data -name '*~'  -exec rm {} \;
	find ../Data -name '*.hi' -exec rm {} \;
	find ../Data -name '*.o'  -exec rm {} \;
	rm -f fuse raw run Performance Fusion/Test Examples/Test
	rm -f memcpy_extra.o
	rm -f *.tix
	rm -rf .hpc

