From 9fcc625416f26b2ff0629684139c766639dddf39 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 27 Sep 2014 15:04:03 +0200 Subject: Split the dependency file Each .ml file will have a dependency file instead of having a giant one. Thus, we only generate dependencies for files that have changed. The current pattern is that for every .ml file, like foo.ml, its associated dependency file will be .foo.d. This may change or become configurable later. --- gnu.ocaml.obj.mk | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gnu.ocaml.obj.mk b/gnu.ocaml.obj.mk index 496b29c..0933c11 100644 --- a/gnu.ocaml.obj.mk +++ b/gnu.ocaml.obj.mk @@ -26,13 +26,13 @@ ifdef EXCL _EXL= $(foreach e, $(EXCL), -not -regex '.*$e.*') endif -DEPFILE?= .Makefile.dep MENHIR?= menhir OCAMLDEP?= ocamldep OCAMLLEX?= ocamllex .DEFAULT_GOAL:= obj +_DEP= $(foreach e,$(_SRC),$(dir $e)$(patsubst %.ml,.%.d,$(notdir $e))) _FND= find _PAT= '.*ml[ily]*.*' _SRC= $(shell $(_FND) $(_FNDFLAGS)) @@ -78,30 +78,27 @@ _INT= $(patsubst %.mly, %.ml, $(filter %.mly, $(_SRC))) _INT+= $(patsubst %.mll, %.ml, $(filter %.mll, $(_SRC))) _CLN+= $(patsubst %.ml, %.mli, $(_INT)) --include $(DEPFILE) +-include $(_DEP) -$(_OBJ): $(DEPFILE) - -$(DEPFILE): $(_SRC) $(_INT) - $(OCAMLDEP) $(_INC) $(_SRC) > $(DEPFILE) +.%.d: %.ml + $(OCAMLDEP) $(_INC) $< > $@ all: $(_OBJ) clean: $(RM) $(_CLN) $(_INT) $(_OBJ) $(PROG) -dep: - $(OCAMLDEP) $(_INC) $(_SRC) > $(DEPFILE) +dep: $(_DEP) dist-clean: clean - $(RM) $(DEPFILE) + $(RM) $(_DEP) obj: $(_OBJ) .PHONY: dep ifndef OSTUMAKE_DEBUG -.SILENT: $(DEPFILE) dep +.SILENT: $(_DEP) endif .SUFFIXES: -- cgit v1.2.3-70-g09d2