Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234086
b: refs/heads/master
c: 7840fea
h: refs/heads/master
v: v3
  • Loading branch information
Michal Marek authored and Linus Torvalds committed Mar 13, 2011
1 parent 42749a9 commit d46d174
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e8444a3e3b56b268c6ca31a2f77040fd944834fb
refs/heads/master: 7840fea200cd1ad93ed19853a83752a21f691326
19 changes: 13 additions & 6 deletions trunk/scripts/basic/fixdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ static void do_config_file(const char *filename)
close(fd);
}

/*
* Important: The below generated source_foo.o and deps_foo.o variable
* assignments are parsed not only by make, but also by the rather simple
* parser in scripts/mod/sumversion.c.
*/
static void parse_dep_file(void *map, size_t len)
{
char *m = map;
Expand All @@ -323,7 +328,6 @@ static void parse_dep_file(void *map, size_t len)
exit(1);
}
memcpy(s, m, p-m); s[p-m] = 0;
printf("deps_%s := \\\n", target);
m = p+1;

clear_config();
Expand All @@ -343,12 +347,15 @@ static void parse_dep_file(void *map, size_t len)
strrcmp(s, "arch/um/include/uml-config.h") &&
strrcmp(s, ".ver")) {
/*
* 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.
* Do not list the source file as dependency, so that
* kbuild is not confused if a .c file is rewritten
* into .S or vice versa. Storing it in source_* is
* needed for modpost to compute srcversions.
*/
if (!first)
if (first) {
printf("source_%s := %s\n\n", target, s);
printf("deps_%s := \\\n", target);
} else
printf(" %s \\\n", s);
do_config_file(s);
}
Expand Down
19 changes: 17 additions & 2 deletions trunk/scripts/mod/sumversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ static int is_static_library(const char *objfile)
return 0;
}

/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to
* figure out source file. */
/* We have dir/file.o. Open dir/.file.o.cmd, look for source_ and deps_ line
* to figure out source files. */
static int parse_source_files(const char *objfile, struct md4_ctx *md)
{
char *cmd, *file, *line, *dir;
Expand Down Expand Up @@ -340,6 +340,21 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
*/
while ((line = get_next_line(&pos, file, flen)) != NULL) {
char* p = line;

if (strncmp(line, "source_", sizeof("source_")-1) == 0) {
p = strrchr(line, ' ');
if (!p) {
warn("malformed line: %s\n", line);
goto out_file;
}
p++;
if (!parse_file(p, md)) {
warn("could not open %s: %s\n",
p, strerror(errno));
goto out_file;
}
continue;
}
if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) {
check_files = 1;
continue;
Expand Down

0 comments on commit d46d174

Please sign in to comment.