From 4717afcc480ae1ed1141d409af82417984a22aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Tue, 27 Oct 2015 16:59:43 +0100 Subject: Use an intermediate timestamp file to know when to touch source files The previous approach spawned a shell for every single source files. As we disable parallel make jobs, this is very time consuming. The new approach uses an intermediate timestamp file in $(ERLANG_MK_TMP) to record the last modification of any of $(MAKEFILE_LIST) and touch all source files in one command. Then, the .app file depends on this timestamp file. We test the existence of this timestamp file: if if doesn't exist, don't touch source files, they will be built anyway. $(PROJECT).d now depends directly on $(MAKEFILE_LIST); before, this dependency was indirect through $(ERL_FILES). Also, once $(ERL_FILES) were touched, we do the same with $(PROJECT).d because there is no need to regen it because of this. --- plugins/erlydtl.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/erlydtl.mk b/plugins/erlydtl.mk index a8d4cea..4f04e14 100644 --- a/plugins/erlydtl.mk +++ b/plugins/erlydtl.mk @@ -24,10 +24,18 @@ DTL_NAMES = $(addsuffix $(DTL_SUFFIX),$(DTL_FILES:$(DTL_PATH)/%.dtl=%)) DTL_MODULES = $(if $(DTL_FULL_PATH),$(subst /,_,$(DTL_NAMES)),$(notdir $(DTL_NAMES))) BEAM_FILES += $(addsuffix .beam,$(addprefix ebin/,$(DTL_MODULES))) +ifneq ($(words $(DTL_FILES)),0) # Rebuild templates when the Makefile changes. -$(DTL_FILES): $(MAKEFILE_LIST) +$(ERLANG_MK_TMP)/last-makefile-change-erlydtl: $(MAKEFILE_LIST) + @mkdir -p $(ERLANG_MK_TMP) + @if test -f $@; then \ + touch $(DTL_FILES); \ + fi @touch $@ +ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change-erlydtl +endif + define erlydtl_compile.erl [begin Module0 = case "$(strip $(DTL_FULL_PATH))" of -- cgit v1.2.3