From 84ce2dfd5b63c9821b6da62daa16b944014a6021 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 16 Apr 2003 10:05:09 +0000 Subject: [PATCH] added ocamlfind trick to trigger rebuild when some library's .cma has been changed --- helm/hbugs/broker/Makefile | 4 ++++ helm/hbugs/client/Makefile | 12 ++++++++---- helm/hbugs/common/Makefile | 4 ++++ helm/hbugs/tutors/Makefile | 11 +++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/helm/hbugs/broker/Makefile b/helm/hbugs/broker/Makefile index a5b1e9af5..fe1bf71e9 100644 --- a/helm/hbugs/broker/Makefile +++ b/helm/hbugs/broker/Makefile @@ -20,6 +20,8 @@ CTL = ./hbugs_broker_ctl.sh 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) @@ -41,6 +43,8 @@ depend: %.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 diff --git a/helm/hbugs/client/Makefile b/helm/hbugs/client/Makefile index 4ac9af006..19491ded7 100644 --- a/helm/hbugs/client/Makefile +++ b/helm/hbugs/client/Makefile @@ -5,6 +5,10 @@ PREDICATES = glade init 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 @@ -23,10 +27,10 @@ hbugs_client.cmo: hbugs_client.ml hbugs_client.cmi $(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 diff --git a/helm/hbugs/common/Makefile b/helm/hbugs/common/Makefile index 3a3d96821..94c354f04 100644 --- a/helm/hbugs/common/Makefile +++ b/helm/hbugs/common/Makefile @@ -18,6 +18,8 @@ MODULES = \ 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) @@ -38,6 +40,8 @@ depend: %.cmx: %.ml %.cmi $(OCAMLOPT) -c $< include Makefile.overrides +$(OBJS): $(DEPS) +$(OBJSOPT): $(DEPSOPT) distclean: clean clean: diff --git a/helm/hbugs/tutors/Makefile b/helm/hbugs/tutors/Makefile index 65c559bd5..fe6331ee4 100644 --- a/helm/hbugs/tutors/Makefile +++ b/helm/hbugs/tutors/Makefile @@ -19,6 +19,9 @@ GENERATED_TUTORS_SRC = $(patsubst %,%.ml,$(GENERATED_TUTORS)) 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) @@ -30,10 +33,10 @@ stop: $(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 $< -- 2.39.2