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

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


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

commit 6707bfae86aff8a3bae74f6bbafaca54d1315480
Author: Xiang Xiao <[email protected]>
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.
---
 .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))

Reply via email to