# build and test all examples
#

default: test6.html test7.html
	cd ../; runghc examples/runexamples.hs
	cd ../; runghc examples/tests.hs
	ghc -O2 romberg.hs; ./romberg

%.html: %.md
	pandoc -s $< -o "$@"

%.md: %.Rmd
	R --no-save -e 'library(knitr); knit("$<")'

%.Rmd.html: %.Rmd
	vim -c ":TOhtml" -c ":wqall" $<

.PHONY: clean installdeps
clean:
	rm -rf haskell*.txt romberg{,.hi,.o}  *.out Rtmp/ \
		test{6,7}.{md}

cleaner: clean
	rm -rf test{6,7}.{html,Rmd.html,md} test6_fig1.png \
		romberg_Double.pdf romberg_Float.pdf

installdeps:
	R --no-save -e 'install.packages(c("knitr", "lattice", "reshape", "ggplot2", "lattice"))'
	cabal install lens numbers hspec

