aboutsummaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorGravatar Will Wagner <willw@carallon.com>2010-01-11 12:28:50 +0000
committerGravatar Peter Korsgaard <jacmet@sunsite.dk>2010-06-21 22:06:00 +0200
commit39ca6d50d8d52a9c8cb252cffb23a9d6f0c2942d (patch)
tree1ca406285a3ceaba7141406355c504f26adc0092 /package
parent868ed55b45559fc0475270bd0d3fe4c3ec6b395f (diff)
downloadbuildroot-39ca6d50d8d52a9c8cb252cffb23a9d6f0c2942d.tar.gz
buildroot-39ca6d50d8d52a9c8cb252cffb23a9d6f0c2942d.tar.bz2
Move config files into output directory for out-of-tree build
Closes #1213 Signed-off-by: Will Wagner <will_wagner@carallon.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package')
-rw-r--r--package/config/.gitignore1
-rw-r--r--package/config/Makefile1
-rw-r--r--package/config/confdata.c53
-rw-r--r--package/config/lkc.h1
-rw-r--r--package/config/util.c33
5 files changed, 74 insertions, 15 deletions
diff --git a/package/config/.gitignore b/package/config/.gitignore
index 161a19adac..1ea18a233a 100644
--- a/package/config/.gitignore
+++ b/package/config/.gitignore
@@ -1,4 +1,3 @@
-/buildroot-config
/conf
/mconf
/qconf
diff --git a/package/config/Makefile b/package/config/Makefile
index a100850070..197c50026f 100644
--- a/package/config/Makefile
+++ b/package/config/Makefile
@@ -43,7 +43,6 @@ distclean: clean
$(Q)rm -f $(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \
$(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \
mconf .depend
- $(Q)rm -rf buildroot-config
FORCE:
.PHONY: FORCE clean distclean
diff --git a/package/config/confdata.c b/package/config/confdata.c
index 52199123aa..fe1fc2e8e6 100644
--- a/package/config/confdata.c
+++ b/package/config/confdata.c
@@ -423,8 +423,17 @@ int conf_write(const char *name)
basename = conf_get_configname();
} else
basename = name;
- } else
+ } else {
+ char *slash;
+
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);
env = getenv("KCONFIG_OVERWRITECONFIG");
@@ -688,19 +697,51 @@ int conf_write_autoconf(void)
FILE *out, *out_h;
time_t now;
int i, l;
+ char buf[PATH_MAX+1];
+ char buf2[PATH_MAX+1];
sym_clear_all_valid();
- file_write_dep(".config.cmd");
+ name = conf_get_configname();
+ 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);
+
+ 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())
return 1;
- out = fopen(".tmpconfig", "w");
+ memset(buf, 0, PATH_MAX+1);
+ 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");
if (!out)
return 1;
- out_h = fopen(".tmpconfig.h", "w");
+ out_h = fopen(buf2, "w");
if (!out_h) {
fclose(out);
return 1;
@@ -782,14 +823,14 @@ int conf_write_autoconf(void)
name = getenv("KCONFIG_AUTOHEADER");
if (!name)
name = "include/linux/autoconf.h";
- if (rename(".tmpconfig.h", name))
+ if (rename(buf2, name))
return 1;
name = conf_get_autoconfig_name();
/*
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
- if (rename(".tmpconfig", name))
+ if (rename(buf, name))
return 1;
return 0;
diff --git a/package/config/lkc.h b/package/config/lkc.h
index f379b0bf8c..e5661c0e85 100644
--- a/package/config/lkc.h
+++ b/package/config/lkc.h
@@ -102,6 +102,7 @@ void menu_set_type(int type);
/* util.c */
struct file *file_lookup(const char *name);
int file_write_dep(const char *name);
+int write_make_deps(const char *name);
struct gstr {
size_t len;
diff --git a/package/config/util.c b/package/config/util.c
index 42038385be..a1e9dea215 100644
--- a/package/config/util.c
+++ b/package/config/util.c
@@ -51,17 +51,26 @@ static char* br2_symbol_printer(const char * const in)
}
/* write dependencies of the infividual config-symbols */
-static int write_make_deps(const char *name)
+int write_make_deps(const char *name)
{
+ const char *str;
+ char buf[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";
- out = fopen(name_tmp, "w");
+
+ str = strrchr(name, '/');
+ memset(buf, 0, PATH_MAX+1);
+ if(str)
+ {
+ strncpy(buf, name, str - name + 1);
+ }
+ strcat(buf, "..make.deps.tmp");
+ out = fopen(buf, "w");
if (!out)
return 1;
fprintf(out, "# ATTENTION! This does not handle 'depends', just 'select'! \n"
@@ -120,7 +129,7 @@ next:
}
}
fclose(out);
- rename(name_tmp, name);
+ rename(buf, name);
printf(_("#\n"
"# make dependencies written to %s\n"
"# ATTENTION buildroot devels!\n"
@@ -132,6 +141,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];
struct symbol *sym, *env_sym;
struct expr *e;
struct file *file;
@@ -139,7 +150,16 @@ int file_write_dep(const char *name)
if (!name)
name = ".kconfig.d";
- out = fopen("..config.tmp", "w");
+
+ str = strrchr(name, '/');
+ memset(buf, 0, PATH_MAX+1);
+ if(str)
+ {
+ strncpy(buf, name, str - name + 1);
+ }
+ strcat(buf, "..config.tmp");
+
+ out = fopen(buf, "w");
if (!out)
return 1;
fprintf(out, "deps_config := \\\n");
@@ -170,8 +190,7 @@ int file_write_dep(const char *name)
fprintf(out, "\n$(deps_config): ;\n");
fclose(out);
- rename("..config.tmp", name);
- return write_make_deps(NULL);
+ rename(buf, name);
}