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>
This commit is contained in:
Will Wagner 2010-01-11 12:28:50 +00:00 committed by Peter Korsgaard
parent 868ed55b45
commit 39ca6d50d8
7 changed files with 178 additions and 116 deletions

View File

@ -24,6 +24,7 @@
#401: new package: ffmpeg #401: new package: ffmpeg
#835: Package Dataflashboot-1.05 does not compile with buildroot... #835: Package Dataflashboot-1.05 does not compile with buildroot...
#1213: Move .config into output directory
#1753: lmbench: convert to generic package infrastructure #1753: lmbench: convert to generic package infrastructure
#1771: Fakeroot and the target/generic/device_table.txt create bad... #1771: Fakeroot and the target/generic/device_table.txt create bad...
#1807: LZMA 4.32.7, Required header file(s) are missing #1807: LZMA 4.32.7, Required header file(s) are missing

204
Makefile
View File

@ -43,10 +43,28 @@ comma:=,
empty:= empty:=
space:=$(empty) $(empty) space:=$(empty) $(empty)
ifneq ("$(origin O)", "command line")
O:=output
CONFIG_DIR:=$(TOPDIR)
else
# other packages might also support Linux-style out of tree builds
# with the O=<dir> syntax (E.G. Busybox does). As make automatically
# forwards command line variable definitions those packages get very
# confused. Fix this by telling make to not do so
MAKEOVERRIDES =
# strangely enough O is still passed to submakes with MAKEOVERRIDES
# (with make 3.81 atleast), the only thing that changes is the output
# of the origin function (command line -> environment).
# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
# To really make O go away, we have to override it.
override O:=$(O)
CONFIG_DIR:=$(O)
endif
# $(shell find . -name *_defconfig |sed 's/.*\///') # $(shell find . -name *_defconfig |sed 's/.*\///')
# Pull in the user's configuration file # Pull in the user's configuration file
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include .config -include $(CONFIG_DIR)/.config
endif endif
# Override BR2_DL_DIR if shell variable defined # Override BR2_DL_DIR if shell variable defined
@ -135,6 +153,16 @@ FCFLAGS_FOR_BUILD:=-g -O2
endif endif
export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
# bash prints the name of the directory on 'cd <dir>' if CDPATH is
# set, so unset it here to not cause problems. Notice that the export
# line doesn't affect the environment of $(shell ..) calls, so
# explictly throw away any output from 'cd' here.
export CDPATH:=
BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
BUILD_DIR:=$(BASE_DIR)/build
ifeq ($(BR2_HAVE_DOT_CONFIG),y) ifeq ($(BR2_HAVE_DOT_CONFIG),y)
@ -225,37 +253,11 @@ ZCAT:=$(call qstrip,$(BR2_ZCAT))
BZCAT:=$(call qstrip,$(BR2_BZCAT)) BZCAT:=$(call qstrip,$(BR2_BZCAT))
TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
ifneq ("$(origin O)", "command line")
O:=output
else
# other packages might also support Linux-style out of tree builds
# with the O=<dir> syntax (E.G. Busybox does). As make automatically
# forwards command line variable definitions those packages get very
# confused. Fix this by telling make to not do so
MAKEOVERRIDES =
# strangely enough O is still passed to submakes with MAKEOVERRIDES
# (with make 3.81 atleast), the only thing that changes is the output
# of the origin function (command line -> environment).
# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
# To really make O go away, we have to override it.
override O:=$(O)
endif
# bash prints the name of the directory on 'cd <dir>' if CDPATH is
# set, so unset it here to not cause problems. Notice that the export
# line doesn't affect the environment of $(shell ..) calls, so
# explictly throw away any output from 'cd' here.
export CDPATH:=
BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
DL_DIR=$(call qstrip,$(BR2_DL_DIR)) DL_DIR=$(call qstrip,$(BR2_DL_DIR))
ifeq ($(DL_DIR),) ifeq ($(DL_DIR),)
DL_DIR:=$(TOPDIR)/dl DL_DIR:=$(TOPDIR)/dl
endif endif
BUILD_DIR:=$(BASE_DIR)/build
GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX)) GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR)) STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR))
@ -285,7 +287,7 @@ include package/Makefile.in
all: world all: world
# In this section, we need .config # In this section, we need .config
include .config.cmd include $(CONFIG_DIR)/.config.cmd
# We also need the various per-package makefiles, which also add # We also need the various per-package makefiles, which also add
# each selected package to TARGETS if that package was selected # each selected package to TARGETS if that package was selected
@ -332,10 +334,10 @@ TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
# all targets depend on the crosscompiler and it's prerequisites # all targets depend on the crosscompiler and it's prerequisites
$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) % $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
$(BR2_DEPENDS_DIR): .config $(BR2_DEPENDS_DIR): $(CONFIG_DIR)/.config
rm -rf $@ # rm -rf $@
mkdir -p $(@D) # mkdir -p $(@D)
cp -dpRf $(CONFIG)/buildroot-config $@ # cp -dpRf $(CONFIG)/buildroot-config $@
dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
$(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
@ -443,7 +445,7 @@ show-targets:
ifeq ($(BR2_CONFIG_CACHE),y) ifeq ($(BR2_CONFIG_CACHE),y)
# drop configure cache if configuration is changed # drop configure cache if configuration is changed
$(BUILD_DIR)/tgt-config.cache: .config $(BUILD_DIR)/tgt-config.cache: $(CONFIG_DIR)/.config
rm -f $@ rm -f $@
touch $@ touch $@
@ -461,99 +463,99 @@ HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
export HOSTCFLAGS export HOSTCFLAGS
$(CONFIG)/%onf: $(CONFIG)/%onf:
mkdir -p $(CONFIG)/buildroot-config mkdir -p $(BUILD_DIR)/buildroot-config
$(MAKE) CC="$(HOSTCC)" -C $(CONFIG) $(notdir $@) $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) $(notdir $@)
-@if [ ! -f .config ]; then \ -@if [ ! -f $(CONFIG_DIR)/.config ]; then \
cp $(CONFIG_DEFCONFIG) .config; \ cp $(CONFIG_DEFCONFIG) $(CONFIG_DIR)/.config; \
fi fi
xconfig: $(CONFIG)/qconf xconfig: $(CONFIG)/qconf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @if ! KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/qconf $(CONFIG_CONFIG_IN); then \ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/qconf $(CONFIG_CONFIG_IN); then \
test -f .config.cmd || rm -f .config; \ test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \
fi fi
gconfig: $(CONFIG)/gconf gconfig: $(CONFIG)/gconf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @if ! KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/gconf $(CONFIG_CONFIG_IN); then \ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/gconf $(CONFIG_CONFIG_IN); then \
test -f .config.cmd || rm -f .config; \ test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \
fi fi
menuconfig: $(CONFIG)/mconf menuconfig: $(CONFIG)/mconf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @if ! KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
test -f .config.cmd || rm -f .config; \ test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \
fi fi
config: $(CONFIG)/conf config: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/conf $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf $(CONFIG_CONFIG_IN)
oldconfig: $(CONFIG)/conf oldconfig: $(CONFIG)/conf
mkdir -p $(CONFIG)/buildroot-config mkdir -p $(BUILD_DIR)/buildroot-config
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
randconfig: $(CONFIG)/conf randconfig: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
allyesconfig: $(CONFIG)/conf allyesconfig: $(CONFIG)/conf
cat $(CONFIG_DEFCONFIG) > .config cat $(CONFIG_DEFCONFIG) > $(CONFIG_DIR)/.config
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
allnoconfig: $(CONFIG)/conf allnoconfig: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
randpackageconfig: $(CONFIG)/conf randpackageconfig: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@grep -v BR2_PACKAGE_ .config > .config.nopkg @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
KCONFIG_ALLCONFIG=.config.nopkg \ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
@rm -f .config.nopkg @rm -f $(CONFIG_DIR)/.config.nopkg
allyespackageconfig: $(CONFIG)/conf allyespackageconfig: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@grep -v BR2_PACKAGE_ .config > .config.nopkg @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
KCONFIG_ALLCONFIG=.config.nopkg \ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
@rm -f .config.nopkg @rm -f $(CONFIG_DIR)/.config.nopkg
allnopackageconfig: $(CONFIG)/conf allnopackageconfig: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@grep -v BR2_PACKAGE_ .config > .config.nopkg @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
KCONFIG_ALLCONFIG=.config.nopkg \ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
@rm -f .config.nopkg @rm -f $(CONFIG_DIR)/.config.nopkg
defconfig: $(CONFIG)/conf defconfig: $(CONFIG)/conf
@mkdir -p $(CONFIG)/buildroot-config @mkdir -p $(BUILD_DIR)/buildroot-config
@KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
# check if download URLs are outdated # check if download URLs are outdated
source-check: allyesconfig source-check: allyesconfig
@ -577,15 +579,15 @@ endif
ifeq ($(O),output) ifeq ($(O),output)
rm -rf $(O) rm -rf $(O)
endif endif
rm -rf .config .config.old .config.cmd .auto.deps rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.config.cmd $(CONFIG_DIR)/.auto.deps
-$(MAKE) -C $(CONFIG) clean -$(MAKE) -C $(CONFIG) distclean
flush: flush:
rm -f $(BUILD_DIR)/tgt-config.cache rm -f $(BUILD_DIR)/tgt-config.cache
%_defconfig: $(TOPDIR)/configs/%_defconfig %_defconfig: $(TOPDIR)/configs/%_defconfig
cp $^ .config cp $^ $(CONFIG_DIR)/.config
@$(MAKE) oldconfig @$(MAKE) O=$(O) oldconfig
configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config

