History

kbuild: modpost: include .*.cmd files only when targets exist

If a build rule fails, the .DELETE_ON_ERROR special target removes the target, but does nothing for the .*.cmd file, which might be corrupted. So, .*.cmd files should be included only when the corresponding targets exist. Commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") missed to fix up this file.

Masahiro Yamada committed 7 years ago

Commit 944cfe91 parent 5241ab41 file · +2 −4Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/Makefile.modpost+2−4
@@ -145,10 +145,8 @@ FORCE: · 144 unmodified lines
145145 # optimization, we don't need to read them if the target does not
146146 # exist, we will rebuild anyway in that case.
147147
148−cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
148+existing-targets := $(wildcard $(sort $(targets)))
149149
150−ifneq ($(cmd_files),)
151− include $(cmd_files)
152−endif
150+-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
153151
154152 .PHONY: $(PHONY)