Revert "Kconfig stop creating empty header files."
This reverts commit 5e56c21dfae2e08253820f7fcad1e96be009ca89. Change-Id: Ie4e0c2afe27937206230e5574c41e5a4a4c3d616 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
fda70d2130
commit
0180a63d62
1 changed files with 115 additions and 0 deletions
|
@ -832,6 +832,118 @@ next:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int conf_split_config(void)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
char path[PATH_MAX+1];
|
||||||
|
char *s, *d, c;
|
||||||
|
struct symbol *sym;
|
||||||
|
struct stat sb;
|
||||||
|
int res, i, fd;
|
||||||
|
|
||||||
|
name = conf_get_autoconfig_name();
|
||||||
|
conf_read_simple(name, S_DEF_AUTO);
|
||||||
|
|
||||||
|
if (chdir("include/config"))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
res = 0;
|
||||||
|
for_all_symbols(i, sym) {
|
||||||
|
sym_calc_value(sym);
|
||||||
|
if ((sym->flags & SYMBOL_AUTO) || !sym->name)
|
||||||
|
continue;
|
||||||
|
if (sym->flags & SYMBOL_WRITE) {
|
||||||
|
if (sym->flags & SYMBOL_DEF_AUTO) {
|
||||||
|
/*
|
||||||
|
* symbol has old and new value,
|
||||||
|
* so compare them...
|
||||||
|
*/
|
||||||
|
switch (sym->type) {
|
||||||
|
case S_BOOLEAN:
|
||||||
|
case S_TRISTATE:
|
||||||
|
if (sym_get_tristate_value(sym) ==
|
||||||
|
sym->def[S_DEF_AUTO].tri)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case S_STRING:
|
||||||
|
case S_HEX:
|
||||||
|
case S_INT:
|
||||||
|
if (!strcmp(sym_get_string_value(sym),
|
||||||
|
sym->def[S_DEF_AUTO].val))
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If there is no old value, only 'no' (unset)
|
||||||
|
* is allowed as new value.
|
||||||
|
*/
|
||||||
|
switch (sym->type) {
|
||||||
|
case S_BOOLEAN:
|
||||||
|
case S_TRISTATE:
|
||||||
|
if (sym_get_tristate_value(sym) == no)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!(sym->flags & SYMBOL_DEF_AUTO))
|
||||||
|
/* There is neither an old nor a new value. */
|
||||||
|
continue;
|
||||||
|
/* else
|
||||||
|
* There is an old value, but no new value ('no' (unset)
|
||||||
|
* isn't saved in auto.conf, so the old value is always
|
||||||
|
* different from 'no').
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Replace all '_' and append ".h" */
|
||||||
|
s = sym->name;
|
||||||
|
d = path;
|
||||||
|
while ((c = *s++)) {
|
||||||
|
c = tolower(c);
|
||||||
|
*d++ = (c == '_') ? '/' : c;
|
||||||
|
}
|
||||||
|
strcpy(d, ".h");
|
||||||
|
|
||||||
|
/* Assume directory path already exists. */
|
||||||
|
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
|
if (fd == -1) {
|
||||||
|
if (errno != ENOENT) {
|
||||||
|
res = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Create directory components,
|
||||||
|
* unless they exist already.
|
||||||
|
*/
|
||||||
|
d = path;
|
||||||
|
while ((d = strchr(d, '/'))) {
|
||||||
|
*d = 0;
|
||||||
|
if (stat(path, &sb) && mkdir(path, 0755)) {
|
||||||
|
res = 1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
*d++ = '/';
|
||||||
|
}
|
||||||
|
/* Try it again. */
|
||||||
|
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
|
if (fd == -1) {
|
||||||
|
res = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
out:
|
||||||
|
if (chdir("../.."))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
int conf_write_autoconf(void)
|
int conf_write_autoconf(void)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
@ -847,6 +959,9 @@ int conf_write_autoconf(void)
|
||||||
|
|
||||||
file_write_dep(name);
|
file_write_dep(name);
|
||||||
|
|
||||||
|
if (conf_split_config())
|
||||||
|
return 1;
|
||||||
|
|
||||||
out = fopen(".tmpconfig", "w");
|
out = fopen(".tmpconfig", "w");
|
||||||
if (!out)
|
if (!out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue