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 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2023-10-11 12:15:21 +08:00 committed by archer
parent 09bb3b5853
commit efa1f51915
2 changed files with 19 additions and 2 deletions

View File

@ -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)))) \
)

View File

@ -156,3 +156,8 @@ endef
define ARLOCK
flock $1.lock $(call ARCHIVE, $1, $(2))
endef
define AROBJSRULES
$(1) : $(2)
cp $(2) $(1)
endef