export OCAMLOPT=ocamlopt
LTOP=../../../bin/lurettetop
LIB=../../../lib
LURETTETOP=$(LTOP)   --precision 2  \
	  --test-length 500 --thick-draw 1 \
	  --draw-inside 0 --draw-edges 0 --draw-vertices 0 --draw-all-vertices  \
	  --step-mode Inside --local-var  --no-sim2chro  --seed 3 \
	  --do-not-show-step --old-mode


# old mode
test1:
	rm -f test1.rif0 .lurette_rc
	$(LURETTETOP) -go --output test1.rif0 \
	  --sut heat_ctrl.ml --sut-compiler ocaml \
	  --oracle-compiler ocaml --oracle not_a_sauna.ml sensors.luc && \
	grep -v "lurette chronogram" test1.rif0  | \
	grep -v "The execution lasted"| sed -e "s/^M//" > test1.rif  &&\
	rm -f test1.res && diff -u -i  test1.rif.exp test1.rif > test1.res
	[ ! -s test1.res ] && make clean 

#
NEW_LURETTETOP=$(LTOP)   --precision 2 \
	  --test-length 500 --thick-draw 1 \
	  --draw-inside 0 --draw-edges 0 --draw-vertices 0 --draw-all-vertices  \
	  --step-mode Inside --local-var  --no-sim2chro  --seed 3 \
	  --do-not-show-step 


%.cmxs: %.ml
	 ocamlopt -shared -o $*.cmxs  -I $(LIB) ocamlRM.cmx rif_base.cmx $*.ml 

# new mode
test2: heat_ctrl2.cmxs
	rm -f test2.rif0 .lurette_rc
	$(NEW_LURETTETOP) -go --output test2.rif0 \
	  -rp "sut:ocaml:heat_ctrl2.cmxs:" \
	  -rp "env:lutin:sensors.lut:main" && \
	grep -v "lurette chronogram" test2.rif0  | \
	grep -v "lurette Version"   | \
	grep -v "The execution lasted"| sed -e "s/^M//" > test2.rif  &&\
	rm -f test2.res && diff -u -i  test2.rif.exp test2.rif > test2.res
	[ ! -s test2.res ] && make clean 





test:  test2
utest: utest1 utest2

utest1:
	cp test1.rif test1.rif.exp
utest2:
	cp test2.rif test2.rif.exp





clean:
	rm -rf *.ec *.cm* *.log *~ .*~ *.o *rif0 *rif Data *.pp_luc *.plot *.gp



test_dontgo:
	rm -f test.rif0 .lurette_rc
	$(LURETTETOP)  --output test.rif0 sensors.luc && \
	grep -v "lurette chronogram" test.rif0  | \
	grep -v "The execution lasted"| sed -e "s/^M//" > test.rif  &&\
	rm -f test.res && diff -u -i  test.rif.exp test.rif > test.res
	[ ! -s test.res ] && make clean 


