Skip to content

Commit

Permalink
Revert "tools: generic.mk: re-generate object files if flags.txt file…
Browse files Browse the repository at this point in the history
…s have changed"

This reverts commit 93473c4.
  • Loading branch information
dbogdan authored and buha committed Nov 27, 2024
1 parent 93473c4 commit 66afd04
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions tools/scripts/generic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 66afd04

Please sign in to comment.