Application.mk:ensure that the order when AROBJS is compiled multiple times

sort the target files to ensure that the files in each batch are the same every time
and clean AROBJS.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2023-10-17 21:07:46 +08:00 committed by archer
parent efa1f51915
commit 4439b242d8
2 changed files with 20 additions and 5 deletions

View File

@ -205,9 +205,10 @@ $(ZIGOBJS): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
$(if $(and $(CONFIG_BUILD_LOADABLE), $(CELFFLAGS)), \
$(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
AROBJS :=
AROBJS :=
ifneq ($(OBJS),)
$(eval $(call SPLITVARIABLE,OBJS_SPILT,$(OBJS),100))
SORTOBJS := $(sort $(OBJS))
$(eval $(call SPLITVARIABLE,OBJS_SPILT,$(SORTOBJS),100))
$(foreach BATCH, $(OBJS_SPILT_TOTAL), \
$(foreach obj, $(OBJS_SPILT_$(BATCH)), \
$(eval substitute := $(patsubst %$(OBJEXT),%_$(BATCH)$(OBJEXT),$(obj))) \
@ -298,7 +299,7 @@ endif
$(shell $(MKDEP) $(DEPPATH) --obj-suffix .c$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.c,$(ALL_DEP_OBJS_$(BATCH))) >Make.dep) \
$(shell $(MKDEP) $(DEPPATH) --obj-suffix .S$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.S,$(ALL_DEP_OBJS_$(BATCH))) >>Make.dep) \
$(shell $(MKDEP) $(DEPPATH) --obj-suffix $(CXXEXT)$(SUFFIX)$(OBJEXT) "$(CXX)" -- $(CXXFLAGS) -- $(filter %$(CXXEXT),$(ALL_DEP_OBJS_$(BATCH))) >>Make.dep) \
)
)
$(Q) touch $@
depend:: .depend
@ -306,8 +307,8 @@ depend:: .depend
clean::
$(call DELFILE, .built)
$(call CLEANAROBJS)
$(call CLEAN)
distclean:: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)

View File

@ -157,7 +157,21 @@ define ARLOCK
flock $1.lock $(call ARCHIVE, $1, $(2))
endef
# dynamic AR target
define AROBJSRULES
$(1) : $(2)
cp $(2) $(1)
endef
endef
# CLEANAROBJS - del AR target files exclusively
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define CLEANAROBJS
$(call DELFILE,$(subst /,\,$(AROBJS)))
endef
else
define CLEANAROBJS
$(Q) rm -f $(AROBJS)
endef
endif