cleanup/simplify kconfig changes for O= builds

No functional change.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
Peter Korsgaard 2010-06-20 13:43:36 +02:00
parent 39ca6d50d8
commit b8cca06b50
3 changed files with 46 additions and 66 deletions

View File

@ -404,6 +404,9 @@ int conf_write(const char *name)
int use_timestamp = 1; int use_timestamp = 1;
char *env; char *env;
if (!name)
name = conf_get_configname();
dirname[0] = 0; dirname[0] = 0;
if (name && name[0]) { if (name && name[0]) {
struct stat st; struct stat st;
@ -423,17 +426,8 @@ int conf_write(const char *name)
basename = conf_get_configname(); basename = conf_get_configname();
} else } else
basename = name; basename = name;
} else { } else
char *slash;
basename = conf_get_configname(); basename = conf_get_configname();
if((slash = strrchr(basename, '/'))) {
int size = slash - basename + 1;
memcpy(dirname, basename, size);
dirname[size] = 0;
basename = slash + 1;
}
}
sprintf(newname, "%s%s", dirname, basename); sprintf(newname, "%s%s", dirname, basename);
env = getenv("KCONFIG_OVERWRITECONFIG"); env = getenv("KCONFIG_OVERWRITECONFIG");
@ -697,51 +691,31 @@ int conf_write_autoconf(void)
FILE *out, *out_h; FILE *out, *out_h;
time_t now; time_t now;
int i, l; int i, l;
char buf[PATH_MAX+1]; char dir[PATH_MAX+1], buf[PATH_MAX+1];
char buf2[PATH_MAX+1]; char *s;
strcpy(dir, conf_get_configname());
s = strrchr(dir, '/');
if (s)
s[1] = 0;
else
dir[0] = 0;
sym_clear_all_valid(); sym_clear_all_valid();
name = conf_get_configname(); sprintf(buf, "%s.config.cmd", dir);
str = strrchr(name, '/');
memset(buf, 0, PATH_MAX+1);
if(str)
{
strncpy(buf, name, str - name + 1);
}
strcat(buf, ".config.cmd");
file_write_dep(buf); file_write_dep(buf);
memset(buf, 0, PATH_MAX+1);
if(str)
{
strncpy(buf, name, str - name + 1);
}
strcat(buf, ".auto.deps");
write_make_deps(buf);
if (conf_split_config()) if (conf_split_config())
return 1; return 1;
memset(buf, 0, PATH_MAX+1); sprintf(buf, "%s.tmpconfig", dir);
if(str)
{
strncpy(buf, name, str - name + 1);
}
strcat(buf, ".tmpconfig");
memset(buf2, 0, PATH_MAX+1);
if(str)
{
strncpy(buf2, name, str - name + 1);
}
strcat(buf2, ".tmpconfig.h");
out = fopen(buf, "w"); out = fopen(buf, "w");
if (!out) if (!out)
return 1; return 1;
out_h = fopen(buf2, "w"); sprintf(buf, "%s.tmpconfig.h", dir);
out_h = fopen(buf, "w");
if (!out_h) { if (!out_h) {
fclose(out); fclose(out);
return 1; return 1;
@ -823,13 +797,15 @@ int conf_write_autoconf(void)
name = getenv("KCONFIG_AUTOHEADER"); name = getenv("KCONFIG_AUTOHEADER");
if (!name) if (!name)
name = "include/linux/autoconf.h"; name = "include/linux/autoconf.h";
if (rename(buf2, name)) sprintf(buf, "%s.tmpconfig.h", dir);
if (rename(buf, name))
return 1; return 1;
name = conf_get_autoconfig_name(); name = conf_get_autoconfig_name();
/* /*
* This must be the last step, kbuild has a dependency on auto.conf * This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps. * and this marks the successful completion of the previous steps.
*/ */
sprintf(buf, "%s.tmpconfig", dir);
if (rename(buf, name)) if (rename(buf, name))
return 1; return 1;

View File

@ -102,7 +102,6 @@ void menu_set_type(int type);
/* util.c */ /* util.c */
struct file *file_lookup(const char *name); struct file *file_lookup(const char *name);
int file_write_dep(const char *name); int file_write_dep(const char *name);
int write_make_deps(const char *name);
struct gstr { struct gstr {
size_t len; size_t len;

View File

@ -51,25 +51,27 @@ static char* br2_symbol_printer(const char * const in)
} }
/* write dependencies of the infividual config-symbols */ /* write dependencies of the infividual config-symbols */
int write_make_deps(const char *name) static int write_make_deps(const char *name)
{ {
const char *str; char *str;
char buf[PATH_MAX+1]; char dir[PATH_MAX+1], buf[PATH_MAX+1], buf2[PATH_MAX+1];
struct menu *menu; struct menu *menu;
struct symbol *sym; struct symbol *sym;
struct property *prop, *p; struct property *prop, *p;
unsigned done; unsigned done;
const char * const name_tmp = "..make.deps.tmp";
FILE *out; FILE *out;
if (!name) if (!name)
name = ".auto.deps"; name = ".auto.deps";
str = strrchr(name, '/'); strcpy(dir, conf_get_configname());
memset(buf, 0, PATH_MAX+1); str = strrchr(dir, '/');
if(str) if (str)
{ str[1] = 0;
strncpy(buf, name, str - name + 1); else
} dir[0] = 0;
strcat(buf, "..make.deps.tmp");
sprintf(buf, "%s%s", dir, name_tmp);
out = fopen(buf, "w"); out = fopen(buf, "w");
if (!out) if (!out)
return 1; return 1;
@ -129,7 +131,8 @@ next:
} }
} }
fclose(out); fclose(out);
rename(buf, name); sprintf(buf2, "%s%s", dir, name);
rename(buf, buf2);
printf(_("#\n" printf(_("#\n"
"# make dependencies written to %s\n" "# make dependencies written to %s\n"
"# ATTENTION buildroot devels!\n" "# ATTENTION buildroot devels!\n"
@ -141,8 +144,8 @@ next:
/* write a dependency file as used by kbuild to track dependencies */ /* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name) int file_write_dep(const char *name)
{ {
const char *str; char *str;
char buf[PATH_MAX+1]; char buf[PATH_MAX+1], buf2[PATH_MAX+1], dir[PATH_MAX+1];
struct symbol *sym, *env_sym; struct symbol *sym, *env_sym;
struct expr *e; struct expr *e;
struct file *file; struct file *file;
@ -151,14 +154,14 @@ int file_write_dep(const char *name)
if (!name) if (!name)
name = ".kconfig.d"; name = ".kconfig.d";
str = strrchr(name, '/'); strcpy(dir, conf_get_configname());
memset(buf, 0, PATH_MAX+1); str = strrchr(dir, '/');
if(str) if (str)
{ str[1] = 0;
strncpy(buf, name, str - name + 1); else
} dir[0] = 0;
strcat(buf, "..config.tmp");
sprintf(buf, "%s..config.tmp", dir);
out = fopen(buf, "w"); out = fopen(buf, "w");
if (!out) if (!out)
return 1; return 1;
@ -190,7 +193,9 @@ int file_write_dep(const char *name)
fprintf(out, "\n$(deps_config): ;\n"); fprintf(out, "\n$(deps_config): ;\n");
fclose(out); fclose(out);
rename(buf, name); sprintf(buf2, "%s%s", dir, name);
rename(buf, buf2);
return write_make_deps(NULL);
} }