summaryrefslogtreecommitdiffstats
path: root/test/Makefile.nt
blob: a6cdcae2687abff3424612d3979ad0d2923fbc33 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#########################################################################
#                                                                       #
#                            Objective Caml                             #
#                                                                       #
#            Xavier Leroy, projet Cristal, INRIA Rocquencourt           #
#                                                                       #
#   Copyright 1999 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.                #
#                                                                       #
#########################################################################

# $Id$

!include ..\config\Makefile.nt

CAMLC=..\boot\ocamlrun ..\ocamlc
CAMLOPT=..\boot\ocamlrun ..\ocamlopt
COMPFLAGS=-I ..\stdlib -I KB -I Lex
OPTFLAGS=-S
CAMLYACC=..\yacc\ocamlyacc
CAMLLEX=..\boot\ocamlrun ..\lex\ocamllex
CAMLDEP=..\boot\ocamlrun ..\tools\ocamldep
CAMLRUN=..\byterun\ocamlrun
CODERUNPARAMS=OCAMLRUNPARAM='o=100'

BYTE_EXE=fib.byt takc.byt taku.byt sieve.byt quicksort.byt quicksort.fast.byt \
  fft.byt fft.fast.byt soli.byt soli.fast.byt boyer.byt kb.byt \
  nucleic.byt genlex.byt bdd.byt

CODE_EXE=$(BYTE_EXE:.byt=.exe)

all: $(BYTE_EXE) $(CODE_EXE)

# Nucleic

nucleic.exe: nucleic.ml
!if "$(ARCH)" == "i386"
	sed -e "/<HAND_CSE>/,/<\/HAND_CSE>/d" -e "/NO_CSE>/d" nucleic.ml > nucleic.mlt
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -o nucleic.exe nucleic.mlt
	rm -f nucleic.mlt
!else
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -o nucleic.exe nucleic.ml
!endif

# KB

BYTE_KB=KB\terms.cmo KB\equations.cmo KB\kb.cmo KB\orderings.cmo KB\kbmain.cmo
CODE_KB=$(BYTE_KB:.cmo=.cmx)

kb.byt: $(BYTE_KB)
	$(CAMLC) $(COMPFLAGS) $(BYTE_KB) -o kb.byt
kb.exe: $(CODE_KB)
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) $(CODE_KB) -o kb.exe

clean::
	rm -f KB/*.cm* KB/*.obj KB/*.asm

# Genlex

BYTE_GENLEX=Lex\syntax.cmo Lex\scan_aux.cmo Lex\scanner.cmo Lex\gram_aux.cmo \
  Lex\grammar.cmo Lex\lexgen.cmo Lex\output.cmo Lex\main.cmo
CODE_GENLEX=$(BYTE_GENLEX:.cmo=.cmx)

genlex.byt: $(BYTE_GENLEX)
	$(CAMLC) $(COMPFLAGS) -I Lex $(BYTE_GENLEX) -o genlex.byt
genlex.exe: $(CODE_GENLEX)
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -I Lex $(CODE_GENLEX) -o genlex.exe

clean::
	rm -f Lex/*.cm* Lex/*.obj Lex/*.asm

Lex\grammar.ml Lex\grammar.mli: Lex\grammar.mly ..\yacc\ocamlyacc.exe
	$(CAMLYACC) $(YACCFLAGS) Lex\grammar.mly

clean::
	rm -f Lex\grammar.ml Lex\grammar.mli
beforedepend:: Lex\grammar.ml Lex\grammar.mli

Lex\scanner.ml: Lex\scanner.mll ..\lex\ocamllex
	$(CAMLLEX) Lex\scanner.mll

clean::
	rm -f Lex\scanner.ml
beforedepend:: Lex\scanner.ml

# "Fast" stuff

quicksort.fast.byt: quicksort.ml
	cp quicksort.ml quicksort.fast.ml
	$(CAMLC) $(COMPFLAGS) -unsafe -o quicksort.fast.byt quicksort.fast.ml
	rm -f quicksort.fast.ml

soli.fast.byt: soli.ml
	cp soli.ml soli.fast.ml
	$(CAMLC) $(COMPFLAGS) -unsafe -o soli.fast.byt soli.fast.ml
	rm -f soli.fast.ml

fft.fast.byt: fft.ml
	cp fft.ml fft.fast.ml
	$(CAMLC) $(COMPFLAGS) -unsafe -o fft.fast.byt fft.fast.ml
	rm -f fft.fast.ml

quicksort.fast.exe: quicksort.ml
	cp quicksort.ml quicksort.fast.ml
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -unsafe -o quicksort.fast.exe quicksort.fast.ml
	rm -f quicksort.fast.ml

soli.fast.exe: soli.ml
	cp soli.ml soli.fast.ml
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -unsafe -o soli.fast.exe soli.fast.ml
	rm -f soli.fast.ml

fft.fast.exe: fft.ml
	cp fft.ml fft.fast.ml
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -unsafe -o fft.fast.exe fft.fast.ml
	rm -f fft.fast.ml

# Common rules

.SUFFIXES:
.SUFFIXES: .mli .ml .cmi .cmo .cmx .byt .exe

.ml.byt:
	$(CAMLC) $(COMPFLAGS) -o $*.byt $<

.ml.exe:
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -o $*.exe $<

.mli.cmi:
	$(CAMLC) $(COMPFLAGS) -c $<

.ml.cmo:
	$(CAMLC) $(COMPFLAGS) -c $<

.ml.cmx:
	$(CAMLOPT) $(COMPFLAGS) $(OPTFLAGS) -c $<

$(BYTE_EXE) $(BYTE_KB) $(BYTE_GENLEX): ..\ocamlc
$(BYTE_EXE): ..\stdlib\stdlib.cma
$(CODE_EXE) $(CODE_KB) $(CODE_GENLEX): ..\ocamlopt
$(CODE_EXE): ..\stdlib\stdlib.cmxa ..\stdlib\libasmrun.lib

clean::
	rm -f *.byt *.exe
	rm -f *.cm* *.obj *.asm

# Regression test

.SUFFIXES: .btst .etst

.byt.btst:
	$(CAMLRUN) $*.byt > %temp%\test.out
	cmp %temp%\test.out Results\$*.out
.exe.etst:
	$*.exe > %temp%\test.out
	cmp %temp%\test.out Results\$*.out

clean::
	rm -f %temp%\test.out

genlex.btst:
	$(CAMLRUN) genlex.byt Lex/testscanner.mll
genlex.etst:
	genlex.exe Lex/testscanner.mll

FFT_TEST=gawk "$$2 >= 1e-9 { exit 2; }"
fft.btst:
	$(CAMLRUN) fft.byt | $(FFT_TEST)
fft.fast.btst:
	$(CAMLRUN) fft.fast.byt | $(FFT_TEST)
fft.etst:
	fft.exe | $(FFT_TEST)
fft.fast.etst:
	fft.fast.exe | $(FFT_TEST)

test: codetest
bytetest: $(BYTE_EXE:.byt=.btst)
codetest: $(CODE_EXE:.exe=.etst)

clean::
	rm -f Lex\testscanner.ml

# Dependencies

depend: beforedepend
	$(CAMLDEP) -I KB -I Lex *.mli *.ml KB/*.mli KB/*.ml Lex/*.mli Lex/*.ml > .depend

!include .depend