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.
Unified · Split
| @@ -145,10 +145,8 @@ FORCE: · 144 unmodified lines | |||
| 145 | # optimization, we don't need to read them if the target does not | 145 | # optimization, we don't need to read them if the target does not |
| 146 | # exist, we will rebuild anyway in that case. | 146 | # exist, we will rebuild anyway in that case. |
| 147 | 147 | ||
| 148 | cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) | 148 | existing-targets := $(wildcard $(sort $(targets))) |
| 149 | 149 | ||
| 150 | ifneq ($(cmd_files),) | 150 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
| 151 | include $(cmd_files) | ||
| 152 | endif | ||
| 153 | 151 | ||
| 154 | .PHONY: $(PHONY) | 152 | .PHONY: $(PHONY) |