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. --- core/erlc.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'core/erlc.mk') diff --git a/core/erlc.mk b/core/erlc.mk index d2fd88b..5bb4078 100644 --- a/core/erlc.mk +++ b/core/erlc.mk @@ -216,13 +216,23 @@ define makedep.erl endef ifeq ($(if $(NO_MAKEDEP),$(wildcard $(PROJECT).d),),) -$(PROJECT).d:: $(ERL_FILES) $(call core_find,include/,*.hrl) +$(PROJECT).d:: $(ERL_FILES) $(call core_find,include/,*.hrl) $(MAKEFILE_LIST) $(makedep_verbose) $(call erlang,$(call makedep.erl,$@)) endif +ifneq ($(words $(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES)),0) # Rebuild everything when the Makefile changes. -$(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES):: $(MAKEFILE_LIST) - @touch $@ +$(ERLANG_MK_TMP)/last-makefile-change: $(MAKEFILE_LIST) + $(verbose) mkdir -p $(ERLANG_MK_TMP) + $(verbose) if test -f $@; then \ + touch $(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES); \ + touch -c $(PROJECT).d; \ + fi + $(verbose) touch $@ + +$(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES):: $(ERLANG_MK_TMP)/last-makefile-change +ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change +endif -include $(PROJECT).d -- cgit v1.2.3