
LTOP=../../../bin/lurettetop

RDBG=rdbg  -I +rdbg-plugin

EXPDIR=`$(LTOP) --ocaml-version`
$(EXPDIR):
	[ -d $(EXPDIR) ] || (mkdir -p $(EXPDIR) ; make utest)


# step forward
test1.rif:  $(EXPDIR)
	rm -f test1.rif0
	$(RDBG) -init test.ml >  test1.rif0  
	grep -v "lurette chronogram" test1.rif0  | \
	grep -v "This is rdbg Version" test1.rif0  | \
	sed -e "s/^M//" > test1.rif 

test1: test1.rif $(EXPDIR)
	rm -f test1.res
	diff -B -u -i  $(EXPDIR)/test1.rif.exp test1.rif > test1.res || true
	cat test1.res
	[ ! -s test1.res ]  && make clean

utest1:test1.rif
	cp test1.rif $(EXPDIR)/test1.rif.exp

# use profiler
test2.rif:  $(EXPDIR)
	rm -f test2.rif0
	$(RDBG) -init test2.ml >  test2.rif0  
	grep -v "lurette chronogram" test2.rif0  | \
	grep -v "This is rdbg Version" test2.rif0  | \
	sed -e "s/^M//" > test2.rif 

test2: test2.rif $(EXPDIR)
	rm -f test2.res
	diff -B -u -i  $(EXPDIR)/test2.rif.exp test2.rif > test2.res || true
	cat test2.res
	[ ! -s test2.res ]  && make clean

utest2:test2.rif
	cp test2.rif $(EXPDIR)/test2.rif.exp


# check the slides demo
test3.rif:  $(EXPDIR)
	rm -f test3.rif0
	$(RDBG) -init test3.ml >  test3.rif0  
	grep -v "lurette chronogram" test3.rif0  | \
	grep -v "This is rdbg Version" test3.rif0  | \
	sed -e "s/^M//"  > test3.rif 

test3: test3.rif $(EXPDIR)
	rm -f test3.res
	diff -B -u -i  $(EXPDIR)/test3.rif.exp test3.rif > test3.res || true
	cat test3.res
	[ ! -s test3.res ] && make clean

utest3:test3.rif
	cp test3.rif $(EXPDIR)/test3.rif.exp

# check the slides demo
test5.rif:  $(EXPDIR)
	rm -f test5.rif0
	$(RDBG) -init test5.ml >  test5.rif0  
	grep -v "lurette chronogram" test5.rif0  | \
	grep -v "This is rdbg Version" test5.rif0  | \
	sed -e "s/^M//"  > test5.rif 

test5: test5.rif $(EXPDIR)
	rm -f test5.res
	diff -B -u -i  $(EXPDIR)/test5.rif.exp test5.rif > test5.res || true
	cat test5.res
	[ ! -s test5.res ] && make clean

utest5:test5.rif
	cp test5.rif $(EXPDIR)/test5.rif.exp


utest: utest1 utest2 utest3 utest5

test: test1 test2 test3 test5 clean

%.ec: %.lus

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






