From efa1f519154e5d66bd5e069d06f9bf9c76eea7f1 Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Wed, 11 Oct 2023 12:15:21 +0800 Subject: [PATCH] archive:create a copy rule for the ojbs with the same name when there are too many target files in archive and need to be processed in batches, in order to avoid file replacement due to duplicate names, we dynamically rename the target files here. Signed-off-by: xuxin19 --- Application.mk | 16 ++++++++++++++-- Make.defs | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Application.mk b/Application.mk index 269ceaa6b..4d6fd5682 100644 --- a/Application.mk +++ b/Application.mk @@ -205,8 +205,20 @@ $(ZIGOBJS): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT) $(if $(and $(CONFIG_BUILD_LOADABLE), $(CELFFLAGS)), \ $(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@)) -.built: $(OBJS) - $(call SPLITVARIABLE,ALL_OBJS,$(OBJS),100) +AROBJS := +ifneq ($(OBJS),) +$(eval $(call SPLITVARIABLE,OBJS_SPILT,$(OBJS),100)) +$(foreach BATCH, $(OBJS_SPILT_TOTAL), \ + $(foreach obj, $(OBJS_SPILT_$(BATCH)), \ + $(eval substitute := $(patsubst %$(OBJEXT),%_$(BATCH)$(OBJEXT),$(obj))) \ + $(eval AROBJS += $(substitute)) \ + $(eval $(call AROBJSRULES, $(substitute),$(obj))) \ + ) \ +) +endif + +.built: $(AROBJS) + $(call SPLITVARIABLE,ALL_OBJS,$(AROBJS),100) $(foreach BATCH, $(ALL_OBJS_TOTAL), \ $(shell $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $(ALL_OBJS_$(BATCH)))) \ ) diff --git a/Make.defs b/Make.defs index 6f3807def..91842102e 100644 --- a/Make.defs +++ b/Make.defs @@ -156,3 +156,8 @@ endef define ARLOCK flock $1.lock $(call ARCHIVE, $1, $(2)) endef + +define AROBJSRULES +$(1) : $(2) + cp $(2) $(1) +endef \ No newline at end of file