diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2008-01-13 22:50:54 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2008-01-28 17:14:39 -0500 |
commit | 93449082e905ce73d0346d617dd67c4b668b58af (patch) | |
tree | eba7030f32ce18fa71562224ee2e0d8ddda33421 /scripts/kconfig/util.c | |
parent | 7a962923359768e04137125bd479fd0dfa6117d3 (diff) |
kconfig: environment symbol support
Add the possibility to import a value from the environment into kconfig
via the option syntax. Beside flexibility this has the advantage
providing proper dependencies.
Documented the options syntax.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/util.c')
-rw-r--r-- | scripts/kconfig/util.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index e1cad924c0a4..f8e73c039dc8 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -29,6 +29,8 @@ struct file *file_lookup(const char *name) | |||
29 | /* write a dependency file as used by kbuild to track dependencies */ | 29 | /* write a dependency file as used by kbuild to track dependencies */ |
30 | int file_write_dep(const char *name) | 30 | int file_write_dep(const char *name) |
31 | { | 31 | { |
32 | struct symbol *sym, *env_sym; | ||
33 | struct expr *e; | ||
32 | struct file *file; | 34 | struct file *file; |
33 | FILE *out; | 35 | FILE *out; |
34 | 36 | ||
@@ -45,8 +47,25 @@ int file_write_dep(const char *name) | |||
45 | fprintf(out, "\t%s\n", file->name); | 47 | fprintf(out, "\t%s\n", file->name); |
46 | } | 48 | } |
47 | fprintf(out, "\ninclude/config/auto.conf: \\\n" | 49 | fprintf(out, "\ninclude/config/auto.conf: \\\n" |
48 | "\t$(deps_config)\n\n" | 50 | "\t$(deps_config)\n\n"); |
49 | "$(deps_config): ;\n"); | 51 | |
52 | expr_list_for_each_sym(sym_env_list, e, sym) { | ||
53 | struct property *prop; | ||
54 | const char *value; | ||
55 | |||
56 | prop = sym_get_env_prop(sym); | ||
57 | env_sym = prop_get_symbol(prop); | ||
58 | if (!env_sym) | ||
59 | continue; | ||
60 | value = getenv(env_sym->name); | ||
61 | if (!value) | ||
62 | value = ""; | ||
63 | fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); | ||
64 | fprintf(out, "include/config/auto.conf: FORCE\n"); | ||
65 | fprintf(out, "endif\n"); | ||
66 | } | ||
67 | |||
68 | fprintf(out, "\n$(deps_config): ;\n"); | ||
50 | fclose(out); | 69 | fclose(out); |
51 | rename("..config.tmp", name); | 70 | rename("..config.tmp", name); |
52 | return 0; | 71 | return 0; |