Skip to content

Commit

Permalink
fixdep: Do not record dependency on the source file itself
Browse files Browse the repository at this point in the history
The dependency is already expressed by the Makefiles, storing it in the
.cmd file breaks build if a .c file is replaced by .S or vice versa,
because the .cmd file contains

foo/bar.o: foo/bar.c ...

foo/bar.c ... :

so the foo/bar.c -> foo/bar.o rule triggers even if there is no
foo/bar.c anymore.

Acked-by: Stephen Rothwell <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
michal42 committed Feb 21, 2011
1 parent 0f54088 commit b7bd182
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/basic/fixdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ static void parse_dep_file(void *map, size_t len)
char *end = m + len;
char *p;
char s[PATH_MAX];
int first;

p = strchr(m, ':');
if (!p) {
Expand All @@ -327,6 +328,7 @@ static void parse_dep_file(void *map, size_t len)

clear_config();

first = 1;
while (m < end) {
while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
m++;
Expand All @@ -340,9 +342,17 @@ static void parse_dep_file(void *map, size_t len)
if (strrcmp(s, "include/generated/autoconf.h") &&
strrcmp(s, "arch/um/include/uml-config.h") &&
strrcmp(s, ".ver")) {
printf(" %s \\\n", s);
/*
* Do not output the first dependency (the
* source file), so that kbuild is not confused
* if a .c file is rewritten into .S or vice
* versa.
*/
if (!first)
printf(" %s \\\n", s);
do_config_file(s);
}
first = 0;
m = p + 1;
}
printf("\n%s: $(deps_%s)\n\n", target, target);
Expand Down

0 comments on commit b7bd182

Please sign in to comment.