You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/20 19:14:05 UTC

[incubator-nuttx-apps] branch pr79 updated: build: Use flock to serialize ar steps as workaround

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch pr79
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/pr79 by this push:
     new 6b26e8f  build: Use flock to serialize ar steps as workaround
6b26e8f is described below

commit 6b26e8f570d370b3d99f24cfe91411e320c84865
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Feb 19 17:08:28 2020 +0800

    build: Use flock to serialize ar steps as workaround
    
    Use flock to serialize ar steps to avoid parallel build break
    sometimes.
    
    Change-Id: I3a916b3b27422cdb6d718f7d554361565457fa08
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 .gitignore     | 1 +
 Application.mk | 4 ++--
 Make.defs      | 6 +++++-
 Makefile       | 5 +++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 722303b..6686305 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.arlock
 .depend
 Make.dep
 *.o
diff --git a/Application.mk b/Application.mk
index 25af192..641e89b 100644
--- a/Application.mk
+++ b/Application.mk
@@ -130,9 +130,9 @@ $(CXXOBJS): %$(SUFFIX)$(OBJEXT): %$(CXXEXT)
 
 .built: $(OBJS)
 ifeq ($(WINTOOL),y)
-	$(call ARCHIVE, "${shell cygpath -w $(BIN)}", $(OBJS))
+	$(call ARLOCK, "${shell cygpath -w $(BIN)}", $(OBJS))
 else
-	$(call ARCHIVE, $(BIN), $(OBJS))
+	$(call ARLOCK, $(BIN), $(OBJS))
 endif
 	$(Q) touch $@
 
diff --git a/Make.defs b/Make.defs
index 77b0c82..89a649b 100644
--- a/Make.defs
+++ b/Make.defs
@@ -52,7 +52,7 @@ CLEANDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Makefile))
 CONFIGURED_APPS :=
 
 define Add_Application
-  include $(1)Make.defs
+	include $(1)Make.defs
 endef
 
 $(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
@@ -99,6 +99,10 @@ define REGISTER
 endef
 endif
 
+define ARLOCK
+	$(Q) flock .arlock $(call ARCHIVE, $1, $(2))
+endef
+
 # Tools
 
 ifeq ($(DIRLINK),)
diff --git a/Makefile b/Makefile
index e0ad31f..dfb9da8 100644
--- a/Makefile
+++ b/Makefile
@@ -117,9 +117,9 @@ $(SYMTABOBJ): %$(OBJEXT): %.c
 
 $(BIN): $(SYMTABOBJ)
 ifeq ($(WINTOOL),y)
-	$(call ARCHIVE, "${shell cygpath -w $(BIN)}", $^)
+	$(call ARLOCK, "${shell cygpath -w $(BIN)}", $^)
 else
-	$(call ARCHIVE, $(BIN), $^)
+	$(call ARLOCK, $(BIN), $^)
 endif
 
 endif # !CONFIG_BUILD_LOADABLE
@@ -198,6 +198,7 @@ else
 		fi; \
 	)
 endif
+	$(call DELFILE, .arlock)
 	$(call DELFILE, .depend)
 	$(call DELFILE, $(SYMTABSRC))
 	$(call DELFILE, $(SYMTABOBJ))