PP = $(PP_SYNTAX) pa_infix.cmo pa_ray.cmo
OCAMLDEPFLAGS = -pp "$(PP)"
OCAMLPPFLAGS = -pp "$(PP)"
OCAMLFLAGS = -rectypes
# Without inlining the gain is pretty clear.
OCAMLOPTFLAGS += -inline 1000

# Tell the dependency which cannot be inferred from the source file:
NeedCamlp4Extension(ray, pa_ray)
# It is necessary to build pa_ray before even though it is not needed
# because the pre-processing $(PP) needs it.
NeedCamlp4Extension(ray_orig, pa_ray)

PGM = ray ray_orig

COMPILED_PGM =
  foreach(p, $(PGM))
    value $(OCamlProgram $(p), $(p))

.DEFAULT: $(COMPILED_PGM)

# Show the result of the Camlp4 transformation
.PHONY: show
show: pa_ray.cmo
  $(PP) -printer o ray.ml


clean:
  rm -f $(glob *~ *.annot *.cmi *.cmo *.cmx *.cma *.o) $(COMPILED_PGM)
