don't generate .tmpconfig.h and .kconfig.d
SVN-Revision: 5071
This commit is contained in:
parent
0d9ddef0e8
commit
54fda00db6
|
@ -352,7 +352,7 @@ int conf_read(const char *name)
|
||||||
|
|
||||||
int conf_write(const char *name)
|
int conf_write(const char *name)
|
||||||
{
|
{
|
||||||
FILE *out, *out_h;
|
FILE *out;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
const char *basename;
|
const char *basename;
|
||||||
|
@ -389,12 +389,6 @@ int conf_write(const char *name)
|
||||||
out = fopen(newname, "w");
|
out = fopen(newname, "w");
|
||||||
if (!out)
|
if (!out)
|
||||||
return 1;
|
return 1;
|
||||||
out_h = NULL;
|
|
||||||
if (!name) {
|
|
||||||
out_h = fopen(".tmpconfig.h", "w");
|
|
||||||
if (!out_h)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
sym = sym_lookup("OPENWRTVERSION", 0);
|
sym = sym_lookup("OPENWRTVERSION", 0);
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
time(&now);
|
time(&now);
|
||||||
|
@ -410,16 +404,6 @@ int conf_write(const char *name)
|
||||||
sym_get_string_value(sym),
|
sym_get_string_value(sym),
|
||||||
use_timestamp ? "# " : "",
|
use_timestamp ? "# " : "",
|
||||||
use_timestamp ? ctime(&now) : "");
|
use_timestamp ? ctime(&now) : "");
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "/*\n"
|
|
||||||
" * Automatically generated C config: don't edit\n"
|
|
||||||
" * OpenWrt version: %s\n"
|
|
||||||
"%s%s"
|
|
||||||
" */\n"
|
|
||||||
"#define AUTOCONF_INCLUDED\n",
|
|
||||||
sym_get_string_value(sym),
|
|
||||||
use_timestamp ? " * " : "",
|
|
||||||
use_timestamp ? ctime(&now) : "");
|
|
||||||
|
|
||||||
if (!sym_change_count)
|
if (!sym_change_count)
|
||||||
sym_clear_all_valid();
|
sym_clear_all_valid();
|
||||||
|
@ -435,11 +419,6 @@ int conf_write(const char *name)
|
||||||
"#\n"
|
"#\n"
|
||||||
"# %s\n"
|
"# %s\n"
|
||||||
"#\n", str);
|
"#\n", str);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "\n"
|
|
||||||
"/*\n"
|
|
||||||
" * %s\n"
|
|
||||||
" */\n", str);
|
|
||||||
} else if (!(sym->flags & SYMBOL_CHOICE)) {
|
} else if (!(sym->flags & SYMBOL_CHOICE)) {
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
if (!(sym->flags & SYMBOL_WRITE))
|
if (!(sym->flags & SYMBOL_WRITE))
|
||||||
|
@ -460,18 +439,12 @@ int conf_write(const char *name)
|
||||||
switch (sym_get_tristate_value(sym)) {
|
switch (sym_get_tristate_value(sym)) {
|
||||||
case no:
|
case no:
|
||||||
fprintf(out, "# CONFIG_%s is not set\n", sym->name);
|
fprintf(out, "# CONFIG_%s is not set\n", sym->name);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "#undef CONFIG_%s\n", sym->name);
|
|
||||||
break;
|
break;
|
||||||
case mod:
|
case mod:
|
||||||
fprintf(out, "CONFIG_%s=m\n", sym->name);
|
fprintf(out, "CONFIG_%s=m\n", sym->name);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
|
|
||||||
break;
|
break;
|
||||||
case yes:
|
case yes:
|
||||||
fprintf(out, "CONFIG_%s=y\n", sym->name);
|
fprintf(out, "CONFIG_%s=y\n", sym->name);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -479,40 +452,28 @@ int conf_write(const char *name)
|
||||||
// fix me
|
// fix me
|
||||||
str = sym_get_string_value(sym);
|
str = sym_get_string_value(sym);
|
||||||
fprintf(out, "CONFIG_%s=\"", sym->name);
|
fprintf(out, "CONFIG_%s=\"", sym->name);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "#define CONFIG_%s \"", sym->name);
|
|
||||||
do {
|
do {
|
||||||
l = strcspn(str, "\"\\");
|
l = strcspn(str, "\"\\");
|
||||||
if (l) {
|
if (l) {
|
||||||
fwrite(str, l, 1, out);
|
fwrite(str, l, 1, out);
|
||||||
if (out_h)
|
|
||||||
fwrite(str, l, 1, out_h);
|
|
||||||
}
|
}
|
||||||
str += l;
|
str += l;
|
||||||
while (*str == '\\' || *str == '"') {
|
while (*str == '\\' || *str == '"') {
|
||||||
fprintf(out, "\\%c", *str);
|
fprintf(out, "\\%c", *str);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "\\%c", *str);
|
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
} while (*str);
|
} while (*str);
|
||||||
fputs("\"\n", out);
|
fputs("\"\n", out);
|
||||||
if (out_h)
|
|
||||||
fputs("\"\n", out_h);
|
|
||||||
break;
|
break;
|
||||||
case S_HEX:
|
case S_HEX:
|
||||||
str = sym_get_string_value(sym);
|
str = sym_get_string_value(sym);
|
||||||
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
|
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
|
||||||
fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
|
fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case S_INT:
|
case S_INT:
|
||||||
str = sym_get_string_value(sym);
|
str = sym_get_string_value(sym);
|
||||||
fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
|
fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
|
||||||
if (out_h)
|
|
||||||
fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,11 +493,6 @@ int conf_write(const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(out);
|
fclose(out);
|
||||||
if (out_h) {
|
|
||||||
fclose(out_h);
|
|
||||||
rename(".tmpconfig.h", "include/linux/autoconf.h");
|
|
||||||
file_write_dep(NULL);
|
|
||||||
}
|
|
||||||
if (!name || basename != conf_def_filename) {
|
if (!name || basename != conf_def_filename) {
|
||||||
if (!name)
|
if (!name)
|
||||||
name = conf_def_filename;
|
name = conf_def_filename;
|
||||||
|
|
|
@ -26,31 +26,6 @@ struct file *file_lookup(const char *name)
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write a dependency file as used by kbuild to track dependencies */
|
|
||||||
int file_write_dep(const char *name)
|
|
||||||
{
|
|
||||||
struct file *file;
|
|
||||||
FILE *out;
|
|
||||||
|
|
||||||
if (!name)
|
|
||||||
name = ".kconfig.d";
|
|
||||||
out = fopen("..config.tmp", "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.config include/linux/autoconf.h: $(deps_config)\n\n$(deps_config):\n");
|
|
||||||
fclose(out);
|
|
||||||
rename("..config.tmp", name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Allocate initial growable sting */
|
/* Allocate initial growable sting */
|
||||||
struct gstr str_new(void)
|
struct gstr str_new(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue