diff options
Diffstat (limited to 'scripts/basic/fixdep.c')
-rw-r--r-- | scripts/basic/fixdep.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index dfba77b5d0c3..d33b5a4c9ecb 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -111,11 +111,6 @@ | |||
111 | #include <stdio.h> | 111 | #include <stdio.h> |
112 | #include <ctype.h> | 112 | #include <ctype.h> |
113 | 113 | ||
114 | int insert_extra_deps; | ||
115 | char *target; | ||
116 | char *depfile; | ||
117 | char *cmdline; | ||
118 | |||
119 | static void usage(void) | 114 | static void usage(void) |
120 | { | 115 | { |
121 | fprintf(stderr, "Usage: fixdep [-e] <depfile> <target> <cmdline>\n"); | 116 | fprintf(stderr, "Usage: fixdep [-e] <depfile> <target> <cmdline>\n"); |
@@ -124,14 +119,6 @@ static void usage(void) | |||
124 | } | 119 | } |
125 | 120 | ||
126 | /* | 121 | /* |
127 | * Print out the commandline prefixed with cmd_<target filename> := | ||
128 | */ | ||
129 | static void print_cmdline(void) | ||
130 | { | ||
131 | printf("cmd_%s := %s\n\n", target, cmdline); | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * Print out a dependency path from a symbol name | 122 | * Print out a dependency path from a symbol name |
136 | */ | 123 | */ |
137 | static void print_config(const char *m, int slen) | 124 | static void print_config(const char *m, int slen) |
@@ -152,16 +139,16 @@ static void print_config(const char *m, int slen) | |||
152 | 139 | ||
153 | static void do_extra_deps(void) | 140 | static void do_extra_deps(void) |
154 | { | 141 | { |
155 | if (insert_extra_deps) { | 142 | char buf[80]; |
156 | char buf[80]; | 143 | |
157 | while(fgets(buf, sizeof(buf), stdin)) { | 144 | while (fgets(buf, sizeof(buf), stdin)) { |
158 | int len = strlen(buf); | 145 | int len = strlen(buf); |
159 | if (len < 2 || buf[len-1] != '\n') { | 146 | |
160 | fprintf(stderr, "fixdep: bad data on stdin\n"); | 147 | if (len < 2 || buf[len - 1] != '\n') { |
161 | exit(1); | 148 | fprintf(stderr, "fixdep: bad data on stdin\n"); |
162 | } | 149 | exit(1); |
163 | print_config(buf, len-1); | ||
164 | } | 150 | } |
151 | print_config(buf, len - 1); | ||
165 | } | 152 | } |
166 | } | 153 | } |
167 | 154 | ||
@@ -300,7 +287,7 @@ static void *read_file(const char *filename) | |||
300 | * assignments are parsed not only by make, but also by the rather simple | 287 | * assignments are parsed not only by make, but also by the rather simple |
301 | * parser in scripts/mod/sumversion.c. | 288 | * parser in scripts/mod/sumversion.c. |
302 | */ | 289 | */ |
303 | static void parse_dep_file(char *m) | 290 | static void parse_dep_file(char *m, const char *target, int insert_extra_deps) |
304 | { | 291 | { |
305 | char *p; | 292 | char *p; |
306 | int is_last, is_target; | 293 | int is_last, is_target; |
@@ -385,7 +372,8 @@ static void parse_dep_file(char *m) | |||
385 | exit(1); | 372 | exit(1); |
386 | } | 373 | } |
387 | 374 | ||
388 | do_extra_deps(); | 375 | if (insert_extra_deps) |
376 | do_extra_deps(); | ||
389 | 377 | ||
390 | printf("\n%s: $(deps_%s)\n\n", target, target); | 378 | printf("\n%s: $(deps_%s)\n\n", target, target); |
391 | printf("$(deps_%s):\n", target); | 379 | printf("$(deps_%s):\n", target); |
@@ -393,6 +381,8 @@ static void parse_dep_file(char *m) | |||
393 | 381 | ||
394 | int main(int argc, char *argv[]) | 382 | int main(int argc, char *argv[]) |
395 | { | 383 | { |
384 | const char *depfile, *target, *cmdline; | ||
385 | int insert_extra_deps = 0; | ||
396 | void *buf; | 386 | void *buf; |
397 | 387 | ||
398 | if (argc == 5 && !strcmp(argv[1], "-e")) { | 388 | if (argc == 5 && !strcmp(argv[1], "-e")) { |
@@ -405,10 +395,10 @@ int main(int argc, char *argv[]) | |||
405 | target = argv[2]; | 395 | target = argv[2]; |
406 | cmdline = argv[3]; | 396 | cmdline = argv[3]; |
407 | 397 | ||
408 | print_cmdline(); | 398 | printf("cmd_%s := %s\n\n", target, cmdline); |
409 | 399 | ||
410 | buf = read_file(depfile); | 400 | buf = read_file(depfile); |
411 | parse_dep_file(buf); | 401 | parse_dep_file(buf, target, insert_extra_deps); |
412 | free(buf); | 402 | free(buf); |
413 | 403 | ||
414 | return 0; | 404 | return 0; |