1#**************************************************************************
2#*                                                                        *
3#*                                 OCaml                                  *
4#*                                                                        *
5#*                 Xavier Clerc, SED, INRIA Rocquencourt                  *
6#*                                                                        *
7#*   Copyright 2010 Institut National de Recherche en Informatique et     *
8#*     en Automatique.                                                    *
9#*                                                                        *
10#*   All rights reserved.  This file is distributed under the terms of    *
11#*   the GNU Lesser General Public License version 2.1, with the          *
12#*   special exception on linking described in the file LICENSE.          *
13#*                                                                        *
14#**************************************************************************
15
16.PHONY: default
17default: compile
18
19# See run-file in Makefile.several for the use of mktemp
20.PHONY: compile
21compile:
22	@for file in *.ml; do \
23	  printf " ... testing '$$file'"; \
24	  if [ `echo $$file | grep principal` ]; \
25	  then PRIN="-principal -w +18+19 -warn-error A"; \
26	  else PRIN=""; fi; \
27	  if [ `echo $$file | grep bad` ]; then \
28	    $(OCAMLC) -c -w a $$PRIN $$file 2>/dev/null \
29            && echo " => failed" || echo " => passed"; \
30	  else \
31	    F="`basename $$file .ml`"; \
32	    test -f $$F.mli && $(OCAMLC) -c -w a $$PRIN $$F.mli; \
33	    $(OCAMLC) -c -w a $$PRIN $$file 2>/dev/null \
34	    && if [ -f $$F.reference ]; then \
35	         test -e program.byte.exe && { \
36	           T="`mktemp -p .`"; \
37	           mv -f program.byte.exe "$$T"; \
38	           rm -f "$$T"; \
39	         } ; \
40	         rm -f program.byte program.byte.exe; \
41	         $(OCAMLC) $$F.cmo -o program.byte$(EXE) \
42	         && $(OCAMLRUN) program.byte$(EXE) >$$F.result \
43	         && $(DIFF) $$F.reference $$F.result >/dev/null; \
44	       fi \
45	    && echo " => passed" || echo " => failed"; \
46	  fi; \
47	done
48
49.PHONY: promote
50promote: defaultpromote
51
52.PHONY: clean
53clean: defaultclean
54	@rm -f program.byte program.byte.exe *.cm* *.result
55