--- zzzz-none-000/linux-5.4.213/scripts/Makefile.build 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/scripts/Makefile.build 2024-08-14 09:02:15.000000000 +0000 @@ -128,12 +128,47 @@ $(obj)/%.ll: $(src)/%.c FORCE $(call if_changed_dep,cc_ll_c) +ifdef CONFIG_DEBUG_MEM_USAGE +CFLAGS_WRAP := -include include/linux/debug_mem_usage.h +NEW_CFLAGS_WRAP := $(CFLAGS_WRAP) + +cmd_export_new_cflags = \ + $(if $(findstring kernel/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring arch/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring init/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring mm/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring block/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring kernel/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring block/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring usr/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring security/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring sound/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring crypto/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring firmware/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring samples/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring tools/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring lib/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring fs/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring ipc/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring drivers/, $@), $(filter-out $(NEW_CFLAGS_WRAP), $(CFLAGS_WRAP))) \ + $(if $(findstring drivers/net/, $@), $(CFLAGS_WRAP)) \ + $(if $(findstring net/, $@), $(CFLAGS_WRAP)) \ + $(if $(findstring /linux-ipq, $@), $(CFLAGS_WRAP)) + +# C (.c) files +# The C file is compiled and updated dependency information is generated. +# (See cmd_cc_o_c + relevant part of rule_cc_o_c) + +quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ + cmd_cc_o_c = $(CC) $(c_flags) $(cmd_export_new_cflags) -c -o $@ $< +else # C (.c) files # The C file is compiled and updated dependency information is generated. # (See cmd_cc_o_c + relevant part of rule_cc_o_c) quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +endif ifdef CONFIG_MODVERSIONS # When module versioning is enabled the following steps are executed: @@ -350,7 +385,7 @@ # Linker scripts preprocessor (.lds.S -> .lds) # --------------------------------------------------------------------------- quiet_cmd_cpp_lds_S = LDS $@ - cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \ + cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -U$(ARCH) \ -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< $(obj)/%.lds: $(src)/%.lds.S FORCE @@ -428,7 +463,7 @@ # module is turned into a multi object module, $^ will contain header file # dependencies recorded in the .*.cmd file. quiet_cmd_link_multi-m = LD [M] $@ - cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) + cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o %.a,$^) $(multi-used-m): FORCE $(call if_changed,link_multi-m) @@ -515,15 +550,13 @@ -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -ifdef building_out_of_srctree # Create directories for object files if they do not exist -obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) +obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets)))) # If targets exist, their directories apparently exist. Skip mkdir. existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets)))) obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs))) ifneq ($(obj-dirs),) $(shell mkdir -p $(obj-dirs)) endif -endif .PHONY: $(PHONY)