PARSER_FILES = ast.ml parser.ml scanner.ml
PARSER_OBJS = ast.cmo parser.cmo scanner.cmo

COMPILE_FILES = ${PARSER_FILES} common.ml env.ml saster.ml codegenerator.ml compile.ml

COMMON_FILES = unix.cmxa str.cmxa


# NOTE - we need to rely on the OBJs as ocamlyacc and lex need the objects
# created to compile
# We then still need to compile from the native sources when compiling
# via ocamlopt

boredgame : $(PARSER_OBJS)
	ocamlopt -o boredgame.out ${COMMON_FILES} ${COMPILE_FILES} boredgame.ml

testcompile : $(PARSER_OBJS)
	ocamlopt -o testcompile.out ${COMMON_FILES} ${COMPILE_FILES} testcompile.ml

scanner.ml : scanner.mll
	ocamllex scanner.mll

parser.ml parser.mli : parser.mly
	ocamlyacc parser.mly

%.cmo : %.ml
	ocamlc -c $<

%.cmi : %.mli
	ocamlc -c $<

.PHONY : clean
clean :
	rm -f parser.ml parser.mli scanner.ml testall.log \
	*.cmo *.cmi *.out *.diff *.c *.o *.cmx

# Generated by ocamldep -native *.ml *.mli
ast.cmo:
ast.cmx:
boredgame.cmo: compile.cmx
boredgame.cmx: compile.cmx
codegenerator.cmo: env.cmx common.cmx ast.cmx
codegenerator.cmx: env.cmx common.cmx ast.cmx
common.cmo: ast.cmx
common.cmx: ast.cmx
compile.cmo: scanner.cmx parser.cmi env.cmx ast.cmx
compile.cmx: scanner.cmx parser.cmx env.cmx ast.cmx
env.cmo: common.cmx ast.cmx
env.cmx: common.cmx ast.cmx
parser.cmo: ast.cmx parser.cmi
parser.cmx: ast.cmx parser.cmi
saster.cmo: env.cmx common.cmx ast.cmx
saster.cmx: env.cmx common.cmx ast.cmx
scanner.cmo: parser.cmi
scanner.cmx: parser.cmx
testcompile.cmo: compile.cmx ast.cmx
testcompile.cmx: compile.cmx ast.cmx
parser.cmi: ast.cmx
