OCAMLC=ocamlc
OCAMLOPT=ocamlopt
OCAMLDEP=ocamldep

.SUFFIXES: .ml .mli .cmo .cmi .cmx

LIB=myawk.cma
LIBOPT=myawk.cmxa

# Order matters!
INTF=
OBJS=strings.cmo myawk.cmo

.PHONY: all lib opt
all: lib

lib: $(LIB)

# .PHONY: intf			#Just the interfaces for testing examples
# intf: $(INTF)

$(LIB): $(INTF) $(OBJS)
	$(OCAMLC) -a  -o $@ $(filter-out %.cmi,$^)

opt: $(LIBOPT)
$(LIBOPT): $(INTF) $(OBJS:.cmo=.cmx)
	$(OCAMLOPT) -a  -o $@ $(filter-out %.cmi,$^)

.mli.cmi:
	$(OCAMLC) -c $<
.ml.cmo:
	$(OCAMLC) -c  $<
.ml.cmx:
	$(OCAMLOPT) -c $<

clean::
	rm -f *.cm[ixo] *.[oa] .depend

myawk.cmo: strings.cmo
