#EIGEN_PATH = E:\\Dropbox\\Programming\\C\\Eigen-3.2.1
#QUARK_PATH = E:\\Dropbox\\Programming\\Compiler\\Quark\\Quark++
QUARK_LIB_PATH = ../lib

OBJS = type.cmo ast.cmo sast.cmo parser.cmo scanner.cmo preprocessor.cmo \
	   builtin.cmo semantic.cmo generator.cmo compile.cmo

TESTS = arith1 arith2 arith3 arith4 \
	fib \
	for1 for2 \
	func1 func2 func3 func4 func5 \
	gcd \
	global1 \
	hello \
	if1 if2	if3 if4 if5 \
	ops1 \
	var1 var2 var3 var4 \
	stmts1 \
	while1

TARFILES = Makefile testall.sh scanner.mll preprocessor.mll parser.mly \
	type.ml ast.ml sast.ml builtin.ml semantic.ml generator.ml compile.ml \
	$(TESTS:%=tests/test-%.mc) \
	$(TESTS:%=tests/test-%.out)

quarkc : $(OBJS)
	ocamlc -o quarkc $(OBJS)

.PHONY : test
test : quarkc testall.sh
	./testall.sh

scanner.ml : scanner.mll
	ocamllex scanner.mll

preprocessor.ml : preprocessor.mll
	ocamllex preprocessor.mll

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

DISABLE_WARN = -4-39-11-27

%.cmo : %.ml
	ocamlc -w +a$(DISABLE_WARN) -c $<

%.cmi : %.mli
	ocamlc -w +a$(DISABLE_WARN) -c $<

#g++ -std=c++11 -I $(EIGEN_PATH) -I $(QUARK_PATH) -static output.cpp -L./ -lquark -o output
.PHONY : cpp
cpp: output.cpp
	g++ -std=c++11 -I $(QUARK_LIB_PATH) -static output.cpp -L../lib -lquark -o output

.PHONY : clean
clean :
	rm -f quarkc parser.ml parser.mli scanner.ml testall.log \
	*.cmo *.cmi *.out *.diff *.exe shor grover

# Generated by ocamldep *.ml *.mli
ast.cmo : type.cmo
ast.cmx : type.cmx
builtin.cmo : type.cmo ast.cmo
builtin.cmx : type.cmx ast.cmx
compile.cmo : semantic.cmo scanner.cmo parser.cmi preprocessor.cmi
compile.cmx : semantic.cmx scanner.cmx parser.cmx preprocessor.cmx
generator.cmo : type.cmo sast.cmo ast.cmo
generator.cmx : type.cmx sast.cmx ast.cmx
old_gen.cmo : type.cmo ast.cmo
old_gen.cmx : type.cmx ast.cmx
parser.cmo : type.cmo ast.cmo parser.cmi
parser.cmx : type.cmx ast.cmx parser.cmi
sast.cmo : type.cmo ast.cmo
sast.cmx : type.cmx ast.cmx
scanner.cmo : parser.cmi
scanner.cmx : parser.cmx
preprocessor.cmo : 
preprocessor.cmx : 
semantic.cmo : type.cmo sast.cmo builtin.cmo ast.cmo
semantic.cmx : type.cmx sast.cmx builtin.cmx ast.cmx
type.cmo :
type.cmx :
parser.cmi : ast.cmo
