summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/runtime-errors/Makefile
blob: 2c0bed9b636640288a3e85c2d3fab3b3929e70f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#########################################################################
#                                                                       #
#                                 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 Q Public License version 1.0.                #
#                                                                       #
#########################################################################

BASEDIR=../..

.PHONY: default
default:
	$(MAKE) compile
	$(MAKE) run

.PHONY: compile
compile:
	@for f in *.ml; do \
	  F=`basename $$f .ml`; \
	  rm -f $$F.bytecode $$F.native $$F.native.exe; \
	  $(OCAMLC) -w a -o $$F.bytecode $$f; \
	  if $(BYTECODE_ONLY); then : ; else \
	    $(OCAMLOPT) -w a -o $$F.native$(EXE) $$f; \
	  fi; \
	done
	@grep -q HAS_STACK_OVERFLOW_DETECTION $(TOPDIR)/config/s.h \
	  || rm -f stackoverflow.native$(EXE)

.PHONY: run
run:
	@ulimit -s 1024; \
	 for f in *.bytecode; do \
	  printf " ... testing '$$f':"; \
	  $(OCAMLRUN) ./$$f >$$f.result 2>&1 || true; \
	  DIFF="$(DIFF)" sh $$f.checker \
	  && echo " => passed" || echo " => failed"; \
	  fn=`basename $$f bytecode`native; \
	  if $(BYTECODE_ONLY) || [ ! -f "$${fn}$(EXE)" ] ; then : ; else \
	    printf " ... testing '$$fn':"; \
	    ./$${fn}$(EXE) >$$fn.result 2>&1 || true; \
	    DIFF="$(DIFF)" sh $$fn.checker \
	    && echo " => passed" || echo " => failed"; \
	  fi; \
	done

.PHONY: promote
promote: defaultpromote

.PHONY: clean
clean: defaultclean
	@rm -f *.bytecode *.native *.native.exe *.result

include $(BASEDIR)/makefiles/Makefile.common