aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-06-09 01:12:39 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-06-09 01:31:30 -0400
commitc955ccafc38e77312b4c65e5a70960080fb8a3f2 (patch)
treef630610edef42b8ed60c455cfdb74d897190f1d3 /scripts
parentddc97cacb310ad68483952e67764c4153c138ed2 (diff)
kconfig: fix .config dependencies
This fixes one of the worst kbuild warts left - the broken dependencies used to check and regenerate the .config file. This was done via an indirect dependency and the .config itself had an empty command, which can cause make not to reread the changed .config file. Instead of this we generate now a new file include/config/auto.conf from .config, which is used for kbuild and has the proper dependencies. It's also the main make target now for all files generated during this step (and thus replaces include/linux/autoconf.h). This also means we can now relax the syntax requirements for the .config file and we don't have to rewrite it all the time, i.e. silentoldconfig only writes .config now when it's necessary to keep it in sync with the Kconfig files and even this can be suppressed by setting the environment variable KCONFIG_NOSILENTUPDATE, so the update can (and must) be done manually. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build2
-rw-r--r--scripts/Makefile.modpost2
-rw-r--r--scripts/kconfig/conf.c16
-rw-r--r--scripts/kconfig/confdata.c177
-rw-r--r--scripts/kconfig/lkc_proto.h1
-rw-r--r--scripts/kconfig/util.c4
6 files changed, 145 insertions, 57 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e48e60da3040..53e53a2e80ae 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -8,7 +8,7 @@ PHONY := __build
8__build: 8__build:
9 9
10# Read .config if it exist, otherwise ignore 10# Read .config if it exist, otherwise ignore
11-include .config 11-include include/config/auto.conf
12 12
13include scripts/Kbuild.include 13include scripts/Kbuild.include
14 14
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 0e056cffffdb..576cce5e387f 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -35,7 +35,7 @@
35PHONY := _modpost 35PHONY := _modpost
36_modpost: __modpost 36_modpost: __modpost
37 37
38include .config 38include include/config/auto.conf
39include scripts/Kbuild.include 39include scripts/Kbuild.include
40include scripts/Makefile.lib 40include scripts/Makefile.lib
41 41
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 8012d1076876..9334da65f364 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -599,7 +599,15 @@ int main(int ac, char **av)
599 input_mode = ask_silent; 599 input_mode = ask_silent;
600 valid_stdin = 1; 600 valid_stdin = 1;
601 } 601 }
602 } 602 } else if (sym_change_count) {
603 name = getenv("KCONFIG_NOSILENTUPDATE");
604 if (name && *name) {
605 fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
606 return 1;
607 }
608 } else
609 goto skip_check;
610
603 do { 611 do {
604 conf_cnt = 0; 612 conf_cnt = 0;
605 check_conf(&rootmenu); 613 check_conf(&rootmenu);
@@ -608,5 +616,11 @@ int main(int ac, char **av)
608 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 616 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
609 return 1; 617 return 1;
610 } 618 }
619skip_check:
620 if (input_mode == ask_silent && conf_write_autoconf()) {
621 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
622 return 1;
623 }
624
611 return 0; 625 return 0;
612} 626}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index a9e3b6abf661..2da4a8d775a5 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -342,7 +342,7 @@ int conf_read(const char *name)
342 342
343int conf_write(const char *name) 343int conf_write(const char *name)
344{ 344{
345 FILE *out, *out_h; 345 FILE *out;
346 struct symbol *sym; 346 struct symbol *sym;
347 struct menu *menu; 347 struct menu *menu;
348 const char *basename; 348 const char *basename;
@@ -379,13 +379,6 @@ int conf_write(const char *name)
379 out = fopen(newname, "w"); 379 out = fopen(newname, "w");
380 if (!out) 380 if (!out)
381 return 1; 381 return 1;
382 out_h = NULL;
383 if (!name) {
384 out_h = fopen(".tmpconfig.h", "w");
385 if (!out_h)
386 return 1;
387 file_write_dep(NULL);
388 }
389 sym = sym_lookup("KERNELVERSION", 0); 382 sym = sym_lookup("KERNELVERSION", 0);
390 sym_calc_value(sym); 383 sym_calc_value(sym);
391 time(&now); 384 time(&now);
@@ -401,16 +394,6 @@ int conf_write(const char *name)
401 sym_get_string_value(sym), 394 sym_get_string_value(sym),
402 use_timestamp ? "# " : "", 395 use_timestamp ? "# " : "",
403 use_timestamp ? ctime(&now) : ""); 396 use_timestamp ? ctime(&now) : "");
404 if (out_h)
405 fprintf(out_h, "/*\n"
406 " * Automatically generated C config: don't edit\n"
407 " * Linux kernel version: %s\n"
408 "%s%s"
409 " */\n"
410 "#define AUTOCONF_INCLUDED\n",
411 sym_get_string_value(sym),
412 use_timestamp ? " * " : "",
413 use_timestamp ? ctime(&now) : "");
414 397
415 if (!sym_change_count) 398 if (!sym_change_count)
416 sym_clear_all_valid(); 399 sym_clear_all_valid();
@@ -426,11 +409,6 @@ int conf_write(const char *name)
426 "#\n" 409 "#\n"
427 "# %s\n" 410 "# %s\n"
428 "#\n", str); 411 "#\n", str);
429 if (out_h)
430 fprintf(out_h, "\n"
431 "/*\n"
432 " * %s\n"
433 " */\n", str);
434 } else if (!(sym->flags & SYMBOL_CHOICE)) { 412 } else if (!(sym->flags & SYMBOL_CHOICE)) {
435 sym_calc_value(sym); 413 sym_calc_value(sym);
436 if (!(sym->flags & SYMBOL_WRITE)) 414 if (!(sym->flags & SYMBOL_WRITE))
@@ -448,59 +426,39 @@ int conf_write(const char *name)
448 switch (sym_get_tristate_value(sym)) { 426 switch (sym_get_tristate_value(sym)) {
449 case no: 427 case no:
450 fprintf(out, "# CONFIG_%s is not set\n", sym->name); 428 fprintf(out, "# CONFIG_%s is not set\n", sym->name);
451 if (out_h)
452 fprintf(out_h, "#undef CONFIG_%s\n", sym->name);
453 break; 429 break;
454 case mod: 430 case mod:
455 fprintf(out, "CONFIG_%s=m\n", sym->name); 431 fprintf(out, "CONFIG_%s=m\n", sym->name);
456 if (out_h)
457 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
458 break; 432 break;
459 case yes: 433 case yes:
460 fprintf(out, "CONFIG_%s=y\n", sym->name); 434 fprintf(out, "CONFIG_%s=y\n", sym->name);
461 if (out_h)
462 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
463 break; 435 break;
464 } 436 }
465 break; 437 break;
466 case S_STRING: 438 case S_STRING:
467 // fix me
468 str = sym_get_string_value(sym); 439 str = sym_get_string_value(sym);
469 fprintf(out, "CONFIG_%s=\"", sym->name); 440 fprintf(out, "CONFIG_%s=\"", sym->name);
470 if (out_h) 441 while (1) {
471 fprintf(out_h, "#define CONFIG_%s \"", sym->name);
472 do {
473 l = strcspn(str, "\"\\"); 442 l = strcspn(str, "\"\\");
474 if (l) { 443 if (l) {
475 fwrite(str, l, 1, out); 444 fwrite(str, l, 1, out);
476 if (out_h) 445 str += l;
477 fwrite(str, l, 1, out_h);
478 }
479 str += l;
480 while (*str == '\\' || *str == '"') {
481 fprintf(out, "\\%c", *str);
482 if (out_h)
483 fprintf(out_h, "\\%c", *str);
484 str++;
485 } 446