aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2019-07-30 10:13:06 +0200
committerJean-Sébastien Pédron <[email protected]>2019-07-30 10:13:06 +0200
commita9a667e5bc3da3eb6fbb515ae55a2e9ae08b0148 (patch)
tree36d0836d85e89d78b26554e931215f981949f8ff
parent66ad59b16b9eaa0152e05e308111a79cfa286c83 (diff)
downloaderlang.mk-a9a667e5bc3da3eb6fbb515ae55a2e9ae08b0148.tar.gz
erlang.mk-a9a667e5bc3da3eb6fbb515ae55a2e9ae08b0148.tar.bz2
erlang.mk-a9a667e5bc3da3eb6fbb515ae55a2e9ae08b0148.zip
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.
-rw-r--r--core/deps-tools.mk8
1 files 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),)