# $Id$

default:
	@for file in *.ml; do \
	  $(OCAML) < $$file 2>&1 | grep -v '^        Objective Caml version' > $$file.result; \
	  if [ -f $$file.principal.reference ]; then \
	    $(OCAML) -principal < $$file 2>&1 | grep -v '^        Objective Caml version' > $$file.principal.result; \
	  fi; \
	done
	@for file in *.reference; do \
	  printf " ... testing '$$file':"; \
	  diff -q $$file `basename $$file reference`result || (echo " => failed" && exit 1) && echo " => passed"; \
	done

clean: defaultclean
	@rm -f *.result
