#Builder to use:
OCAMLC= C:\Program Files (x86)\Objective Caml\bin\ocamlc.exe
#Is it native?
OPT= no
#Generate type information?
ANNOT= yes
#Paths to include with each command: 
INCLUDEDPATHS= -I C:\Users\Veni\cs4115\ptp\. -I C:\Program Files (x86)\Objective Caml\lib 
#Flags for the project: 
PROJECTFLAGS= -g 

#Source files list: 
SRC= foo.mli ast.ml foo.ml bytecode.ml interpret.ml parser.mli compile.ml execute.ml scanner.ml parser.ml toplevel.ml 
#Find .ml files:
MLFILES= $(filter %.ml,$(SRC))
#Executables to produce:
EXEC=toplevel.exe 

#Find out which files to erase with clean: 
ITFOBJ=$(MLFILES:.ml=.cmi)
ifeq ($(OPT),yes)
	OBJ=$(MLFILES:.ml=.cmx)
else
	OBJ=$(MLFILES:.ml=.cmo)
endif

ifeq ($(ANNOT),yes)
	TYPE=$(MLFILES:.ml=.annot)
endif

#Some cleaning rules : 
clean:
	rm -rf $(OBJ) $(ITFOBJ) $(TYPE)

mrproper: clean
	rm -rf $(EXEC)

#Rules to build project : 
allExe: $(EXEC) 

allSrc: $(OBJ) 

all: allSrc allExe

: 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c scanner.mll

: 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c parser.mly

foo.cmi: 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c foo.mli

ast.cmo: 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c ast.ml

foo.cmo: foo.cmi 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c foo.ml

bytecode.cmo: ast.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c bytecode.ml

interpret.cmo: ast.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c interpret.ml

parser.cmi: ast.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c parser.mli

compile.cmo: ast.cmo bytecode.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c compile.ml

execute.cmo: ast.cmo bytecode.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c execute.ml

scanner.cmo: parser.cmi 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c scanner.ml

parser.cmo: parser.cmi ast.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c parser.ml

toplevel.cmo: ast.cmo bytecode.cmo compile.cmo execute.cmo interpret.cmo parser.cmi scanner.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) -c toplevel.ml

toplevel.exe: toplevel.cmo ast.cmo bytecode.cmo compile.cmo execute.cmo interpret.cmo parser.cmo scanner.cmo 
	$(OCAMLC) $(INCLUDEDPATHS) $(PROJECTFLAGS) ast.cmo bytecode.cmo compile.cmo execute.cmo interpret.cmo parser.cmo scanner.cmo -o toplevel.exe toplevel.cmo