View File

@ -1,4 +1,3 @@
/buildroot-config
/conf /conf
/mconf /mconf
/qconf /qconf

View File

@ -43,7 +43,6 @@ distclean: clean
$(Q)rm -f $(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \ $(Q)rm -f $(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \
$(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \ $(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \
mconf .depend mconf .depend
$(Q)rm -rf buildroot-config
FORCE: FORCE:
.PHONY: FORCE clean distclean .PHONY: FORCE clean distclean

View File

@ -423,8 +423,17 @@ 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");
@ -688,19 +697,51 @@ 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 buf2[PATH_MAX+1];
sym_clear_all_valid(); 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()) if (conf_split_config())
return 1; 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) if (!out)
return 1; return 1;
out_h = fopen(".tmpconfig.h", "w"); out_h = fopen(buf2, "w");
if (!out_h) { if (!out_h) {
fclose(out); fclose(out);
return 1; return 1;
@ -782,14 +823,14 @@ 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(".tmpconfig.h", name)) if (rename(buf2, 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.
*/ */
if (rename(".tmpconfig", name)) if (rename(buf, name))
return 1; return 1;
return 0; return 0;

View File

@ -102,6 +102,7 @@ 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,17 +51,26 @@ static char* br2_symbol_printer(const char * const in)
} }
/* write dependencies of the infividual config-symbols */ /* 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 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";
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) if (!out)
return 1; return 1;
fprintf(out, "# ATTENTION! This does not handle 'depends', just 'select'! \n" fprintf(out, "# ATTENTION! This does not handle 'depends', just 'select'! \n"
@ -120,7 +129,7 @@ next:
} }
} }
fclose(out); fclose(out);
rename(name_tmp, name); rename(buf, name);
printf(_("#\n" printf(_("#\n"
"# make dependencies written to %s\n" "# make dependencies written to %s\n"
"# ATTENTION buildroot devels!\n" "# ATTENTION buildroot devels!\n"
@ -132,6 +141,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 buf[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;
@ -139,7 +150,16 @@ int file_write_dep(const char *name)
if (!name) if (!name)
name = ".kconfig.d"; 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) if (!out)
return 1; return 1;
fprintf(out, "deps_config := \\\n"); fprintf(out, "deps_config := \\\n");
@ -170,8 +190,7 @@ int file_write_dep(const char *name)
fprintf(out, "\n$(deps_config): ;\n"); fprintf(out, "\n$(deps_config): ;\n");
fclose(out); fclose(out);
rename("..config.tmp", name); rename(buf, name);
return write_make_deps(NULL);
} }