diff options
| author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-02-15 12:29:37 +0000 |
|---|---|---|
| committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-02-15 12:29:37 +0000 |
| commit | 6732af276668f9d7a5efde55ca8c37907bd87ae2 (patch) | |
| tree | 35ee2aa8216995e7665272e8e2b58f017f7dfdcd /scripts | |
| parent | 02794e151602911a520e67c8589503eb14f4e744 (diff) | |
| download | busybox-w32-6732af276668f9d7a5efde55ca8c37907bd87ae2.tar.gz busybox-w32-6732af276668f9d7a5efde55ca8c37907bd87ae2.tar.bz2 busybox-w32-6732af276668f9d7a5efde55ca8c37907bd87ae2.zip | |
full removed config.h, use bb_config.h only
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/bb_mkdep.c | 20 | ||||
| -rw-r--r-- | scripts/config/confdata.c | 42 |
2 files changed, 44 insertions, 18 deletions
diff --git a/scripts/bb_mkdep.c b/scripts/bb_mkdep.c index ca48c6a28..a4f97c211 100644 --- a/scripts/bb_mkdep.c +++ b/scripts/bb_mkdep.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Another fast dependencies generator for Makefiles, Version 4.0 | 2 | * Another fast dependencies generator for Makefiles, Version 4.1 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005,2006 by Vladimir Oleynik <dzo@simtreas.ru> | 4 | * Copyright (C) 2005,2006 by Vladimir Oleynik <dzo@simtreas.ru> |
| 5 | * | 5 | * |
| @@ -26,7 +26,7 @@ | |||
| 26 | * - more verbose --help output. | 26 | * - more verbose --help output. |
| 27 | * | 27 | * |
| 28 | * This program does: | 28 | * This program does: |
| 29 | * 1) find #define KEY VALUE or #undef KEY from include/config.h | 29 | * 1) find #define KEY VALUE or #undef KEY from include/bb_config.h |
| 30 | * 2) recursive find and scan *.[ch] files, but skips scan of include/config/ | 30 | * 2) recursive find and scan *.[ch] files, but skips scan of include/config/ |
| 31 | * 3) find #include "*.h" and KEYs using, if not as #define and #undef | 31 | * 3) find #include "*.h" and KEYs using, if not as #define and #undef |
| 32 | * 4) generate dependencies to stdout | 32 | * 4) generate dependencies to stdout |
| @@ -39,7 +39,7 @@ | |||
| 39 | 39 | ||
| 40 | #define LOCAL_INCLUDE_PATH "include" | 40 | #define LOCAL_INCLUDE_PATH "include" |
| 41 | #define INCLUDE_CONFIG_PATH LOCAL_INCLUDE_PATH"/config" | 41 | #define INCLUDE_CONFIG_PATH LOCAL_INCLUDE_PATH"/config" |
| 42 | #define INCLUDE_CONFIG_KEYS_PATH LOCAL_INCLUDE_PATH"/config.h" | 42 | #define INCLUDE_CONFIG_KEYS_PATH LOCAL_INCLUDE_PATH"/bb_config.h" |
| 43 | 43 | ||
| 44 | #define bb_mkdep_full_options \ | 44 | #define bb_mkdep_full_options \ |
| 45 | "\nOptions:" \ | 45 | "\nOptions:" \ |
| @@ -308,7 +308,7 @@ typedef unsigned char operator; | |||
| 308 | #define TOK_UMINUS tok_decl(UNARYPREC+1,0) | 308 | #define TOK_UMINUS tok_decl(UNARYPREC+1,0) |
| 309 | #define TOK_UPLUS tok_decl(UNARYPREC+1,1) | 309 | #define TOK_UPLUS tok_decl(UNARYPREC+1,1) |
| 310 | 310 | ||
| 311 | #define SPEC_PREC (UNARYPREC+1) | 311 | #define SPEC_PREC (UNARYPREC+2) |
| 312 | 312 | ||
| 313 | #define TOK_NUM tok_decl(SPEC_PREC, 0) | 313 | #define TOK_NUM tok_decl(SPEC_PREC, 0) |
| 314 | #define TOK_RPAREN tok_decl(SPEC_PREC, 1) | 314 | #define TOK_RPAREN tok_decl(SPEC_PREC, 1) |
| @@ -521,13 +521,6 @@ endofname(const char *name) | |||
| 521 | } | 521 | } |
| 522 | 522 | ||
| 523 | 523 | ||
| 524 | /* Like strncpy but make sure the resulting string is always 0 terminated. */ | ||
| 525 | static inline char * safe_strncpy(char *dst, const char *src, size_t size) | ||
| 526 | { | ||
| 527 | dst[size-1] = '\0'; | ||
| 528 | return strncpy(dst, src, size-1); | ||
| 529 | } | ||
| 530 | |||
| 531 | static arith_t arith (const char *expr, int *perrcode) | 524 | static arith_t arith (const char *expr, int *perrcode) |
| 532 | { | 525 | { |
| 533 | char arithval; /* Current character under analysis */ | 526 | char arithval; /* Current character under analysis */ |
| @@ -1400,7 +1393,10 @@ static void store_keys(void) | |||
| 1400 | if(*val == '\0') { | 1393 | if(*val == '\0') { |
| 1401 | recordsz = sprintf(record_buf, "#define %s\n", k); | 1394 | recordsz = sprintf(record_buf, "#define %s\n", k); |
| 1402 | } else { | 1395 | } else { |
| 1403 | recordsz = sprintf(record_buf, "#define %s %s\n", k, val); | 1396 | if(val[0] != '(') |
| 1397 | recordsz = sprintf(record_buf, "#define %s %s\n", k, val); | ||
| 1398 | else | ||
| 1399 | recordsz = sprintf(record_buf, "#define %s%s\n", k, val); | ||
| 1404 | } | 1400 | } |
| 1405 | } | 1401 | } |
| 1406 | /* size_t -> ssize_t :( */ | 1402 | /* size_t -> ssize_t :( */ |
diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index c4087fd73..fa262930f 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c | |||
| @@ -279,6 +279,7 @@ int conf_write(const char *name) | |||
| 279 | char dirname[128], tmpname[128], newname[128]; | 279 | char dirname[128], tmpname[128], newname[128]; |
| 280 | int type, l; | 280 | int type, l; |
| 281 | const char *str; | 281 | const char *str; |
| 282 | const char *opt_name; | ||
| 282 | 283 | ||
| 283 | dirname[0] = 0; | 284 | dirname[0] = 0; |
| 284 | if (name && name[0]) { | 285 | if (name && name[0]) { |
| @@ -316,6 +317,7 @@ int conf_write(const char *name) | |||
| 316 | "# Automatically generated make config: don't edit\n" | 317 | "# Automatically generated make config: don't edit\n" |
| 317 | "#\n"); | 318 | "#\n"); |
| 318 | if (out_h) { | 319 | if (out_h) { |
| 320 | fprintf(out_h, "#ifndef BB_CONFIG_H\n#define BB_CONFIG_H\n"); | ||
| 319 | fprintf(out_h, "/*\n" | 321 | fprintf(out_h, "/*\n" |
| 320 | " * Automatically generated header file: don't edit\n" | 322 | " * Automatically generated header file: don't edit\n" |
| 321 | " */\n\n" | 323 | " */\n\n" |
| @@ -367,14 +369,23 @@ int conf_write(const char *name) | |||
| 367 | if (modules_sym->curr.tri == no) | 369 | if (modules_sym->curr.tri == no) |
| 368 | type = S_BOOLEAN; | 370 | type = S_BOOLEAN; |
| 369 | } | 371 | } |
| 372 | opt_name = strchr(sym->name, '_'); | ||
| 373 | if(opt_name == NULL) | ||
| 374 | opt_name = sym->name; | ||
| 375 | else | ||
| 376 | opt_name++; | ||
| 370 | switch (type) { | 377 | switch (type) { |
| 371 | case S_BOOLEAN: | 378 | case S_BOOLEAN: |
| 372 | case S_TRISTATE: | 379 | case S_TRISTATE: |
| 373 | switch (sym_get_tristate_value(sym)) { | 380 | switch (sym_get_tristate_value(sym)) { |
| 374 | case no: | 381 | case no: |
| 375 | fprintf(out, "# %s is not set\n", sym->name); | 382 | fprintf(out, "# %s is not set\n", sym->name); |
| 376 | if (out_h) | 383 | if (out_h) { |
| 377 | fprintf(out_h, "#undef %s\n", sym->name); | 384 | fprintf(out_h, "#undef %s\n", sym->name); |
| 385 | fprintf(out_h, "#define ENABLE_%s 0\n", opt_name); | ||
| 386 | fprintf(out_h, "#define USE_%s(...)\n", opt_name); | ||
| 387 | fprintf(out_h, "#define UNUSE_%s(...) __VA_ARGS__\n", opt_name); | ||
| 388 | } | ||
| 378 | break; | 389 | break; |
| 379 | case mod: | 390 | case mod: |
| 380 | #if 0 | 391 | #if 0 |
| @@ -385,8 +396,12 @@ int conf_write(const char *name) | |||
| 385 | break; | 396 | break; |
| 386 | case yes: | 397 | case yes: |
| 387 | fprintf(out, "%s=y\n", sym->name); | 398 | fprintf(out, "%s=y\n", sym->name); |
| 388 | if (out_h) | 399 | if (out_h) { |
| 389 | fprintf(out_h, "#define %s 1\n", sym->name); | 400 | fprintf(out_h, "#define %s 1\n", sym->name); |
| 401 | fprintf(out_h, "#define ENABLE_%s 1\n", opt_name); | ||
| 402 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name); | ||
| 403 | fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name); | ||
| 404 | } | ||
| 390 | break; | 405 | break; |
| 391 | } | 406 | } |
| 392 | break; | 407 | break; |
| @@ -412,32 +427,47 @@ int conf_write(const char *name) | |||
| 412 | } | 427 | } |
| 413 | } while (*str); | 428 | } while (*str); |
| 414 | fputs("\"\n", out); | 429 | fputs("\"\n", out); |
| 415 | if (out_h) | 430 | if (out_h) { |
| 416 | fputs("\"\n", out_h); | 431 | fputs("\"\n", out_h); |
| 432 | fprintf(out_h, "#define ENABLE_%s 1\n", opt_name); | ||
| 433 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name); | ||
| 434 | fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name); | ||
| 435 | } | ||
| 417 | break; | 436 | break; |
| 418 | case S_HEX: | 437 | case S_HEX: |
| 419 | str = sym_get_string_value(sym); | 438 | str = sym_get_string_value(sym); |
| 420 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | 439 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { |
| 421 | fprintf(out, "%s=%s\n", sym->name, *str ? str : "0"); | 440 | fprintf(out, "%s=%s\n", sym->name, *str ? str : "0"); |
| 422 | if (out_h) | 441 | if (out_h) { |
| 423 | fprintf(out_h, "#define %s 0x%s\n", sym->name, str); | 442 | fprintf(out_h, "#define %s 0x%s\n", sym->name, str); |
| 443 | fprintf(out_h, "#define ENABLE_%s 1\n", opt_name); | ||
| 444 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name); | ||
| 445 | fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name); | ||
| 446 | } | ||
| 424 | break; | 447 | break; |
| 425 | } | 448 | } |
| 426 | case S_INT: | 449 | case S_INT: |
| 427 | str = sym_get_string_value(sym); | 450 | str = sym_get_string_value(sym); |
| 428 | fprintf(out, "%s=%s\n", sym->name, *str ? str : "0"); | 451 | fprintf(out, "%s=%s\n", sym->name, *str ? str : "0"); |
| 429 | if (out_h) | 452 | if (out_h) { |
| 430 | fprintf(out_h, "#define %s %s\n", sym->name, str); | 453 | fprintf(out_h, "#define %s %s\n", sym->name, str); |
| 454 | fprintf(out_h, "#define ENABLE_%s 1\n", opt_name); | ||
| 455 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name); | ||
| 456 | fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name); | ||
| 457 | } | ||
| 431 | break; | 458 | break; |
| 432 | } | 459 | } |
| 460 | if (out_h) | ||
| 461 | fprintf(out_h, "\n"); | ||
| 433 | } | 462 | } |
| 434 | next: | 463 | next: |
| 435 | menu = next_menu(menu); | 464 | menu = next_menu(menu); |
| 436 | } | 465 | } |
| 437 | fclose(out); | 466 | fclose(out); |
| 438 | if (out_h) { | 467 | if (out_h) { |
| 468 | fprintf(out_h, "#endif /* BB_CONFIG_H */\n"); | ||
| 439 | fclose(out_h); | 469 | fclose(out_h); |
| 440 | rename(".tmpconfig.h", "include/config.h"); | 470 | rename(".tmpconfig.h", "include/bb_config.h"); |
| 441 | file_write_dep(NULL); | 471 | file_write_dep(NULL); |
| 442 | } | 472 | } |
| 443 | if (!name || basename != conf_def_filename) { | 473 | if (!name || basename != conf_def_filename) { |
