Skip to content

Commit 4a6db07

Browse files
author
Kai Germaschewski
committed
kbuild: Handle removed headers
New and old way to handle dependencies would choke when a file #include'd by other files was removed, since the dependency on it was still recorded, but since it was gone, make has no idea what to do about it (and would complain with "No rule to make <file> ...") We now add targets for all the previously included files, so make will just ignore them if they disappear.
1 parent c51db43 commit 4a6db07

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Rules.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ if_changed = $(if $(strip $? \
446446
# execute the command and also postprocess generated .d dependencies
447447
# file
448448

449-
if_changed_dep = $(if $(strip $? \
449+
if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
450450
$(filter-out $(cmd_$(1)),$(cmd_$@))\
451451
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
452452
@set -e; \

scripts/fixdep.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void parse_dep_file(void *map, size_t len)
292292
exit(1);
293293
}
294294
memcpy(s, m, p-m); s[p-m] = 0;
295-
printf("%s: \\\n", target);
295+
printf("deps_%s := \\\n", target);
296296
m = p+1;
297297

298298
clear_config();
@@ -314,7 +314,8 @@ void parse_dep_file(void *map, size_t len)
314314
}
315315
m = p + 1;
316316
}
317-
printf("\n");
317+
printf("\n%s: $(deps_%s)\n\n", target, target);
318+
printf("$(deps_%s):\n", target);
318319
}
319320

320321
void print_deps(void)

0 commit comments

Comments
 (0)