OBJS = $(patsubst %,%.cmo,$(MODULES))
OBJSOPT = $(patsubst %,%.cmx,$(MODULES))
+DEPS = $(shell $(OCAMLFIND) query -recursive -predicates byte -format "%d/%a" $(REQUIRES))
+DEPSOPT = $(shell $(OCAMLFIND) query -recursive -predicates native -format "%d/%a" $(REQUIRES))
all: byte
byte: $(NAME)
%.cmx: %.ml %.cmi
$(OCAMLOPT) -c $<
include Makefile.overrides
+$(OBJS): $(DEPS)
+$(OBJSOPT): $(DEPSOPT)
$(NAME): $(OBJS) $(NAME).ml
$(OCAMLC) -linkpkg -thread -o $@ $^
$(NAME).opt: $(OBJSOPT) $(NAME).ml
COMMONOPTS = -package "$(REQUIRES)" -predicates "$(PREDICATES)"
OCAMLC = OCAMLPATH="$(METADIR)" ocamlfind ocamlc $(COMMONOPTS)
OCAMLOPT = OCAMLPATH="$(METADIR)" ocamlfind ocamlopt $(COMMONOPTS)
+OCAMLFIND = ocamlfind
+
+DEPS = $(shell $(OCAMLFIND) query -recursive -predicates byte -format "%d/%a" $(REQUIRES))
+DEPSOPT = $(shell $(OCAMLFIND) query -recursive -predicates native -format "%d/%a" $(REQUIRES))
all: byte
world: byte opt
$(OCAMLC) -c $<
hbugs_client.cmx: hbugs_client.ml hbugs_client.cmi
$(OCAMLOPT) -c $<
-$(NAME): hbugs_client_gui.cmo $(NAME).cmo main.ml
- $(OCAMLC) -thread -package threads -linkpkg -o $@ $^
-$(NAME).opt: hbugs_client_gui.cmx $(NAME).cmx main.ml
- $(OCAMLOPT) -thread -package threads -linkpkg -o $@ $^
+$(NAME): $(DEPS) hbugs_client_gui.cmo $(NAME).cmo main.ml
+ $(OCAMLC) -thread -package threads -linkpkg -o $@ hbugs_client_gui.cmo $(NAME).cmo main.ml
+$(NAME).opt: $(DEPSOPT) hbugs_client_gui.cmx $(NAME).cmx main.ml
+ $(OCAMLOPT) -thread -package threads -linkpkg -o $@ hbugs_client_gui.cmx $(NAME).cmx main.ml
clean:
rm -f *.cm[aixo] *.cmxa *.[oa] $(NAME){,.opt} hbugs_client_gui.ml
distclean: clean
OBJS = $(patsubst %,%.cmo,$(MODULES))
OBJSOPT = $(patsubst %,%.cmx,$(MODULES))
+DEPS = $(shell $(OCAMLFIND) query -recursive -predicates byte -format "%d/%a" $(REQUIRES))
+DEPSOPT = $(shell $(OCAMLFIND) query -recursive -predicates native -format "%d/%a" $(REQUIRES))
all: byte
byte: $(OBJS)
%.cmx: %.ml %.cmi
$(OCAMLOPT) -c $<
include Makefile.overrides
+$(OBJS): $(DEPS)
+$(OBJSOPT): $(DEPSOPT)
distclean: clean
clean:
COMMON = hbugs_deity.cmo hbugs_tutors_common.cmo
COMMON_OPT = $(patsubst %.cmo,%.cmx,$(COMMON))
+DEPS = $(shell $(OCAMLFIND) query -recursive -predicates byte -format "%d/%a" $(REQUIRES))
+DEPSOPT = $(shell $(OCAMLFIND) query -recursive -predicates native -format "%d/%a" $(REQUIRES))
+
all: byte
world: byte opt
byte: $(TUTORS)
$(GENERATED_TUTORS_SRC): $(TUTORS_TEMPLATE) $(TUTORS_INDEX)
$(BUILD_TUTORS)
-%_tutor: $(COMMON) %_tutor.ml
- $(OCAMLC) $(LINK_OPTIONS) -o $@ $^
-%_tutor.opt: $(COMMON_OPT) %_tutor.ml
- $(OCAMLOPT) $(LINK_OPTIONS) -o $@ $^
+%_tutor: $(DEPS) $(COMMON) %_tutor.ml
+ $(OCAMLC) $(LINK_OPTIONS) -o $@ $(COMMON) $*_tutor.ml
+%_tutor.opt: $(DEPSOPT) $(COMMON_OPT) %_tutor.ml
+ $(OCAMLOPT) $(LINK_OPTIONS) -o $@ $(COMMON_OPT) $*_tutor.ml
%.cmi: %.mli
$(OCAMLC) -c $<