LIBS := -libs str,unix
PKGS := -package batteries
OCAMLOPT := -ocamlopt "ocamlopt -unsafe -inline 100"
#LFLAGS := -lflags -ccopt,-static
#TAGS := -tag debug

SOURCES = *.ml *.mll *.mly

all: nanocop.native montecop.native montecop.top lazycop.native conticop.native femalecop.native femalecop.top hasher.native accumstats.native

%.native: $(SOURCES)
	ocamlbuild $(OCAMLOPT) $(LFLAGS) $(TAGS) $(PKGS) $@

%.p.native: $(SOURCES)
	ocamlbuild $(OCAMLOPT) $(LFLAGS) $(TAGS) $(PKGS) $@

%.top: %.mltop $(SOURCES)
	ocamlbuild $(OCAMLOPT) $(PKGS) $@

clean:
	ocamlbuild -clean
	rm -f *~

%.bundle:
	git bundle create $@ $* --branches --tags

%.tar.bz2: %.bundle
	git clone -b $* $< $*
	tar cjf $@ $*
	rm -rf $*

# same as above, but does not save Git history
#%.tar.bz2:
#	git archive $* | bzip2 > $@
