kbuild: prevent modpost from looking for a .cmd file for a static library linked into a module

This fixes a compile time warning which occurs whenever a static library
is linked into a kernel module. MODPOST tries to look for a
".<modulename>.cmd" file to look for its dependencies, but that file
doesn't exist or get generated for static libraries.

This patch prevents modpost from looking for a .cmd file when a module is
linked with a static library

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Ashutosh Naik <ashutosh.naik@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

authored by Ashutosh Naik and committed by Sam Ravnborg e6e6733e 92f83cc5

+11 -1
+11 -1
scripts/mod/sumversion.c
··· 290 release_file(file, len); 291 return 1; 292 } 293 294 /* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to 295 * figure out source file. */ ··· 429 while ((fname = strsep(&sources, " ")) != NULL) { 430 if (!*fname) 431 continue; 432 - if (!parse_source_files(fname, &md)) 433 goto release; 434 } 435
··· 290 release_file(file, len); 291 return 1; 292 } 293 + /* Check whether the file is a static library or not */ 294 + static int is_static_library(const char *objfile) 295 + { 296 + int len = strlen(objfile); 297 + if (objfile[len - 2] == '.' && objfile[len - 1] == 'a') 298 + return 1; 299 + else 300 + return 0; 301 + } 302 303 /* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to 304 * figure out source file. */ ··· 420 while ((fname = strsep(&sources, " ")) != NULL) { 421 if (!*fname) 422 continue; 423 + if (!(is_static_library(fname)) && 424 + !parse_source_files(fname, &md)) 425 goto release; 426 } 427