2010-08-21 15:59:10 +02:00
|
|
|
---
|
2010-08-21 17:00:49 +02:00
|
|
|
conf.c | 1
|
2011-02-02 14:59:18 +01:00
|
|
|
confdata.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++---------------
|
2010-08-21 17:00:49 +02:00
|
|
|
util.c | 16 +++++++++++++--
|
2011-02-02 14:59:18 +01:00
|
|
|
3 files changed, 61 insertions(+), 18 deletions(-)
|
2010-08-21 15:59:10 +02:00
|
|
|
|
2013-04-04 13:24:24 +02:00
|
|
|
Index: b/conf.c
|
2010-08-21 15:59:10 +02:00
|
|
|
===================================================================
|
2013-04-04 13:24:24 +02:00
|
|
|
--- a/conf.c
|
|
|
|
+++ b/conf.c
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -558,7 +558,6 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
}
|
|
|
|
name = av[optind];
|
|
|
|
conf_parse(name);
|
|
|
|
- //zconfdump(stdout);
|
|
|
|
if (sync_kconfig) {
|
2010-08-21 17:00:49 +02:00
|
|
|
name = conf_get_configname();
|
|
|
|
if (stat(name, &tmpstat)) {
|
2013-04-04 13:24:24 +02:00
|
|
|
Index: b/confdata.c
|
2010-08-21 15:59:10 +02:00
|
|
|
===================================================================
|
2013-04-04 13:24:24 +02:00
|
|
|
--- a/confdata.c
|
|
|
|
+++ b/confdata.c
|
2013-10-29 22:53:32 +01:00
|
|
|
@@ -13,6 +13,7 @@
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
+#include <libgen.h>
|
|
|
|
|
|
|
|
#include "lkc.h"
|
|
|
|
|
|
|
|
@@ -70,9 +71,7 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
|
2010-08-21 17:00:49 +02:00
|
|
|
const char *conf_get_autoconfig_name(void)
|
|
|
|
{
|
|
|
|
- char *name = getenv("KCONFIG_AUTOCONFIG");
|
|
|
|
-
|
|
|
|
- return name ? name : "include/config/auto.conf";
|
2010-08-21 15:59:10 +02:00
|
|
|
+ return getenv("KCONFIG_AUTOCONFIG");
|
2010-08-21 17:00:49 +02:00
|
|
|
}
|
|
|
|
|
2010-08-21 15:59:10 +02:00
|
|
|
static char *conf_expand_value(const char *in)
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -742,6 +741,9 @@
|
2012-01-13 12:48:28 +01:00
|
|
|
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
|
2010-08-21 15:59:10 +02:00
|
|
|
char *env;
|
|
|
|
|
|
|
|
+ if (!name)
|
|
|
|
+ name = conf_get_configname();
|
|
|
|
+
|
|
|
|
dirname[0] = 0;
|
|
|
|
if (name && name[0]) {
|
|
|
|
struct stat st;
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -836,6 +838,7 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
{
|
2010-08-21 17:00:49 +02:00
|
|
|
const char *name;
|
2011-02-02 11:48:58 +01:00
|
|
|
char path[PATH_MAX+1];
|
2010-08-21 15:59:10 +02:00
|
|
|
+ char *opwd, *dir, *_name;
|
|
|
|
char *s, *d, c;
|
|
|
|
struct symbol *sym;
|
|
|
|
struct stat sb;
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -844,8 +847,20 @@
|
2010-08-21 17:00:49 +02:00
|
|
|
name = conf_get_autoconfig_name();
|
2010-08-21 15:59:10 +02:00
|
|
|
conf_read_simple(name, S_DEF_AUTO);
|
|
|
|
|
|
|
|
- if (chdir("include/config"))
|
2010-08-21 17:00:49 +02:00
|
|
|
- return 1;
|
2010-08-21 15:59:10 +02:00
|
|
|
+ opwd = malloc(256);
|
|
|
|
+ _name = strdup(name);
|
|
|
|
+ if (opwd == NULL || _name == NULL)
|
2010-08-21 17:00:49 +02:00
|
|
|
+ return 1;
|
2010-08-21 15:59:10 +02:00
|
|
|
+ opwd = getcwd(opwd, 256);
|
|
|
|
+ dir = dirname(_name);
|
|
|
|
+ if (dir == NULL) {
|
|
|
|
+ res = 1;
|
|
|
|
+ goto err;
|
|
|
|
+ }
|
|
|
|
+ if (chdir(dir)) {
|
|
|
|
+ res = 1;
|
|
|
|
+ goto err;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
res = 0;
|
|
|
|
for_all_symbols(i, sym) {
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -938,9 +953,11 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
- if (chdir("../.."))
|
|
|
|
- return 1;
|
|
|
|
-
|
|
|
|
+ if (chdir(opwd))
|
|
|
|
+ res = 1;
|
|
|
|
+err:
|
|
|
|
+ free(opwd);
|
|
|
|
+ free(_name);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -950,25 +967,38 @@
|
2012-01-13 12:48:28 +01:00
|
|
|
const char *name;
|
2010-08-21 17:00:49 +02:00
|
|
|
FILE *out, *tristate, *out_h;
|
|
|
|
int i;
|
2010-08-21 15:59:10 +02:00
|
|
|
+ char dir[PATH_MAX+1], buf[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();
|
|
|
|
|
|
|
|
- file_write_dep("include/config/auto.conf.cmd");
|
|
|
|
+ sprintf(buf, "%s.config.cmd", dir);
|
|
|
|
+ file_write_dep(buf);
|
|
|
|
|
|
|
|
if (conf_split_config())
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
- out = fopen(".tmpconfig", "w");
|
|
|
|
+ sprintf(buf, "%s.tmpconfig", dir);
|
|
|
|
+ out = fopen(buf, "w");
|
|
|
|
if (!out)
|
|
|
|
return 1;
|
|
|
|
|
2010-08-21 17:00:49 +02:00
|
|
|
- tristate = fopen(".tmpconfig_tristate", "w");
|
|
|
|
+ sprintf(buf, "%s.tmpconfig_tristate", dir);
|
|
|
|
+ tristate = fopen(buf, "w");
|
|
|
|
if (!tristate) {
|
|
|
|
fclose(out);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-08-21 15:59:10 +02:00
|
|
|
- out_h = fopen(".tmpconfig.h", "w");
|
|
|
|
+ sprintf(buf, "%s.tmpconfig.h", dir);
|
|
|
|
+ out_h = fopen(buf, "w");
|
|
|
|
if (!out_h) {
|
|
|
|
fclose(out);
|
2010-08-21 17:00:49 +02:00
|
|
|
fclose(tristate);
|
2013-11-14 00:53:35 +01:00
|
|
|
@@ -1000,19 +1030,22 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
name = getenv("KCONFIG_AUTOHEADER");
|
|
|
|
if (!name)
|
2010-08-21 17:00:49 +02:00
|
|
|
name = "include/generated/autoconf.h";
|
2010-08-21 15:59:10 +02:00
|
|
|
- if (rename(".tmpconfig.h", name))
|
|
|
|
+ sprintf(buf, "%s.tmpconfig.h", dir);
|
|
|
|
+ if (rename(buf, name))
|
|
|
|
return 1;
|
2010-08-21 17:00:49 +02:00
|
|
|
name = getenv("KCONFIG_TRISTATE");
|
|
|
|
if (!name)
|
|
|
|
name = "include/config/tristate.conf";
|
|
|
|
- if (rename(".tmpconfig_tristate", name))
|
|
|
|
+ sprintf(buf, "%s.tmpconfig_tristate", dir);
|
|
|
|
+ if (rename(buf, name))
|
|
|
|
return 1;
|
|
|
|
name = conf_get_autoconfig_name();
|
2010-08-21 15:59:10 +02:00
|
|
|
/*
|
|
|
|
* 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))
|
|
|
|
+ sprintf(buf, "%s.tmpconfig", dir);
|
|
|
|
+ if (rename(buf, name))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
2013-04-04 13:24:24 +02:00
|
|
|
Index: b/util.c
|
2010-08-21 15:59:10 +02:00
|
|
|
===================================================================
|
2013-04-04 13:24:24 +02:00
|
|
|
--- a/util.c
|
|
|
|
+++ b/util.c
|
|
|
|
@@ -34,6 +34,8 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
/* write a dependency file as used by kbuild to track dependencies */
|
|
|
|
int file_write_dep(const char *name)
|
|
|
|
{
|
|
|
|
+ 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;
|
2013-04-04 13:24:24 +02:00
|
|
|
@@ -41,7 +43,16 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
|
|
|
|
if (!name)
|
|
|
|
name = ".kconfig.d";
|
|
|
|
- out = fopen("..config.tmp", "w");
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
fprintf(out, "deps_config := \\\n");
|
2013-04-04 13:24:24 +02:00
|
|
|
@@ -72,7 +83,8 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
|
|
|
|
fprintf(out, "\n$(deps_config): ;\n");
|
|
|
|
fclose(out);
|
|
|
|
- rename("..config.tmp", name);
|
|
|
|
+ sprintf(buf2, "%s%s", dir, name);
|
|
|
|
+ rename(buf, buf2);
|
2012-01-13 12:48:28 +01:00
|
|
|
return 0;
|
2010-08-21 15:59:10 +02:00
|
|
|
}
|
|
|
|
|