########################################################################
# Phony targets are scoped, so you probably want to declare them first.
#

.PHONY: all install clean

########################################################################
# Subdirectories.
# You may want to include some subdirectories in this project.
# If so, define the subdirectory targets and uncomment this section.
#

# .SUBDIRS:

########################################################################
# OCaml configuration.
# Delete this section if you are not building OCaml files.
#

################################################
# Configuration.  You may want to modify any of these configuration
# variables.
#

#
# This project requires ocamlfind (default - false).

USE_OCAMLFIND = true

OCAMLPACKS[] =
    unix
#    pack2
#
if $(not $(OCAMLFIND_EXISTS))
   eprintln(This project requires ocamlfind, but is was not found.)
   eprintln(You need to install ocamlfind and run "omake --configure".)
   exit 1


# Include path
#
# OCAMLINCLUDES +=

#
# Compile native or byte code? 
#
# The default values are defined as follows:

NATIVE_ENABLED = $(OCAMLOPT_EXISTS)
BYTE_ENABLED = $(not $(OCAMLOPT_EXISTS))

#
# Various options
#
# OCAMLFLAGS    +=
# OCAMLCFLAGS   +=
# OCAMLOPTFLAGS +=
# OCAML_LINK_FLAGS +=
# OCAML_BYTE_LINK_FLAGS +=
# OCAML_NATIVE_LINK_FLAGS +=
MENHIR_ENABLED = true
MENHIR_FLAGS += --infer
MENHIR_FLAGS += --explain

################################################
# Generated files
#
# Workaround for the fact that ocamldep does not pay attention to .mll
# and .mly files.
#
# OCamlGeneratedFiles(parser.ml lexer.ml)

################################################
# Build an OCaml library
#

# FILES[] =
#    file1
#    file2
#
# LIB = main
#
# .DEFAULT: $(OCamlLibrary $(LIB), $(FILES))

################################################
# Build an OCaml program
#

FILES[] =
	nol
	echo
	c
	modules
	ast
	parser
	lexer
	common

PROGRAM = nol
# OCAML_LIBS +=
# OCAML_CLIBS +=
# OCAML_OTHER_LIBS +=
# OCAML_LIB_FLAGS +=

MenhirMulti(parser, parser tokens)
OCamlProgram($(PROGRAM), $(FILES))

.DEFAULT: $(PROGRAM)

clean:
	rm -f \
     $(filter-proper-targets $(glob $(addsuffix .*, $(FILES)))) \
     $(PROGRAM) *.conflicts
