From: Michael Olbrich Date: Mon, 1 Nov 2010 19:49:21 +0100 Subject: [PATCH] conf: add an option to output the dependency information Signed-off-by: Michael Olbrich --- scripts/kconfig/conf.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index d19944f..fb77365 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -34,6 +34,7 @@ enum input_mode { savedefconfig, listnewconfig, olddefconfig, + writedepend, } input_mode = oldaskconfig; static int indent = 1; @@ -446,6 +447,36 @@ static void check_conf(struct menu *menu) check_conf(child); } +static void create_dep_output() +{ + int i; + bool hit; + struct symbol *sym; + struct property *prop; + + for_all_symbols(i, sym) { + if ((sym_get_tristate_value(sym) == no) || !sym->name) + continue; + + hit = 0; + for (prop = sym->prop; prop; prop = prop->next) { + if (prop->type == P_SELECT && expr_calc_value(prop->visible.expr)) { + hit=1; + break; + } + } + if (!hit) + continue; + printf("DEP:%s", sym->name); + for (prop = sym->prop; prop; prop = prop->next) { + if (prop->type == P_SELECT && expr_calc_value(prop->visible.expr)) { + printf(":%s", prop->expr->left.sym->name); + } + } + printf("\n"); + } +} + static struct option long_opts[] = { {"oldaskconfig", no_argument, NULL, oldaskconfig}, {"oldconfig", no_argument, NULL, oldconfig}, @@ -465,6 +496,7 @@ static struct option long_opts[] = { * value but not 'n') with the counter-intuitive name. */ {"oldnoconfig", no_argument, NULL, olddefconfig}, + {"writedepend", no_argument, NULL, writedepend}, {NULL, 0, NULL, 0} }; @@ -494,6 +526,7 @@ int main(int ac, char **av) int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; + int dep_output = 0; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -504,6 +537,10 @@ int main(int ac, char **av) while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { input_mode = (enum input_mode)opt; switch (opt) { + case writedepend: + dep_output = 1; + input_mode = silentoldconfig; + break; case silentoldconfig: sync_kconfig = 1; break; @@ -680,6 +717,8 @@ int main(int ac, char **av) input_mode != olddefconfig)); break; } + if (dep_output) + create_dep_output(); if (sync_kconfig) { /* silentoldconfig is used during the build so we shall update autoconf.