diff --git a/tools/scripts/generic.mk b/tools/scripts/generic.mk index f17f1b06e39..6ad45a242af 100644 --- a/tools/scripts/generic.mk +++ b/tools/scripts/generic.mk @@ -301,41 +301,32 @@ LSCRIPT_FLAG = -T$(LSCRIPT) endif define generate_cflags_func -echo $(subst \",\\\",$(1)) >> $(CFLAGS_FILE).tmp +echo $(subst \",\\\",$(1)) >> $(CFLAGS_FILE) endef define generate_cppflags_func -echo $(subst \",\\\",$(1)) >> $(CPPFLAGS_FILE).tmp +echo $(subst \",\\\",$(1)) >> $(CPPFLAGS_FILE) endef define generate_asflags_func -echo $(subst \",\\\",$(1)) >> $(ASFLAGS_FILE).tmp +echo $(subst \",\\\",$(1)) >> $(ASFLAGS_FILE) endef define generate_objs_func -echo $(1) >> $(OBJS_FILE).tmp -endef - -define overwrite_file_if_different - diff $(1) $(2) &> /dev/null || mv -f $(1) $(2) -endef - -define generate_flags_file - echo -n > $(1).tmp - $(call process_items_in_chunks,$(2),10,$(3)) - $(call overwrite_file_if_different,$(1).tmp,$(1)) - rm -f $(1).tmp +echo $(1) >> $(OBJS_FILE) endef PHONY += pre_build pre_build: $(call print,Generating build flags) - $(call generate_flags_file,$(CFLAGS_FILE),$(CFLAGS),generate_cflags_func) - $(call generate_flags_file,$(CPPFLAGS_FILE),$(CPPFLAGS),generate_cppflags_func) - $(call generate_flags_file,$(ASFLAGS_FILE),$(ASFLAGS),generate_asflags_func) - $(call generate_flags_file,$(OBJS_FILE),$(OBJS),generate_objs_func) - -$(OBJS): $(CFLAGS_FILE) $(CPPFLAGS_FILE) $(ASFLAGS_FILE) $(OBJS_FILE) + echo -n > $(CFLAGS_FILE) + $(call process_items_in_chunks,$(CFLAGS),10,generate_cflags_func) + echo -n > $(CPPFLAGS_FILE) + $(call process_items_in_chunks,$(CPPFLAGS),10,generate_cppflags_func) + echo -n > $(ASFLAGS_FILE) + $(call process_items_in_chunks,$(ASFLAGS),10,generate_asflags_func) + echo -n > $(OBJS_FILE) + $(call process_items_in_chunks,$(sort $(OBJS)),10,generate_objs_func) $(BINARY): $(LIB_TARGETS) $(OBJS) $(ASM_OBJS) $(LSCRIPT) $(BOOTOBJ) $(call print,[LD] $(notdir $(OBJS)))