aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/util/kconfig/util.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2008-08-08 07:56:07 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2008-08-08 07:56:07 +0000
commite55b32ab627bac2108efb4a3d5b924e00ff60af9 (patch)
treecd42e58d2102370e476ddff38a4b61b3d7556601 /payloads/libpayload/util/kconfig/util.c
parentdc93affe72b4e3162fde653da5c0ea0c84bd5e39 (diff)
Update the kconfig copy in libpayload to a much more recent one. Among
other things this supposedly also fixes a number of build issues on Mac OS X. This is more or less the same version (i.e. equally recent) as we have in coreinfo and buildrom now. This patch also includes the libintl.h fix from r3475 (coreinfo). Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3482 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/util/kconfig/util.c')
-rw-r--r--payloads/libpayload/util/kconfig/util.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/payloads/libpayload/util/kconfig/util.c b/payloads/libpayload/util/kconfig/util.c
index aea8d56ce4..a47d5e0fdc 100644
--- a/payloads/libpayload/util/kconfig/util.c
+++ b/payloads/libpayload/util/kconfig/util.c
@@ -29,6 +29,8 @@ struct file *file_lookup(const char *name)
/* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name)
{
+ struct symbol *sym, *env_sym;
+ struct expr *e;
struct file *file;
FILE *out;
@@ -44,7 +46,26 @@ int file_write_dep(const char *name)
else
fprintf(out, "\t%s\n", file->name);
}
- fprintf(out, "\n.config include/autoconf.h: $(deps_config)\n\n$(deps_config):\n");
+ fprintf(out, "\nbuild/auto.conf: \\\n"
+ "\t$(deps_config)\n\n");
+
+ 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, "build/auto.conf: FORCE\n");
+ fprintf(out, "endif\n");
+ }
+
+ fprintf(out, "\n$(deps_config): ;\n");
fclose(out);
rename("..config.tmp", name);
return 0;
@@ -82,12 +103,15 @@ void str_free(struct gstr *gs)
/* Append to growable string */
void str_append(struct gstr *gs, const char *s)
{
- size_t l = strlen(gs->s) + strlen(s) + 1;
- if (l > gs->len) {
- gs->s = realloc(gs->s, l);
- gs->len = l;
+ size_t l;
+ if (s) {
+ l = strlen(gs->s) + strlen(s) + 1;
+ if (l > gs->len) {
+ gs->s = realloc(gs->s, l);
+ gs->len = l;
+ }
+ strcat(gs->s, s);
}
- strcat(gs->s, s);
}
/* Append printf formatted string to growable string */