OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLOPTIONS)
OCAMLOPT = $(OCAMLFIND) ocamlopt $(OCAMLOPTIONS)
+LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES))
+LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES))
+
all: touch
opt: touch.opt
depend:
$(OCAMLDEP) $(DEPOBJS) > .depend
-touch: $(TOUCHOBJS)
+touch: $(TOUCHOBJS) $(LIBRARIES)
$(OCAMLC) -linkpkg -o touch $(TOUCHOBJS)
-touch.opt: $(TOUCHOBJS:.cmo=.cmx)
+touch.opt: $(TOUCHOBJS:.cmo=.cmx) $(LIBRARIES_OPT)
$(OCAMLOPT) -linkpkg -o touch.opt $(TOUCHOBJS:.cmo=.cmx)
.SUFFIXES: .ml .mli .cmo .cmi .cmx
-.ml.cmo:
+.ml.cmo: $(LIBRARIES)
$(OCAMLC) -c $<
-.mli.cmi:
+.mli.cmi: $(LIBRARIES)
$(OCAMLC) -c $<
-.ml.cmx:
+.ml.cmx: $(LIBRARIES_OPT)
$(OCAMLOPT) -c $<
clean: