You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/09/14 07:55:50 UTC
[incubator-nuttx-apps] branch master updated: Fix: ensure archive
files do not carry object files from prior builds
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang 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 18137c0 Fix: ensure archive files do not carry object files from prior builds
18137c0 is described below
commit 18137c0fec3cea30871f29238e11ea0f4e8523da
Author: Matias N <ma...@protobits.dev>
AuthorDate: Sat Sep 12 00:36:23 2020 -0300
Fix: ensure archive files do not carry object files from prior builds
This is the corresponding change to the one on main NuttX repo. In this
case this involves splitting the build of libapps.a into: a) building
all applications (which is safely parallelizable), b) adding each
application's object files to the archive in turns (serial by nature).
This removes the need for the flock used to protect the parallel build.
---
.gitignore | 2 --
Application.mk | 10 ++++------
Directory.mk | 1 -
Make.defs | 4 ----
Makefile | 19 +++++++++++++++----
5 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
index 910e059..acf570e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,10 +15,8 @@
*.swp
*.sym
*~
-.built
.depend
.kconfig
-/*.lock
/bin
/boot_romfsimg.h
/external
diff --git a/Application.mk b/Application.mk
index 153628a..fd9a02c 100644
--- a/Application.mk
+++ b/Application.mk
@@ -95,7 +95,7 @@ VPATH += :.
# Targets follow
-all:: .built
+all:: $(OBJS)
.PHONY: clean depend distclean
.PRECIOUS: $(BIN)
@@ -131,13 +131,12 @@ $(CXXOBJS): %$(SUFFIX)$(OBJEXT): %$(CXXEXT)
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
-.built: $(OBJS)
+archive:
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
- $(call ARLOCK, "${shell cygpath -w $(BIN)}", $^)
+ $(call ARCHIVE_ADD, "${shell cygpath -w $(BIN)}", $(OBJS))
else
- $(call ARLOCK, $(BIN), $^)
+ $(call ARCHIVE_ADD, $(BIN), $(OBJS))
endif
- $(Q) touch $@
ifeq ($(BUILD_MODULE),y)
@@ -234,7 +233,6 @@ endif
depend:: .depend
clean::
- $(call DELFILE, .built)
$(call CLEAN)
distclean:: clean
diff --git a/Directory.mk b/Directory.mk
index 6ce0149..c70a428 100644
--- a/Directory.mk
+++ b/Directory.mk
@@ -39,7 +39,6 @@ include $(APPDIR)/Make.defs
SUBDIRS := $(dir $(wildcard *$(DELIM)Makefile))
CONFIGSUBDIRS := $(filter-out $(dir $(wildcard *$(DELIM)Kconfig)),$(SUBDIRS))
-CLEANSUBDIRS := $(dir $(wildcard *$(DELIM).built))
CLEANSUBDIRS += $(dir $(wildcard *$(DELIM).depend))
CLEANSUBDIRS += $(dir $(wildcard *$(DELIM).kconfig))
CLEANSUBDIRS := $(sort $(CLEANSUBDIRS))
diff --git a/Make.defs b/Make.defs
index f3f99ed..fd4662c 100644
--- a/Make.defs
+++ b/Make.defs
@@ -108,10 +108,6 @@ define REGISTER
$(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
endef
-define ARLOCK
- $(Q) flock $1.lock $(call ARCHIVE, $1, $(2))
-endef
-
# Standard include path
CFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
diff --git a/Makefile b/Makefile
index 394c9a8..acc4afb 100644
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,13 @@ SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
# Build targets
-all: $(BIN)
+# We first remove libapps.a before letting the other rules add objects to it
+# so that we ensure libapps.a does not contain objects from prior build
+
+all:
+ $(RM) $(BIN)
+ $(MAKE) $(BIN)
+
.PHONY: import install dirlinks context context_serialize clean_context context_rest export .depdirs preconfig depend clean distclean
.PRECIOUS: $(BIN)
@@ -87,10 +93,16 @@ else
ifeq ($(CONFIG_BUILD_LOADABLE),)
$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
+ $(Q) for app in ${CONFIGURED_APPS}; do \
+ $(MAKE) -C "$${app}" archive TOPDIR="${TOPDIR}" APPDIR="${APPDIR}" ; \
+ done
else
$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
+ $(Q) for app in ${CONFIGURED_APPS}; do \
+ $(MAKE) -C "$${app}" archive TOPDIR="${TOPDIR}" APPDIR="${APPDIR}" ; \
+ done
$(Q) $(MAKE) install TOPDIR="$(TOPDIR)"
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) >$@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
@@ -100,9 +112,9 @@ $(SYMTABOBJ): %$(OBJEXT): %.c
$(BIN): $(SYMTABOBJ)
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
- $(call ARLOCK, "${shell cygpath -w $(BIN)}", $^)
+ $(call ARCHIVE_ADD, "${shell cygpath -w $(BIN)}", $^)
else
- $(call ARLOCK, $(BIN), $^)
+ $(call ARCHIVE_ADD, $(BIN), $^)
endif
endif # !CONFIG_BUILD_LOADABLE
@@ -198,7 +210,6 @@ else
fi; \
)
endif
- $(call DELFILE, *.lock)
$(call DELFILE, .depend)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))