From 890e32b7dcf9deebabdf8abde9ff17107f432657 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 21 Feb 2020 14:08:40 +0900 Subject: [PATCH 1/3] Revert "build: Use flock to serialize ar steps as workaround" This reverts commit 6707bfae86aff8a3bae74f6bbafaca54d1315480. --- .gitignore | 1 - Application.mk | 4 ++-- Make.defs | 6 +----- Makefile | 5 ++--- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 668630512c9..722303bd5ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.arlock .depend Make.dep *.o diff --git a/Application.mk b/Application.mk index 641e89b85e2..25af1926e42 100644 --- a/Application.mk +++ b/Application.mk @@ -130,9 +130,9 @@ $(CXXOBJS): %$(SUFFIX)$(OBJEXT): %$(CXXEXT) .built: $(OBJS) ifeq ($(WINTOOL),y) - $(call ARLOCK, "${shell cygpath -w $(BIN)}", $(OBJS)) + $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $(OBJS)) else - $(call ARLOCK, $(BIN), $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) endif $(Q) touch $@ diff --git a/Make.defs b/Make.defs index 89a649b39c0..77b0c82751b 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,10 +99,6 @@ define REGISTER endef endif -define ARLOCK - $(Q) flock .arlock $(call ARCHIVE, $1, $(2)) -endef - # Tools ifeq ($(DIRLINK),) diff --git a/Makefile b/Makefile index dfb9da882df..e0ad31f1cfb 100644 --- a/Makefile +++ b/Makefile @@ -117,9 +117,9 @@ $(SYMTABOBJ): %$(OBJEXT): %.c $(BIN): $(SYMTABOBJ) ifeq ($(WINTOOL),y) - $(call ARLOCK, "${shell cygpath -w $(BIN)}", $^) + $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $^) else - $(call ARLOCK, $(BIN), $^) + $(call ARCHIVE, $(BIN), $^) endif endif # !CONFIG_BUILD_LOADABLE @@ -198,7 +198,6 @@ else fi; \ ) endif - $(call DELFILE, .arlock) $(call DELFILE, .depend) $(call DELFILE, $(SYMTABSRC)) $(call DELFILE, $(SYMTABOBJ)) From bbc526ecc24c96361b8a4334f5b17bd33ffeaa5e Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 21 Feb 2020 14:08:51 +0900 Subject: [PATCH 2/3] Avoid calling ARCHIVE in multiple places Because it isn't safe to run multiple instances to libapps.a concurrently. --- Application.mk | 12 ++++++------ Directory.mk | 3 +++ Makefile | 19 +++++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Application.mk b/Application.mk index 25af1926e42..511050614b1 100644 --- a/Application.mk +++ b/Application.mk @@ -129,12 +129,6 @@ $(CXXOBJS): %$(SUFFIX)$(OBJEXT): %$(CXXEXT) $(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@)) .built: $(OBJS) -ifeq ($(WINTOOL),y) - $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $(OBJS)) -else - $(call ARCHIVE, $(BIN), $(OBJS)) -endif - $(Q) touch $@ ifeq ($(BUILD_MODULE),y) @@ -163,6 +157,9 @@ endif install:: $(PROGLIST) +show-objs: + @echo "" + else MAINNAME := $(addsuffix _main,$(PROGNAME)) @@ -185,6 +182,9 @@ endif install:: +show-objs: + @echo $(addprefix $(CWD)$(DELIM),$(OBJS)) + endif # BUILD_MODULE preconfig:: diff --git a/Directory.mk b/Directory.mk index 31cf4f257d3..74b9a936a77 100644 --- a/Directory.mk +++ b/Directory.mk @@ -54,6 +54,7 @@ $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),context))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) +$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),show-objs))) nothing: @@ -75,4 +76,6 @@ ifneq ($(MENUDESC),) $(call DELFILE, Kconfig) endif +show-objs: $(foreach SDIR, $(SUBDIRS), $(SDIR)_show-objs) + -include Make.dep diff --git a/Makefile b/Makefile index e0ad31f1cfb..53b6fa50267 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,8 @@ endif SYMTABSRC = symtab_apps.c SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT)) +APPOBJS = $(shell $(MAKE) show-objs TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)") + # Build targets all: $(BIN) @@ -66,6 +68,11 @@ define MAKE_template endef +define MAKE_template_quiet + @ $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" V=0 Q=@ + +endef + define SDIR_template $(1)_$(2): +$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" @@ -105,6 +112,11 @@ else ifeq ($(CONFIG_BUILD_LOADABLE),) $(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all) +ifeq ($(WINTOOL),y) + $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $(APPOBJS)) +else + $(call ARCHIVE, $(BIN), $(APPOBJS)) +endif else @@ -117,9 +129,9 @@ $(SYMTABOBJ): %$(OBJEXT): %.c $(BIN): $(SYMTABOBJ) ifeq ($(WINTOOL),y) - $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $^) + $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $(APPOBJS) $(SYMTABOBJ)) else - $(call ARCHIVE, $(BIN), $^) + $(call ARCHIVE, $(BIN), $(APPOBJS) $(SYMTABOBJ)) endif endif # !CONFIG_BUILD_LOADABLE @@ -155,6 +167,9 @@ Kconfig: preconfig: Kconfig +show-objs: + $(foreach SDIR, $(CONFIGURED_APPS), $(call MAKE_template_quiet,$(SDIR),show-objs)) + export: ifneq ($(EXPORTDIR),) ifneq ($(BUILTIN_REGISTRY),) From ae58b1158001ec42c64cb25502f33f5567e98282 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 21 Feb 2020 17:10:14 +0900 Subject: [PATCH 3/3] Remove libapps.a from LDLIBS I don't understand how it's supposed to work. (As libapps.a is likely not fully baked at that point.) I don't understand why it's necessary either. --- Make.defs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Make.defs b/Make.defs index 77b0c82751b..d48fa38f499 100644 --- a/Make.defs +++ b/Make.defs @@ -148,11 +148,3 @@ endif CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"} CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"} - -ifneq ($(CONFIG_BUILD_KERNEL),y) -ifeq ($(WINTOOL),y) - LDLIBS ?= "${shell cygpath -w $(BIN)}" -else - LDLIBS ?= $(BIN) -endif -endif