#**************************************************************************
#*                                                                        *
#*                                 OCaml                                  *
#*                                                                        *
#*                 Xavier Clerc, SED, INRIA Rocquencourt                  *
#*                                                                        *
#*   Copyright 2010 Institut National de Recherche en Informatique et     *
#*     en Automatique.                                                    *
#*                                                                        *
#*   All rights reserved.  This file is distributed under the terms of    *
#*   the GNU Lesser General Public License version 2.1, with the          *
#*   special exception on linking described in the file LICENSE.          *
#*                                                                        *
#**************************************************************************

.PHONY: default
default:
	@for file in *.ml; do \
	  TERM=dumb $(OCAML) $(TOPFLAGS) <$$file 2>&1 \
	    | grep -v '^        OCaml version' > $$file.result; \
	  if [ -f $$file.principal.reference ]; then \
	    TERM=dumb $(OCAML) $(TOPFLAGS) -principal <$$file 2>&1 \
	      | grep -v '^        OCaml version' > $$file.principal.result; \
	  fi; \
	done
	@for file in *.reference; do \
	  printf " ... testing '$$file':"; \
	  $(DIFF) $$file `basename $$file reference`result >/dev/null \
          && echo " => passed" || echo " => failed"; \
	done

.PHONY: promote
promote: defaultpromote

.PHONY: clean
clean: defaultclean
	@rm -f *.result
