
MAIN=draw-ex

LUCKYDRAW_INSTALL_DIR=../../../lib
CLIBS= -cclib -lgmp -cclib -lluckyDraw 
MLLIBS= str.cmxa unix.cmxa nums.cmxa bdd.cmxa polka.cmxa luckyDraw.cmxa 

WIN32_OCAMLOPT_FLAGS =
ifeq ($(HOSTTYPE),win32)
	WIN32_OCAMLOPT_FLAGS = -cclib -mno-cygwin -cclib -lole32
endif

$(MAIN): $(MAIN).ml 
	ocamlopt  $(WIN32_OCAMLOPT_FLAGS) -cc g++ -o  $(MAIN) -I $(LUCKYDRAW_INSTALL_DIR) $(CLIBS) $(MLLIBS) $(MAIN).ml 

make test: clean $(MAIN)
	./$(MAIN) | grep -v "The random engine is initialized with the seed" > $(MAIN).out &&  \
	rm -f test.res && diff --strip-trailing-cr -u -i $(MAIN).out.exp $(MAIN).out \
	    > test.res
	[ ! -s test.res ] && make clean 

make utest:
	cp $(MAIN).out $(MAIN).out.exp


clean:
	- rm -f $(MAIN) *.cmx *.cmi *.cmo *.o *.plot *.gp *.data
