# ------------------------------
# build
# ------------------------------
OCAMLPACKS[] =
     extlib
     str
     oUnit
UseCamlp4(pa_oo pa_openin)

OCAMLINCLUDES += $(ROOT)/base
OCAML_LIBS    += $(ROOT)/base/base
.SUBDIRS: type

OCAMLINCLUDES += $(absname type/)
OCAML_LIBS    += $(absname type/type)
.SUBDIRS: parser filter codegen

FILES[] =
	interCode
	parser
	codegen
	filter
	$(ROOT)/config

PROGRAM = habc-scm

OCamlProgram($(PROGRAM), main $(FILES))

# ------------------------------
# phony
# ------------------------------
.DEFAULT: habc-scm$(EXE)
.PHONY: clean integrate integrate-detail
clean:
	ocaml-clean *.abc habc-scm$(EXE)

integrate: habc-scm$(EXE)
	sh example/test.sh $(absname $(ROOT)) example/*.scm
	sh example/module/run.sh $(absname $(ROOT))

integrate-detail: habc-scm$(EXE)
	foreach(x, $(ls example/*.scm))
	  (sh example/test.sh $(absname $(ROOT)) $(x); true) | tee -a $(ROOT)/integrate.log
	sh example/module/run.sh $(absname $(ROOT)) | tee -a $(ROOT)/integrate.log


