summaryrefslogtreecommitdiff
path: root/package/config/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'package/config/util.c')
-rw-r--r--package/config/util.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/package/config/util.c b/package/config/util.c
index a1e9dea21..c3821407d 100644
--- a/package/config/util.c
+++ b/package/config/util.c
@@ -51,25 +51,27 @@ static char* br2_symbol_printer(const char * const in)
}
/* 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 buf[PATH_MAX+1];
+ char *str;
+ char dir[PATH_MAX+1], buf[PATH_MAX+1], buf2[PATH_MAX+1];
struct menu *menu;
struct symbol *sym;
struct property *prop, *p;
unsigned done;
+ const char * const name_tmp = "..make.deps.tmp";
FILE *out;
if (!name)
name = ".auto.deps";
- str = strrchr(name, '/');
- memset(buf, 0, PATH_MAX+1);
- if(str)
- {
- strncpy(buf, name, str - name + 1);
- }
- strcat(buf, "..make.deps.tmp");
+ strcpy(dir, conf_get_configname());
+ str = strrchr(dir, '/');
+ if (str)
+ str[1] = 0;
+ else
+ dir[0] = 0;
+
+ sprintf(buf, "%s%s", dir, name_tmp);
out = fopen(buf, "w");
if (!out)
return 1;
@@ -129,7 +131,8 @@ next:
}
}
fclose(out);
- rename(buf, name);
+ sprintf(buf2, "%s%s", dir, name);
+ rename(buf, buf2);
printf(_("#\n"
"# make dependencies written to %s\n"
"# ATTENTION buildroot devels!\n"
@@ -141,8 +144,8 @@ next:
/* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name)
{
- const char *str;
- char buf[PATH_MAX+1];
+ char *str;
+ char buf[PATH_MAX+1], buf2[PATH_MAX+1], dir[PATH_MAX+1];
struct symbol *sym, *env_sym;
struct expr *e;
struct file *file;
@@ -151,14 +154,14 @@ int file_write_dep(const char *name)
if (!name)
name = ".kconfig.d";
- str = strrchr(name, '/');
- memset(buf, 0, PATH_MAX+1);
- if(str)
- {
- strncpy(buf, name, str - name + 1);
- }
- strcat(buf, "..config.tmp");
+ strcpy(dir, conf_get_configname());
+ str = strrchr(dir, '/');
+ if (str)
+ str[1] = 0;
+ else
+ dir[0] = 0;
+ sprintf(buf, "%s..config.tmp", dir);
out = fopen(buf, "w");
if (!out)
return 1;
@@ -190,7 +193,9 @@ int file_write_dep(const char *name)
fprintf(out, "\n$(deps_config): ;\n");
fclose(out);
- rename(buf, name);
+ sprintf(buf2, "%s%s", dir, name);
+ rename(buf, buf2);
+ return write_make_deps(NULL);
}