OCAMLC = ocamlc
OCAMLOPT = ocamlopt
OCAMLDEP = ocamldep
OCAMLLEX = ocamllex
OCAMLYACC = ocamlyacc

OCAMLFLAGS = -g
OCAMLOPTFLAGS = 

PROG = need
OBJS = ast.cmo pprint.cmo translate.cmo lexer.cmo need.cmo interpretation.cmo parser.cmo main.cmo
GEN = need.ml need.mli lexer.ml

$(PROG): $(OBJS)
	$(OCAMLC) -o $(PROG) $(OCAMLFLAGS) $(OBJS)

.SUFFIXES: .ml .mli .cmo .cmi .cmx

.ml.cmo:
	$(OCAMLC) $(OCAMLFLAGS) -c $<

.mli.cmi:
	$(OCAMLC) $(OCAMLFLAGS) -c $<

.ml.cmx:
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<

lexer.ml: lexer.mll
	$(OCAMLLEX) lexer.mll

need.mli: need.mly
	$(OCAMLYACC) need.mly

need.ml: need.mli

clean:
	-rm -f $(PROG) *.cm[iox] $(GEN)

ast.cmo: ast.cmi 
ast.cmx: ast.cmi 
interpretation.cmo: ast.cmi pprint.cmi translate.cmi interpretation.cmi 
interpretation.cmx: ast.cmx pprint.cmx translate.cmx interpretation.cmi 
lexer.cmo: need.cmi 
lexer.cmx: need.cmx 
main.cmo: ast.cmi interpretation.cmi parser.cmi pprint.cmi translate.cmi \
    main.cmi 
main.cmx: ast.cmx interpretation.cmx parser.cmx pprint.cmx translate.cmx \
    main.cmi 
need.cmo: ast.cmi translate.cmi need.cmi 
need.cmx: ast.cmx translate.cmx need.cmi 
parser.cmo: lexer.cmo need.cmi parser.cmi 
parser.cmx: lexer.cmx need.cmx parser.cmi 
pprint.cmo: ast.cmi pprint.cmi 
pprint.cmx: ast.cmx pprint.cmi 
translate.cmo: ast.cmi translate.cmi 
translate.cmx: ast.cmx translate.cmi 
interpretation.cmi: ast.cmi 
need.cmi: ast.cmi 
parser.cmi: ast.cmi 
pprint.cmi: ast.cmi 
translate.cmi: ast.cmi 
