From f987b7a54199cad8eed8b4fccfbe33478adf243a Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 8 Jul 2007 00:00:17 +0000 Subject: [PATCH] - silence a cosmetic warning (closes several issues in mantis). This also provides a nice up-to-date filestamp if something got reconfigured (e.g. c++ support got toggled) that can be used in the future to depend accordingly. --- Makefile | 43 +++++++++++----- package/config/confdata.c | 25 ++++++++-- package/config/kconfig-to-buildroot2.patch | 57 ++++++++++++++++++++++ 3 files changed, 109 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index c10f717737..38f1a6600a 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,7 @@ HOSTCC:=$(shell $(CONFIG_SHELL) which $(HOSTCC) || type -p $(HOSTCC) || echo gcc HOSTCXX:=$(shell $(CONFIG_SHELL) which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++) HOSTLD:=$(shell $(CONFIG_SHELL) which $(HOSTLD) || type -p $(HOSTLD) || echo ld) ifndef CFLAGS_FOR_BUILD -CFLAGS_FOR_BUILD:="-g -O2" +CFLAGS_FOR_BUILD:=-g -O2 endif export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD @@ -264,40 +264,61 @@ all: menuconfig # --------------------------------------------------------------------------- $(CONFIG)/conf: - $(MAKE) CC="$(HOSTCC)" CFLAGS=$(CFLAGS_FOR_BUILD) MAKECMDGOALS="$(MAKECMDGOALS)" \ + $(MAKE) CC="$(HOSTCC)" HOSTCFLAGS="$(CFLAGS_FOR_BUILD)" MAKECMDGOALS="$(MAKECMDGOALS)" \ -C $(CONFIG) conf -@if [ ! -f .config ] ; then \ cp $(CONFIG_DEFCONFIG) .config; \ fi $(CONFIG)/mconf: - $(MAKE) CC="$(HOSTCC)" CFLAGS=$(CFLAGS_FOR_BUILD) MAKECMDGOALS="$(MAKECMDGOALS)" \ + $(MAKE) CC="$(HOSTCC)" HOSTCFLAGS="$(CFLAGS_FOR_BUILD)" MAKECMDGOALS="$(MAKECMDGOALS)" \ -C $(CONFIG) conf mconf -@if [ ! -f .config ] ; then \ cp $(CONFIG_DEFCONFIG) .config; \ fi menuconfig: $(CONFIG)/mconf - @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/mconf $(CONFIG_CONFIG_IN) config: $(CONFIG)/conf - @$(CONFIG)/conf $(CONFIG_CONFIG_IN) + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/conf $(CONFIG_CONFIG_IN) oldconfig: $(CONFIG)/conf - @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/conf -o $(CONFIG_CONFIG_IN) randconfig: $(CONFIG)/conf - @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/conf -r $(CONFIG_CONFIG_IN) allyesconfig: $(CONFIG)/conf - cp $(CONFIG_DEFCONFIG) .config - @$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) + cat $(CONFIG_DEFCONFIG) > .config + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/conf -y $(CONFIG_CONFIG_IN) #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config allnoconfig: $(CONFIG)/conf - @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/conf -n $(CONFIG_CONFIG_IN) defconfig: $(CONFIG)/conf - @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) + @-mkdir -p include/config + @KCONFIG_AUTOCONFIG=include/config/auto.conf \ + KCONFIG_AUTOHEADER=include/autoconf.h \ + $(CONFIG)/conf -d $(CONFIG_CONFIG_IN) # check if download URLs are outdated source-check: allyesconfig diff --git a/package/config/confdata.c b/package/config/confdata.c index c19b6ffed4..0098a08ee7 100644 --- a/package/config/confdata.c +++ b/package/config/confdata.c @@ -11,6 +11,7 @@ #include #include #include +#include #define LKC_DIRECT_LINK #include "lkc.h" @@ -529,7 +530,7 @@ int conf_write(const char *name) int conf_split_config(void) { - char *name, path[128]; + char *name, path[128], *opwd, *dir, *_name; char *s, *d, c; struct symbol *sym; struct stat sb; @@ -540,8 +541,20 @@ int conf_split_config(void) name = "include/config/auto.conf"; conf_read_simple(name, S_DEF_AUTO); - if (chdir("include/config")) + opwd = malloc(256); + _name = strdup(name); + if (opwd == NULL || _name == NULL) return 1; + 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) { @@ -634,9 +647,11 @@ int conf_split_config(void) close(fd); } out: - if (chdir("../..")) - return 1; - + if (chdir(opwd)) + res = 1; +err: + free(opwd); + free(_name); return res; } diff --git a/package/config/kconfig-to-buildroot2.patch b/package/config/kconfig-to-buildroot2.patch index 94eae856ba..361174a572 100644 --- a/package/config/kconfig-to-buildroot2.patch +++ b/package/config/kconfig-to-buildroot2.patch @@ -667,3 +667,60 @@ Index: confdata.c if (conf_split_config()) return 1; +diff -rdup x/config/confdata.c package/config/confdata.c +--- x/config/confdata.c 2007-07-07 11:13:12.000000000 +0200 ++++ package/config/confdata.c 2007-07-08 01:30:44.000000000 +0200 +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #define LKC_DIRECT_LINK + #include "lkc.h" +@@ -529,7 +530,7 @@ int conf_write(const char *name) + + int conf_split_config(void) + { +- char *name, path[128]; ++ char *name, path[128], *opwd, *dir, *_name; + char *s, *d, c; + struct symbol *sym; + struct stat sb; +@@ -540,8 +541,20 @@ int conf_split_config(void) + name = "include/config/auto.conf"; + conf_read_simple(name, S_DEF_AUTO); + +- if (chdir("include/config")) ++ opwd = malloc(256); ++ _name = strdup(name); ++ if (opwd == NULL || _name == NULL) + return 1; ++ 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) { +@@ -634,9 +647,11 @@ int conf_split_config(void) + close(fd); + } + out: +- if (chdir("../..")) +- return 1; +- ++ if (chdir(opwd)) ++ res = 1; ++err: ++ free(opwd); ++ free(_name); + return res; + } + -- 2.30.2