summaryrefslogtreecommitdiff
path: root/gnu.ocaml.obj.mk
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2014-09-27 15:04:03 +0200
committerGrégoire Duchêne <gduchene@awhk.org>2014-09-27 15:16:25 +0200
commit9fcc625416f26b2ff0629684139c766639dddf39 (patch)
treece30550b6e708a6afb99f5449587647a8d7223d0 /gnu.ocaml.obj.mk
parent96479bad0b9a41d0f87a7d5a6392e237bcbfc211 (diff)
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.
Diffstat (limited to 'gnu.ocaml.obj.mk')
-rw-r--r--gnu.ocaml.obj.mk17
1 files 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: