Commit 944cfe9b authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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 392885ee ("kbuild: let fixdep directly write to .*.cmd
files") missed to fix up this file.

Fixes: 392885ee ("kbuild: let fixdep directly write to .*.cmd")
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 5241ab4c
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -145,10 +145,8 @@ FORCE:
# optimization, we don't need to read them if the target does not
# exist, we will rebuild anyway in that case.

cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
existing-targets := $(wildcard $(sort $(targets)))

ifneq ($(cmd_files),)
  include $(cmd_files)
endif
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)

.PHONY: $(PHONY)