Skip to content
Snippets Groups Projects
Makefile.inc 2.04 KiB
# Time-stamp: <modified the 01/09/2021 (at 10:26) by Erwan Jahier>
#
# Define some default rules that ought to work most of the time
#

sasa=sasa

LIB=-package algo
ifndef DAEMON
	DAEMON=-dd
endif

OCAMLOPT=ocamlfind ocamlopt -bin-annot

%.ml: %.dot 
	sasa -reg $<

%.cmxs: %.ml
	$(OCAMLOPT) $(LIB) -shared state.ml $(shell sasa -algo $*.dot) config.ml $< -o $@

genclean:
	rm -f *.cmxs sasa *.cm* *.o *.pdf *.rif *.gp *.log *.dro *.seed *.c *.h sasa-*.dot *.cmt *.annot
	rm -f rdbg-session*.ml luretteSession* a.out *.cov read_dot.ml
	rm -f *.exec  grid*.ml read_dot.ml rdbg-history rdbg-cmds.ml

clean: genclean
.PRECIOUS: %.ml



##################################################################################
# 
-include Makefile.untracked

g:gnuplot
s:sim2chrogtk

OCAMLC=ocamlfind ocamlc -bin-annot
%.cma: %.ml
	$(OCAMLC) $(LIB) -a state.ml $(shell sasa -algo $*.dot) $< -o $@

%.lut: %.dot %.cmxs
	sasa -gld $< || echo "==> ok, I'll use the existing $@ file"

%_oracle.lus: %.dot %.cmxs
	sasa -glos $< || echo "==> ok, I'll use the existing $@ file"

%.rif: %.cmxs %.dot
	$(sasa) $(sasaopt) $*.dot > $*.rif

%.pdf:
	osage -Tpdf $*.dot -o $*.pdf
	xpdf $*.pdf

%.ocd: %.ml
	rdbg -camldebug -sut "sasa $.dot" -l 1000

%.test: %.dot %.cmxs
	sasa  $<

############################################################################################
# Golden master tests
# compare the generated rif file with a previously generated reference
EXPDIR=`rdbg --ocaml-version`
$(EXPDIR):
	[ -d $(EXPDIR) ] || (mkdir -p $(EXPDIR) ; make utest)

%.gm_test: %.dot %.cmxs $(EXPDIR)
	sasa  $< -seed 42 > $*.rif && \
	diff -I "# on" -I " version " -B -u -i -w $(EXPDIR)/$*.rif.exp $*.rif > $*.res
	[ ! -s $*.res ]  && echo "\n\n==> $*.gm_test went fine"

# update the reference
%.ugm_test: %.rif $(EXPDIR)
	cp $*.rif $(EXPDIR)/$*.rif.exp 
############################################################################################


%.rdbg: %.dot %.ml
	ledit -h rdbg-history -x rdbg -sut "sasa $< $(DAEMON)" 

%.rdbgui: %.dot %.ml
	ledit -h rdbg-history -x rdbgui4sasa -sut "sasa $< $(DAEMON)"