SRC        = $(wildcard *hs)

GHCOPTS    = -cpp -O2 -W -fglasgow-exts # -package bio

all: rbr mct

.PHONY: test
test: rbr
	make -C test test

all-static: rbr_s mct_s

install: all-static
	cp rbr_s ~/bin/rbr;\
	cp mct_s ~/bin/mct

all-prof: rbr_p f3_p

# repeatbeater

rbr: $(SRC) hooks.o
	ghc --make $(GHCOPTS) RBR.lhs hooks.o -o rbr

rbr_p: $(SRC) hooks.o
	ghc --make $(GHCOPTS) -prof -auto-all hooks.o RBR.lhs -o rbr_p

rbr_s: $(SRC) hooks.o
	ghc --make $(GHCOPTS) -optl-static hooks.o RBR.lhs -o rbr_s

hooks.o: hooks.c
	ghc -c hooks.c

# mask count/comparison tool
mct: $(SRC)
	ghc --make $(GHCOPTS) MCT.lhs -o mct

mct_s: $(SRC)
	ghc --make $(GHCOPTS) MCT.lhs -optl-static -o mct_s

clean: 
	rm *.o *.hi

print_prof:
	a2ps -1 -l 132 f3_p.prof -o - | lpr -Plp6

%.ps: %.lhs 
	a2ps -1 -l 100 --pretty-print=Haskell $< -o $@
