Merge commit 'ocaml3102'
[ocaml.git] / test / Makefile
blob46fb2acb88a35625dda2533fd9c6477e979f659e
1 #########################################################################
2 # #
3 # Objective Caml #
4 # #
5 # Xavier Leroy, projet Cristal, INRIA Rocquencourt #
6 # #
7 # Copyright 1999 Institut National de Recherche en Informatique et #
8 # en Automatique. All rights reserved. This file is distributed #
9 # under the terms of the Q Public License version 1.0. #
10 # #
11 #########################################################################
13 # $Id$
15 include ../config/Makefile
17 CAMLC=../boot/ocamlrun ../ocamlc
18 CAMLOPT=../boot/ocamlrun ../ocamlopt
19 COMPFLAGS=-nostdlib -I ../stdlib -I KB -I Lex
20 OPTFLAGS=-S -g
21 CAMLYACC=../yacc/ocamlyacc
22 YACCFLAGS=-v
23 CAMLLEX=../boot/ocamlrun ../lex/ocamllex
24 CAMLDEP=../boot/ocamlrun ../tools/ocamldep
25 CAMLRUN=../byterun/ocamlrun
26 CODERUNPARAMS=OCAMLRUNPARAM='o=100'
28 BYTE_EXE=fib.byt takc.byt taku.byt sieve.byt quicksort.byt quicksort.fast.byt \
29 fft.byt fft.fast.byt soli.byt soli.fast.byt boyer.byt kb.byt \
30 nucleic.byt bdd.byt hamming.byt sorts.byt \
31 almabench.byt almabench.fast.byt weaktest.byt
33 CODE_EXE=$(BYTE_EXE:.byt=.out)
35 default: all codetest bytetest
37 all: $(BYTE_EXE) $(CODE_EXE)
39 # Nucleic
41 nucleic.out: nucleic.ml
42 case $(ARCH) in \
43 i386) sed -e '/<HAND_CSE>/,/<\/HAND_CSE>/d' -e '/NO_CSE>/d' \
44 nucleic.ml > nucleic.mlt; \
45 $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -o nucleic.out nucleic.mlt;\
46 rm -f nucleic.mlt;; \
47 *) $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -o nucleic.out nucleic.ml; \
48 esac
50 # KB
52 BYTE_KB=KB/terms.cmo KB/equations.cmo KB/kb.cmo KB/orderings.cmo KB/kbmain.cmo
53 CODE_KB=$(BYTE_KB:.cmo=.cmx)
55 kb.byt: $(BYTE_KB)
56 $(CAMLC) $(COMPFLAGS) $(BYTE_KB) -o kb.byt
57 kb.out: $(CODE_KB)
58 $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) $(CODE_KB) -o kb.out
60 clean::
61 rm -f KB/*.cm[iox] KB/*.[os]
62 rm -f KB/*~
64 # Genlex
66 BYTE_GENLEX=Lex/syntax.cmo Lex/scan_aux.cmo Lex/scanner.cmo Lex/gram_aux.cmo \
67 Lex/grammar.cmo Lex/lexgen.cmo Lex/output.cmo Lex/main.cmo
68 CODE_GENLEX=$(BYTE_GENLEX:.cmo=.cmx)
70 genlex.byt: $(BYTE_GENLEX)
71 $(CAMLC) $(COMPFLAGS) $(BYTE_GENLEX) -o genlex.byt
72 genlex.out: $(CODE_GENLEX)
73 $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) $(CODE_GENLEX) -o genlex.out
75 clean::
76 rm -f Lex/*.cm[iox] Lex/*.[os]
77 rm -f Lex/*~
78 rm -f Lex/grammar.output
80 Lex/grammar.ml Lex/grammar.mli: Lex/grammar.mly ../yacc/ocamlyacc$(EXE)
81 $(CAMLYACC) $(YACCFLAGS) Lex/grammar.mly
83 clean::
84 rm -f Lex/grammar.ml Lex/grammar.mli
85 beforedepend:: Lex/grammar.ml Lex/grammar.mli
87 Lex/scanner.ml: Lex/scanner.mll ../lex/ocamllex
88 $(CAMLLEX) Lex/scanner.mll
90 clean::
91 rm -f Lex/scanner.ml
92 beforedepend:: Lex/scanner.ml
94 # Moretest
96 clean::
97 rm -f Moretest/*.cm* Moretest/*.[os]
98 rm -f Moretest/*~
100 # Common rules
102 .SUFFIXES:
103 .SUFFIXES: .mli .ml .cmi .cmo .cmx .byt .fast.byt .out .fast.out
105 .ml.byt:
106 $(CAMLC) $(COMPFLAGS) -o $*.byt $<
108 .ml.fast.byt:
109 cp $*.ml $*_fast.ml
110 $(CAMLC) $(COMPFLAGS) -unsafe -o $*.fast.byt $*_fast.ml
111 rm -f $*_fast.ml
113 .ml.out:
114 $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -o $*.out $<
116 .ml.fast.out:
117 cp $*.ml $*_fast.ml
118 $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -unsafe -o $*.fast.out $*_fast.ml
119 rm -f $*_fast.ml
121 .mli.cmi:
122 $(CAMLC) $(COMPFLAGS) -c $<
124 .ml.cmo:
125 $(CAMLC) $(COMPFLAGS) -c $<
127 .ml.cmx:
128 $(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -c $<
130 $(BYTE_EXE) $(BYTE_KB) $(BYTE_GENLEX): ../ocamlc
131 $(BYTE_EXE): ../stdlib/stdlib.cma
132 $(CODE_EXE) $(CODE_KB) $(CODE_GENLEX): ../ocamlopt
133 $(CODE_EXE): ../stdlib/stdlib.cmxa ../stdlib/libasmrun.a
135 clean::
136 rm -f *.byt *.out
137 rm -f *.cm[iox] *.[os]
138 rm -f *~
140 # Regression test
142 test: codetest
144 bytetest:
145 set -e; \
146 for prog in $(BYTE_EXE:.byt=); do \
147 echo $$prog; \
148 $(CAMLRUN) $$prog.byt | diff -b -q - Results/$$prog.out; \
149 done
151 codetest:
152 set -e; \
153 for prog in $(CODE_EXE:.out=); do \
154 echo $$prog; \
155 ./$$prog.out | diff -b -q - Results/$$prog.out; \
156 done
158 clean::
159 rm -f Lex/testscanner.ml
161 # Benchmark
163 bench: codebench
165 bytebench:
166 set -e; \
167 for prog in $(BYTE_EXE:.byt=); do \
168 echo "$$prog " | cut -c 1-16 | tr -d '\012'; \
169 xtime -mintime 5 -o /dev/null -e /dev/null $(CAMLRUN) $$prog.byt; \
170 done
172 codebench:
173 set -e; \
174 for prog in $(CODE_EXE:.out=); do \
175 echo "$$prog " | cut -c 1-16 | tr -d '\012'; \
176 $(CODERUNPARAMS) xtime -mintime 5 -o /dev/null -e /dev/null ./$$prog.out; \
177 done
179 # Dependencies
181 depend: beforedepend
182 $(CAMLDEP) -I KB -I Lex *.mli *.ml KB/*.mli KB/*.ml Lex/*.mli Lex/*.ml > .depend
184 include .depend