int main(int ac, char **av) { char *mode; int res; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); conf_parse(av[1]); conf_read(NULL); mode = getenv("MENUCONFIG_MODE"); if (mode) { if (!strcasecmp(mode, "single_menu")) single_menu_mode = 1; } tcgetattr(1, &ios_org); atexit(conf_cleanup); init_wsize(); reset_dialog(); init_dialog(NULL); set_config_filename(conf_get_configname()); do { conf(&rootmenu); dialog_clear(); if (conf_get_changed()) res = dialog_yesno(NULL, _("Do you wish to save your " "new configuration?\n" "<ESC><ESC> to continue."), 6, 60); else res = -1; } while (res == KEY_ESC); end_dialog(); switch (res) { case 0: if (conf_write(filename)) { fprintf(stderr, _("\n\n" "Error during writing of the configuration.\n" "Your configuration changes were NOT saved." "\n\n")); return 1; } case -1: printf(_("\n\n" "*** End of configuration.\n" "\n\n")); break; default: fprintf(stderr, _("\n\n" "Your configuration changes were NOT saved." "\n\n")); } return 0; }
int main(int ac, char **av) { char *mode; int res; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); signal(SIGINT, sig_handler); conf_parse(av[1]); conf_read(NULL); mode = getenv("MENUCONFIG_MODE"); if (mode) { if (!strcasecmp(mode, "single_menu")) single_menu_mode = 1; } initscr(); getyx(stdscr, saved_y, saved_x); if (init_dialog(NULL)) { fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); return 1; } set_config_filename(conf_get_configname()); do { conf(&rootmenu); res = handle_exit(); } while (res == KEY_ESC); return res; }
int conf_read_simple(const char *name, int def, int sym_init) { FILE *in = NULL; char line[1024]; char *p, *p2; struct symbol *sym; int i, def_flags; if (name) { in = zconf_fopen(name); } else { struct property *prop; name = conf_get_configname(); in = zconf_fopen(name); if (in) goto load; sym_add_change_count(1); if (!sym_defconfig_list) { if (modules_sym) sym_calc_value(modules_sym); return 1; } for_all_defaults(sym_defconfig_list, prop) { if (expr_calc_value(prop->visible.expr) == no || prop->expr->type != E_SYMBOL) continue; name = conf_expand_value(prop->expr->left.sym->name); in = zconf_fopen(name); if (in) { conf_message(_("using defaults found in %s"), name); goto load; } } } if (!in) return 1; load: conf_filename = name; conf_lineno = 0; conf_warnings = 0; conf_unsaved = 0; def_flags = SYMBOL_DEF << def; if (!sym_init) goto readsym; for_all_symbols(i, sym) { sym->flags |= SYMBOL_CHANGED; sym->flags &= ~(def_flags|SYMBOL_VALID); if (sym_is_choice(sym)) sym->flags |= def_flags; switch (sym->type) { case S_INT: case S_HEX: case S_STRING: if (sym->def[def].val) free(sym->def[def].val); default: sym->def[def].val = NULL; sym->def[def].tri = no; } }
int main(int ac, char **av) { const char *progname = av[0]; int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { input_mode = (enum input_mode)opt; switch (opt) { case silentoldconfig: sync_kconfig = 1; break; case defconfig: case savedefconfig: defconfig_file = optarg; break; case randconfig: { struct timeval now; unsigned int seed; /* * Use microseconds derived seed, * compensate for systems where it may be zero */ gettimeofday(&now, NULL); seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); srand(seed); break; } case oldaskconfig: case oldconfig: case allnoconfig: case allyesconfig: case allmodconfig: case alldefconfig: case listnewconfig: case oldnoconfig: break; case '?': conf_usage(progname); exit(1); break; } } if (ac == optind) { printf(_("%s: Kconfig file missing\n"), av[0]); conf_usage(progname); exit(1); } name = av[optind]; conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { name = conf_get_configname(); if (stat(name, &tmpstat)) { fprintf(stderr, _("***\n" "*** Configuration file \"%s\" not found!\n" "***\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** \"make menuconfig\" or \"make xconfig\").\n" "***\n"), name); exit(1); } } switch (input_mode) { case defconfig: if (!defconfig_file) defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { printf(_("***\n" "*** Can't find default configuration \"%s\"!\n" "***\n"), defconfig_file); exit(1); } name = getenv("KCONFIG_SELINUX"); printf("KCONFIG_SELINUX(%s)\n", name); if (name) { if (conf_read_simple(name, S_DEF_USER, false)) { printf(_("***\n" "*** Can't find selinux configuration \"%s\"!\n" "***\n"), name); exit(1); } } name = getenv("KCONFIG_LOG_SELINUX"); printf("KCONFIG_LOG_SELINUX(%s)\n", name); if (name) { if (conf_read_simple(name, S_DEF_USER, false)) { printf(_("***\n" "*** Can't find selinux log configuration \"%s\"!\n" "***\n"), name); exit(1); } } name = getenv("KCONFIG_TIMA"); printf("KCONFIG_TIMA(%s)\n", name); if (name) { if (conf_read_simple(name, S_DEF_USER, false)) { printf(_("***\n" "*** Can't find tima log configuration \"%s\"!\n" "***\n"), name); exit(1); } } name = getenv("KCONFIG_VARIANT"); printf("KCONFIG_VARIANT(%s)\n", name); if (name) { if (conf_read_simple(name, S_DEF_USER, false)) { printf(_("***\n" "*** Can't find variant configuration \"%s\"!\n" "***\n"), name); exit(1); } } name = getenv("KCONFIG_DEBUG"); printf("KCONFIG_DEBUG(%s)\n", name); if (name) { if (conf_read_simple(name, S_DEF_USER, false)) { printf(_("***\n" "*** Can't find debug configuration \"%s\"!\n" "***\n"), name); exit(1); } } break; case savedefconfig: case silentoldconfig: case oldaskconfig: case oldconfig: case listnewconfig: case oldnoconfig: conf_read(NULL); break; case allnoconfig: case allyesconfig: case allmodconfig: case alldefconfig: case randconfig: name = getenv("KCONFIG_ALLCONFIG"); if (name && !stat(name, &tmpstat)) { conf_read_simple(name, S_DEF_USER, true); break; } switch (input_mode) { case allnoconfig: name = "allno.config"; break; case allyesconfig: name = "allyes.config"; break; case allmodconfig: name = "allmod.config"; break; case alldefconfig: name = "alldef.config"; break; case randconfig: name = "allrandom.config"; break; default: break; } if (!stat(name, &tmpstat)) conf_read_simple(name, S_DEF_USER, true); else if (!stat("all.config", &tmpstat)) conf_read_simple("all.config", S_DEF_USER, true); break; default: break; } if (sync_kconfig) { if (conf_get_changed()) { name = getenv("KCONFIG_NOSILENTUPDATE"); if (name && *name) { fprintf(stderr, _("\n*** The configuration requires explicit update.\n\n")); return 1; } } valid_stdin = isatty(0) && isatty(1) && isatty(2); } switch (input_mode) { case allnoconfig: conf_set_all_new_symbols(def_no); break; case allyesconfig: conf_set_all_new_symbols(def_yes); break; case allmodconfig: conf_set_all_new_symbols(def_mod); break; case alldefconfig: conf_set_all_new_symbols(def_default); break; case randconfig: conf_set_all_new_symbols(def_random); break; case defconfig: conf_set_all_new_symbols(def_default); break; case savedefconfig: break; case oldaskconfig: rootEntry = &rootmenu; conf(&rootmenu); input_mode = silentoldconfig; /* fall through */ case oldconfig: case listnewconfig: case oldnoconfig: case silentoldconfig: /* Update until a loop caused no more changes */ do { conf_cnt = 0; check_conf(&rootmenu); } while (conf_cnt && (input_mode != listnewconfig && input_mode != oldnoconfig)); break; } if (sync_kconfig) { /* silentoldconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ if (conf_get_changed() && conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); exit(1); } if (conf_write_autoconf()) { fprintf(stderr, _("\n*** Error during update of the configuration.\n\n")); return 1; } } else if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), defconfig_file); return 1; } } else if (input_mode != listnewconfig) { if (conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); exit(1); } } return 0; }
int main(int ac, char **av) { int saved_x, saved_y; char *mode; int res; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); conf_parse(av[1]); conf_read(NULL); mode = getenv("MENUCONFIG_MODE"); if (mode) { if (!strcasecmp(mode, "single_menu")) single_menu_mode = 1; } getyx(stdscr, saved_y, saved_x); if (init_dialog(NULL)) { fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); return 1; } set_config_filename(conf_get_configname()); do { conf(&rootmenu); dialog_clear(); if (conf_get_changed()) res = dialog_yesno(NULL, _("Do you wish to save your " "new configuration?\n" "<ESC><ESC> to continue."), 6, 60); else res = -1; } while (res == KEY_ESC); end_dialog(saved_x, saved_y); switch (res) { case 0: if (conf_write(filename)) { fprintf(stderr, _("\n\n" "Error during writing of the configuration.\n" "Your configuration changes were NOT saved." "\n\n")); return 1; } case -1: printf(_("\n\n" "*** End of configuration.\n" "*** Execute 'make' to build or try 'make help'." "\n\n")); break; default: fprintf(stderr, _("\n\n" "Your configuration changes were NOT saved." "\n\n")); } return conf_write_autoconf(); }
int main(int ac, char **av) { const char *progname = av[0]; int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; tty_stdio = isatty(0) && isatty(1); while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) { if (opt == 's') { conf_set_message_callback(NULL); continue; } input_mode = (enum input_mode)opt; switch (opt) { case syncconfig: sync_kconfig = 1; break; case defconfig: case savedefconfig: defconfig_file = optarg; break; case randconfig: { struct timeval now; unsigned int seed; char *seed_env; /* * Use microseconds derived seed, * compensate for systems where it may be zero */ gettimeofday(&now, NULL); seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); seed_env = getenv("KCONFIG_SEED"); if( seed_env && *seed_env ) { char *endp; int tmp = (int)strtol(seed_env, &endp, 0); if (*endp == '\0') { seed = tmp; } } fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed ); srand(seed); break; } case oldaskconfig: case oldconfig: case allnoconfig: case allyesconfig: case allmodconfig: case alldefconfig: case listnewconfig: case olddefconfig: break; case '?': conf_usage(progname); exit(1); break; } } if (ac == optind) { fprintf(stderr, "%s: Kconfig file missing\n", av[0]); conf_usage(progname); exit(1); } name = av[optind]; conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { name = conf_get_configname(); if (stat(name, &tmpstat)) { fprintf(stderr, "***\n" "*** Configuration file \"%s\" not found!\n" "***\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** \"make menuconfig\" or \"make xconfig\").\n" "***\n", name); exit(1); } } switch (input_mode) { case defconfig: if (!defconfig_file) defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { fprintf(stderr, "***\n" "*** Can't find default configuration \"%s\"!\n" "***\n", defconfig_file); exit(1); } break; case savedefconfig: case syncconfig: case oldaskconfig: case oldconfig: case listnewconfig: case olddefconfig: conf_read(NULL); break; case allnoconfig: case allyesconfig: case allmodconfig: case alldefconfig: case randconfig: name = getenv("KCONFIG_ALLCONFIG"); if (!name) break; if ((strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) { if (conf_read_simple(name, S_DEF_USER)) { fprintf(stderr, "*** Can't read seed configuration \"%s\"!\n", name); exit(1); } break; } switch (input_mode) { case allnoconfig: name = "allno.config"; break; case allyesconfig: name = "allyes.config"; break; case allmodconfig: name = "allmod.config"; break; case alldefconfig: name = "alldef.config"; break; case randconfig: name = "allrandom.config"; break; default: break; } if (conf_read_simple(name, S_DEF_USER) && conf_read_simple("all.config", S_DEF_USER)) { fprintf(stderr, "*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n", name); exit(1); } break; default: break; } if (sync_kconfig) { if (conf_get_changed()) { name = getenv("KCONFIG_NOSILENTUPDATE"); if (name && *name) { fprintf(stderr, "\n*** The configuration requires explicit update.\n\n"); return 1; } } } switch (input_mode) { case allnoconfig: conf_set_all_new_symbols(def_no); break; case allyesconfig: conf_set_all_new_symbols(def_yes); break; case allmodconfig: conf_set_all_new_symbols(def_mod); break; case alldefconfig: conf_set_all_new_symbols(def_default); break; case randconfig: /* Really nothing to do in this loop */ while (conf_set_all_new_symbols(def_random)) ; break; case defconfig: conf_set_all_new_symbols(def_default); break; case savedefconfig: break; case oldaskconfig: rootEntry = &rootmenu; conf(&rootmenu); input_mode = oldconfig; /* fall through */ case oldconfig: case listnewconfig: case syncconfig: /* Update until a loop caused no more changes */ do { conf_cnt = 0; check_conf(&rootmenu); } while (conf_cnt); break; case olddefconfig: default: break; } if (sync_kconfig) { /* syncconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ if (conf_get_changed() && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } if (conf_write_autoconf()) { fprintf(stderr, "\n*** Error during update of the configuration.\n\n"); return 1; } } else if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n", defconfig_file); return 1; } } else if (input_mode != listnewconfig) { if (conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } } return 0; }
int main(int ac, char **av) { int opt; const char *name; struct stat tmpstat; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); while ((opt = getopt(ac, av, "osbBdD:nmyrh")) != -1) { switch (opt) { case 'o': input_mode = ask_silent; break; case 's': input_mode = ask_silent; sync_kconfig = 1; break; case 'b': input_mode = dont_ask; break; case 'B': input_mode = dont_ask_dont_tell; break; case 'd': input_mode = set_default; break; case 'D': input_mode = set_default; defconfig_file = optarg; break; case 'n': input_mode = set_no; break; case 'm': input_mode = set_mod; break; case 'y': input_mode = set_yes; break; case 'r': { struct timeval now; unsigned int seed; /* * Use microseconds derived seed, * compensate for systems where it may be zero */ gettimeofday(&now, NULL); seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); srand(seed); input_mode = set_random; break; } case 'h': printf(_("See README for usage info\n")); exit(0); break; default: fprintf(stderr, _("See README for usage info\n")); exit(1); } } if (ac == optind) { printf(_("%s: Kconfig file missing\n"), av[0]); exit(1); } name = av[optind]; conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { name = conf_get_configname(); if (stat(name, &tmpstat)) { fprintf(stderr, _("***\n" "*** You have not yet configured your kernel!\n" "*** (missing kernel config file \"%s\")\n" "***\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** \"make menuconfig\" or \"make xconfig\").\n" "***\n"), name); exit(1); } } switch (input_mode) { case set_default: if (!defconfig_file) defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { printf(_("***\n" "*** Can't find default configuration \"%s\"!\n" "***\n"), defconfig_file); exit(1); } break; case ask_silent: case ask_all: case ask_new: case dont_ask: case dont_ask_dont_tell: conf_read(NULL); break; case set_no: case set_mod: case set_yes: case set_random: name = getenv("KCONFIG_ALLCONFIG"); if (name && !stat(name, &tmpstat)) { conf_read_simple(name, S_DEF_USER); break; } switch (input_mode) { case set_no: name = "allno.config"; break; case set_mod: name = "allmod.config"; break; case set_yes: name = "allyes.config"; break; case set_random: name = "allrandom.config"; break; default: break; } if (!stat(name, &tmpstat)) conf_read_simple(name, S_DEF_USER); else if (!stat("all.config", &tmpstat)) conf_read_simple("all.config", S_DEF_USER); break; default: break; } if (sync_kconfig) { if (conf_get_changed()) { name = getenv("KCONFIG_NOSILENTUPDATE"); if (name && *name) { fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); return 1; } } valid_stdin = isatty(0) && isatty(1) && isatty(2); } switch (input_mode) { case set_no: conf_set_all_new_symbols(def_no); break; case set_yes: conf_set_all_new_symbols(def_yes); break; case set_mod: conf_set_all_new_symbols(def_mod); break; case set_random: conf_set_all_new_symbols(def_random); break; case set_default: conf_set_all_new_symbols(def_default); break; case ask_new: case ask_all: rootEntry = &rootmenu; conf(&rootmenu); input_mode = ask_silent; /* fall through */ case dont_ask: case dont_ask_dont_tell: case ask_silent: /* Update until a loop caused no more changes */ do { conf_cnt = 0; check_conf(&rootmenu); } while (conf_cnt && (input_mode != dont_ask && input_mode != dont_ask_dont_tell)); break; } if (sync_kconfig) { /* silentoldconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ if (conf_get_changed() && conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); exit(1); } if (conf_write_autoconf()) { fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); return 1; } } else { if (conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); exit(1); } } return return_value; }
int main(int ac, char **av) { int opt; const char *name; struct stat tmpstat; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { input_mode = (enum input_mode)opt; switch (opt) { case silentoldconfig: sync_kconfig = 1; break; case defconfig: case savedefconfig: defconfig_file = optarg; break; case randconfig: { struct timeval now; unsigned int seed; /* * Use microseconds derived seed, * compensate for systems where it may be zero */ gettimeofday(&now, NULL); seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); srand(seed); break; } case '?': fprintf(stderr, _("See README for usage info\n")); exit(1); break; } } if (ac == optind) { printf(_("%s: Kconfig file missing\n"), av[0]); exit(1); } name = av[optind]; conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { name = conf_get_configname(); if (stat(name, &tmpstat)) { fprintf(stderr, _("***\n" "*** Configuration file \"%s\" not found!\n" "***\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** \"make menuconfig\" or \"make xconfig\").\n" "***\n"), name); exit(1); } } switch (input_mode) { case defconfig: if (!defconfig_file) defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { printf(_("***\n" "*** Can't find default configuration \"%s\"!\n" "***\n"), defconfig_file); exit(1); } break; case savedefconfig: case silentoldconfig: case oldaskconfig: case oldconfig: case listnewconfig: case oldnoconfig: conf_read(NULL); break; case allnoconfig: case allyesconfig: case allmodconfig: case alldefconfig: case randconfig: name = getenv("KCONFIG_ALLCONFIG"); if (name && !stat(name, &tmpstat)) { conf_read_simple(name, S_DEF_USER); break; } switch (input_mode) { case allnoconfig: name = "allno.config"; break; case allyesconfig: name = "allyes.config"; break; case allmodconfig: name = "allmod.config"; break; case alldefconfig: name = "alldef.config"; break; case randconfig: name = "allrandom.config"; break; default: break; } if (!stat(name, &tmpstat)) conf_read_simple(name, S_DEF_USER); else if (!stat("all.config", &tmpstat)) conf_read_simple("all.config", S_DEF_USER); break; default: break; } if (sync_kconfig) { if (conf_get_changed()) { name = getenv("KCONFIG_NOSILENTUPDATE"); if (name && *name) { fprintf(stderr, _("\n*** The configuration requires explicit update.\n\n")); return 1; } } valid_stdin = isatty(0) && isatty(1) && isatty(2); } switch (input_mode) { case allnoconfig: conf_set_all_new_symbols(def_no); break; case allyesconfig: conf_set_all_new_symbols(def_yes); break; case allmodconfig: conf_set_all_new_symbols(def_mod); break; case alldefconfig: conf_set_all_new_symbols(def_default); break; case randconfig: conf_set_all_new_symbols(def_random); break; case defconfig: conf_set_all_new_symbols(def_default); break; case savedefconfig: break; case oldaskconfig: rootEntry = &rootmenu; conf(&rootmenu); input_mode = silentoldconfig; /* fall through */ case oldconfig: case listnewconfig: case oldnoconfig: case silentoldconfig: /* Update until a loop caused no more changes */ do { conf_cnt = 0; check_conf(&rootmenu); } while (conf_cnt && (input_mode != listnewconfig && input_mode != oldnoconfig)); break; } if (sync_kconfig) { /* silentoldconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ if (conf_get_changed() && conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); exit(1); } if (conf_write_autoconf()) { fprintf(stderr, _("\n*** Error during update of the configuration.\n\n")); return 1; } } else if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), defconfig_file); return 1; } } else if (input_mode != listnewconfig) { if (conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); exit(1); } } /* This is for Intel Media SOC Gen3 Support, creates "include/linux/autoconf.h" link to be consistent with kernel versions earlier than 2.6.35 #ifdef CONFIG_ARCH_GEN3 */ if (access("include/linux/autoconf.h",0)&&(symlink("../generated/autoconf.h","include/linux/autoconf.h"))) { fprintf(stderr, _("\n*** can not symlink include/generated/autoconf.h to include/linux/autoconf.h.\n\n")); } return 0; }
/* write dependencies of the individual config-symbols */ static int write_make_deps(const char *name) { char *str; char dir[PATH_MAX+1], buf[PATH_MAX+1], buf2[PATH_MAX+1]; struct menu *menu; struct symbol *sym; struct property *prop, *p; unsigned done; const char * const name_tmp = "..make.deps.tmp"; FILE *out; if (!name) name = ".auto.deps"; strcpy(dir, conf_get_configname()); str = strrchr(dir, '/'); if (str) str[1] = 0; else dir[0] = 0; sprintf(buf, "%s%s", dir, name_tmp); out = fopen(buf, "w"); if (!out) return 1; fprintf(out, "# ATTENTION! This does not handle 'depends', just 'select'! \n" "# See support/kconfig/util.c write_make_deps()\n#\n"); menu = &rootmenu;//rootmenu.list; while (menu) { sym = menu->sym; if (!sym) { if (!menu_is_visible(menu)) goto next; } else if (!(sym->flags & SYMBOL_CHOICE)) { sym_calc_value(sym); if (sym->type == S_BOOLEAN && sym_get_tristate_value(sym) != no) { done = 0; for_all_prompts(sym, prop) { struct expr *e; //printf("\nname=%s\n", sym->name); for_all_properties(sym, p, P_SELECT) { e = p->expr; if (e && e->left.sym->name) { if (!done) { fprintf(out, "%s: $(BASE_TARGETS)", br2_symbol_printer(sym->name)); done = 1; } //printf("SELECTS %s\n",e->left.sym->name); fprintf(out, " %s",br2_symbol_printer(e->left.sym->name)); } } if (done) fprintf(out, "\n"); #if 0 e = sym->rev_dep.expr; if (e && e->type == E_SYMBOL && e->left.sym->name) { fprintf(out, "%s: %s", br2_symbol_printer(e->left.sym->name), br2_symbol_printer(sym->name)); printf("%s is Selected BY: %s", sym->name, e->left.sym->name); } #endif } }
/* write a dependency file as used by kbuild to track dependencies */ int file_write_dep(const char *name) { char *str; char buf[PATH_MAX+1], buf2[PATH_MAX+1], dir[PATH_MAX+1]; struct symbol *sym, *env_sym; struct expr *e; struct file *file; FILE *out; if (!name) name = ".kconfig.d"; strcpy(dir, conf_get_configname()); str = strrchr(dir, '/'); if (str) str[1] = 0; else dir[0] = 0; sprintf(buf, "%s..config.tmp", dir); out = fopen(buf, "w"); if (!out) return 1; fprintf(out, "deps_config := \\\n"); for (file = file_list; file; file = file->next) { if (file->next) fprintf(out, "\t%s \\\n", file->name); else fprintf(out, "\t%s\n", file->name); } fprintf(out, "\n%s: \\\n" "\t$(deps_config)\n\n", conf_get_autoconfig_name()); expr_list_for_each_sym(sym_env_list, e, sym) { struct property *prop; const char *value; prop = sym_get_env_prop(sym); env_sym = prop_get_symbol(prop); if (!env_sym) continue; value = getenv(env_sym->name); if (!value) value = ""; fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name()); fprintf(out, "endif\n"); } fprintf(out, "\n$(deps_config): ;\n"); fclose(out); //hzj if('/'==name[0]){ sprintf(buf2,"%s",name); }else{ sprintf(buf2, "%s%s", dir, name); } rename(buf, buf2); return 0; }