# Natded makefile
#
# targets are:
#
# all -- rebuild the project (default)
# clean -- remove all objects and executables

# export SHELL = /bin/bash
# export PATH = /usr/bin:/bin:/usr/local/bin

SOURCES = util.ml ast.ml Parser/parser.mli Parser/lexer.ml Parser/parser.ml \
    match.ml proof.ml extract.ml state.ml command.ml repl.ml

.PHONY: all
all: natded.exe

.PHONY: clean
clean:
	rm -f natded.exe
	rm -f Parser/parser.mli Parser/parser.ml Parser/lexer.ml 
	for X in . Parser; do \
      for Y in cmo cmi output log aux; do \
        rm -f $$X/*.$$Y; \
      done; \
    done

natded.exe: $(SOURCES)
	ocamlc -o natded.exe -g -I Parser str.cma $(SOURCES)

Parser/parser.mli Parser/parser.ml: Parser/parser.mly
	ocamlyacc -v Parser/parser.mly

Parser/lexer.ml: Parser/lexer.mll Parser/parser.ml
	ocamllex Parser/lexer.mll
