From a9a667e5bc3da3eb6fbb515ae55a2e9ae08b0148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Tue, 30 Jul 2019 10:13:06 +0200 Subject: Fix concurrent creation of `recursive-*deps-list.log` files To do that, we simply include the PID of the Make process in temporary file. We also compare the finished temporary file with the actual target file. If they are different, the temporary file is moved to the final target, otherwise, we just get rid of the temporary file. This way, the target timestamp stays the same if the content does not change. --- core/deps-tools.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/deps-tools.mk b/core/deps-tools.mk index 2b6877a..c7203fa 100644 --- a/core/deps-tools.mk +++ b/core/deps-tools.mk @@ -53,7 +53,7 @@ ifneq ($(filter shell,$(DEP_TYPES)),) $(ERLANG_MK_RECURSIVE_DEPS_LIST): $(ALL_SHELL_DEPS_DIRS) endif -ERLANG_MK_RECURSIVE_TMP_LIST := $(abspath $(ERLANG_MK_TMP)/recursive-tmp-deps.log) +ERLANG_MK_RECURSIVE_TMP_LIST := $(abspath $(ERLANG_MK_TMP)/recursive-tmp-deps-$(shell echo $$PPID).log) $(ERLANG_MK_RECURSIVE_DEPS_LIST) \ $(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST) \ @@ -82,7 +82,11 @@ endif fi \ done ifeq ($(IS_APP)$(IS_DEP),) - $(verbose) sort < $(ERLANG_MK_RECURSIVE_TMP_LIST) | uniq > $@ + $(verbose) sort < $(ERLANG_MK_RECURSIVE_TMP_LIST) | \ + uniq > $(ERLANG_MK_RECURSIVE_TMP_LIST).sorted + $(verbose) cmp -s $(ERLANG_MK_RECURSIVE_TMP_LIST).sorted $@ \ + || mv $(ERLANG_MK_RECURSIVE_TMP_LIST).sorted $@ + $(verbose) rm -f $(ERLANG_MK_RECURSIVE_TMP_LIST).sorted $(verbose) rm $(ERLANG_MK_RECURSIVE_TMP_LIST) endif endif # ifneq ($(SKIP_DEPS),) -- cgit v1.2.3