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/.*\///')
# Pull in the user's configuration file
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
--include .config
+-include $(CONFIG_DIR)/.config
endif
# Override BR2_DL_DIR if shell variable defined
endif
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)
BZCAT:=$(call qstrip,$(BR2_BZCAT))
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))
ifeq ($(DL_DIR),)
DL_DIR:=$(TOPDIR)/dl
endif
-BUILD_DIR:=$(BASE_DIR)/build
-
GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR))
all: world
# 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
# each selected package to TARGETS if that package was selected
# all targets depend on the crosscompiler and it's prerequisites
$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
-$(BR2_DEPENDS_DIR): .config
- rm -rf $@
- mkdir -p $(@D)
- cp -dpRf $(CONFIG)/buildroot-config $@
+$(BR2_DEPENDS_DIR): $(CONFIG_DIR)/.config
+# rm -rf $@
+# mkdir -p $(@D)
+# cp -dpRf $(CONFIG)/buildroot-config $@
dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
$(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
ifeq ($(BR2_CONFIG_CACHE),y)
# drop configure cache if configuration is changed
-$(BUILD_DIR)/tgt-config.cache: .config
+$(BUILD_DIR)/tgt-config.cache: $(CONFIG_DIR)/.config
rm -f $@
touch $@
export HOSTCFLAGS
$(CONFIG)/%onf:
- mkdir -p $(CONFIG)/buildroot-config
+ mkdir -p $(BUILD_DIR)/buildroot-config
$(MAKE) CC="$(HOSTCC)" -C $(CONFIG) $(notdir $@)
- -@if [ ! -f .config ]; then \
- cp $(CONFIG_DEFCONFIG) .config; \
+ -@if [ ! -f $(CONFIG_DIR)/.config ]; then \
+ cp $(CONFIG_DEFCONFIG) $(CONFIG_DIR)/.config; \
fi
xconfig: $(CONFIG)/qconf
- @mkdir -p $(CONFIG)/buildroot-config
- @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/qconf $(CONFIG_CONFIG_IN); then \
- test -f .config.cmd || rm -f .config; \
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @if ! KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/qconf $(CONFIG_CONFIG_IN); then \
+ test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \
fi
gconfig: $(CONFIG)/gconf
- @mkdir -p $(CONFIG)/buildroot-config
- @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/gconf $(CONFIG_CONFIG_IN); then \
- test -f .config.cmd || rm -f .config; \
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @if ! KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/gconf $(CONFIG_CONFIG_IN); then \
+ test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \
fi
menuconfig: $(CONFIG)/mconf
- @mkdir -p $(CONFIG)/buildroot-config
- @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
- test -f .config.cmd || rm -f .config; \
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @if ! KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
+ test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \
fi
config: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/conf $(CONFIG_CONFIG_IN)
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf $(CONFIG_CONFIG_IN)
oldconfig: $(CONFIG)/conf
- mkdir -p $(CONFIG)/buildroot-config
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
+ mkdir -p $(BUILD_DIR)/buildroot-config
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
randconfig: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
allyesconfig: $(CONFIG)/conf
- cat $(CONFIG_DEFCONFIG) > .config
- @mkdir -p $(CONFIG)/buildroot-config
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
+ cat $(CONFIG_DEFCONFIG) > $(CONFIG_DIR)/.config
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
allnoconfig: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
randpackageconfig: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @grep -v BR2_PACKAGE_ .config > .config.nopkg
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- KCONFIG_ALLCONFIG=.config.nopkg \
- $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
- @rm -f .config.nopkg
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
+ @rm -f $(CONFIG_DIR)/.config.nopkg
allyespackageconfig: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @grep -v BR2_PACKAGE_ .config > .config.nopkg
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- KCONFIG_ALLCONFIG=.config.nopkg \
- $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
- @rm -f .config.nopkg
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
+ @rm -f $(CONFIG_DIR)/.config.nopkg
allnopackageconfig: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @grep -v BR2_PACKAGE_ .config > .config.nopkg
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- KCONFIG_ALLCONFIG=.config.nopkg \
- $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
- @rm -f .config.nopkg
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
+ @rm -f $(CONFIG_DIR)/.config.nopkg
defconfig: $(CONFIG)/conf
- @mkdir -p $(CONFIG)/buildroot-config
- @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
- KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
- $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
+ @mkdir -p $(BUILD_DIR)/buildroot-config
+ @KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
+ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
# check if download URLs are outdated
source-check: allyesconfig
ifeq ($(O),output)
rm -rf $(O)
endif
- rm -rf .config .config.old .config.cmd .auto.deps
- -$(MAKE) -C $(CONFIG) clean
+ rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.config.cmd $(CONFIG_DIR)/.auto.deps
+ -$(MAKE) -C $(CONFIG) distclean
flush:
rm -f $(BUILD_DIR)/tgt-config.cache
%_defconfig: $(TOPDIR)/configs/%_defconfig
- cp $^ .config
- @$(MAKE) oldconfig
+ cp $^ $(CONFIG_DIR)/.config
+ @$(MAKE) O=$(O) oldconfig
configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config
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");
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;
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;