fixdep: Do not record dependency on the source file itself

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 <sfr@canb.auug.org.au>
Signed-off-by: Michal Marek <mmarek@suse.cz>

+11 -1
+11 -1
scripts/basic/fixdep.c
··· 315 315 char *end = m + len; 316 316 char *p; 317 317 char s[PATH_MAX]; 318 + int first; 318 319 319 320 p = strchr(m, ':'); 320 321 if (!p) { ··· 328 327 329 328 clear_config(); 330 329 330 + first = 1; 331 331 while (m < end) { 332 332 while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) 333 333 m++; ··· 342 340 if (strrcmp(s, "include/generated/autoconf.h") && 343 341 strrcmp(s, "arch/um/include/uml-config.h") && 344 342 strrcmp(s, ".ver")) { 345 - printf(" %s \\\n", s); 343 + /* 344 + * Do not output the first dependency (the 345 + * source file), so that kbuild is not confused 346 + * if a .c file is rewritten into .S or vice 347 + * versa. 348 + */ 349 + if (!first) 350 + printf(" %s \\\n", s); 346 351 do_config_file(s); 347 352 } 353 + first = 0; 348 354 m = p + 1; 349 355 } 350 356 printf("\n%s: $(deps_%s)\n\n", target, target);