SHELL=/bin/bash

analyze: *.hs Ein/*.hs Ein/*.hs-boot
	ghc -o analyze -odir build -O -package ghc -package parsec -auto-all --make RecurrenceGenerator.hs -main-is RecurrenceGenerator.main

all: analyze tests doc

test: tests
	./AllHUnit

tests: AllHUnit

AllHUnit: *.hs Ein/*.hs Ein/*.hs-boot
	ghc -odir build-tests -O -package ghc -package parsec -auto-all --make AllHUnit.hs -main-is AllHUnit.main

doc: *.hs Ein/*.hs Ein/*.hs-boot
	mkdir -p doc
	haddock -h -o doc --optghc="-package ghc" --optghc="-package parsec" $(shell ls *.hs Ein/*.hs | grep -v HUnit)

clean:
	rm -f *.hi *.o Ein/*.hi Ein/*.o Ein/*.hi-boot Ein/*.o-boot
	rm -rf build
	rm -rf build-tests
	rm -rf doc
	rm -f AllHUnit
	rm -f analyze

.PHONY: all clean doc test tests
