... and merge them in the list of parsed dependencies.
Showing the changes to scripts/basic (1 of 1 file). Show all
Unified · Split
| @@ -120,13 +120,15 @@ · 119 unmodified lines | ||
| 120 | 120 | #define INT_NFIG ntohl(0x4e464947) |
| 121 | 121 | #define INT_FIG_ ntohl(0x4649475f) |
| 122 | 122 | |
| 123 | +int insert_extra_deps; | |
| 123 | 124 | char *target; |
| 124 | 125 | char *depfile; |
| 125 | 126 | char *cmdline; |
| 126 | 127 | |
| 127 | 128 | static void usage(void) |
| 128 | 129 | { |
| 129 | − fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); | |
| 130 | + fprintf(stderr, "Usage: fixdep [-e] <depfile> <target> <cmdline>\n"); | |
| 131 | + fprintf(stderr, " -e insert extra dependencies given on stdin\n"); | |
| 130 | 132 | exit(1); |
| 131 | 133 | } |
| 132 | 134 | |
| @@ -138,6 +140,40 @@ static void print_cmdline(void) · 5 unmodified lines | ||
| 138 | 140 | printf("cmd_%s := %s\n\n", target, cmdline); |
| 139 | 141 | } |
| 140 | 142 | |
| 143 | +/* | |
| 144 | + * Print out a dependency path from a symbol name | |
| 145 | + */ | |
| 146 | +static void print_config(const char *m, int slen) | |
| 147 | +{ | |
| 148 | + int c, i; | |
| 149 | + | |
| 150 | + printf(" $(wildcard include/config/"); | |
| 151 | + for (i = 0; i < slen; i++) { | |
| 152 | + c = m[i]; | |
| 153 | + if (c == '_') | |
| 154 | + c = '/'; | |
| 155 | + else | |
| 156 | + c = tolower(c); | |
| 157 | + putchar(c); | |
| 158 | + } | |
| 159 | + printf(".h) \\\n"); | |
| 160 | +} | |
| 161 | + | |
| 162 | +static void do_extra_deps(void) | |
| 163 | +{ | |
| 164 | + if (insert_extra_deps) { | |
| 165 | + char buf[80]; | |
| 166 | + while(fgets(buf, sizeof(buf), stdin)) { | |
| 167 | + int len = strlen(buf); | |
| 168 | + if (len < 2 || buf[len-1] != '\n') { | |
| 169 | + fprintf(stderr, "fixdep: bad data on stdin\n"); | |
| 170 | + exit(1); | |
| 171 | + } | |
| 172 | + print_config(buf, len-1); | |
| 173 | + } | |
| 174 | + } | |
| 175 | +} | |
| 176 | + | |
| 141 | 177 | struct item { |
| 142 | 178 | struct item *next; |
| 143 | 179 | unsigned int len; |
| @@ -197,23 +233,12 @@ static void define_config(const char *name, int len, unsigned int hash) · 53 unmodified lines | ||
| 197 | 233 | static void use_config(const char *m, int slen) |
| 198 | 234 | { |
| 199 | 235 | unsigned int hash = strhash(m, slen); |
| 200 | − int c, i; | |
| 201 | 236 | |
| 202 | 237 | if (is_defined_config(m, slen, hash)) |
| 203 | 238 | return; |
| 204 | 239 | |
| 205 | 240 | define_config(m, slen, hash); |
| 206 | − | |
| 207 | − printf(" $(wildcard include/config/"); | |
| 208 | − for (i = 0; i < slen; i++) { | |
| 209 | − c = m[i]; | |
| 210 | − if (c == '_') | |
| 211 | − c = '/'; | |
| 212 | − else | |
| 213 | − c = tolower(c); | |
| 214 | − putchar(c); | |
| 215 | − } | |
| 216 | − printf(".h) \\\n"); | |
| 241 | + print_config(m, slen); | |
| 217 | 242 | } |
| 218 | 243 | |
| 219 | 244 | static void parse_config_file(const char *map, size_t len) |
| @@ -250,7 +275,7 @@ static void parse_config_file(const char *map, size_t len) · 30 unmodified lines | ||
| 250 | 275 | } |
| 251 | 276 | } |
| 252 | 277 | |
| 253 | −/* test is s ends in sub */ | |
| 278 | +/* test if s ends in sub */ | |
| 254 | 279 | static int strrcmp(const char *s, const char *sub) |
| 255 | 280 | { |
| 256 | 281 | int slen = strlen(s); |
| @@ -378,6 +403,8 @@ static void parse_dep_file(void *map, size_t len) · 121 unmodified lines | ||
| 378 | 403 | exit(1); |
| 379 | 404 | } |
| 380 | 405 | |
| 406 | + do_extra_deps(); | |
| 407 | + | |
| 381 | 408 | printf("\n%s: $(deps_%s)\n\n", target, target); |
| 382 | 409 | printf("$(deps_%s):\n", target); |
| 383 | 410 | } |
| @@ -434,7 +461,10 @@ int main(int argc, char *argv[]) · 50 unmodified lines | ||
| 434 | 461 | { |
| 435 | 462 | traps(); |
| 436 | 463 | |
| 437 | − if (argc != 4) | |
| 464 | + if (argc == 5 && !strcmp(argv[1], "-e")) { | |
| 465 | + insert_extra_deps = 1; | |
| 466 | + argv++; | |
| 467 | + } else if (argc != 4) | |
| 438 | 468 | usage(); |
| 439 | 469 | |
| 440 | 470 | depfile = argv[1]; |