@@ -16,6 +16,19 @@ config BR2_HOSTARCH
source "target/Config.in.arch"
+# BR2_DEFCONFIG must be set through two configs, because 'option env='
+# removes it from the .config.
+config BR2_PROJECT_DIR_FROM_ENV
+ string
+ option env="BR2_PROJECT_DIR"
+
+config BR2_PROJECT_DIR
+ string "Project directory"
+ default BR2_PROJECT_DIR_FROM_ENV
+ help
+ This option is used to set defaults for many other configuration
+ variables. Each one of those can still be overridden individually.
+
menu "Build options"
menu "Commands"
@@ -96,6 +96,8 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(CONFIG_DIR)/.config
endif
+PROJECT_DIR = $(realpath $(call qstrip,$(BR2_PROJECT_DIR)))
+
# To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands
ifdef V
@@ -557,6 +559,7 @@ COMMON_CONFIG_ENV = \
KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
+ BR2_PROJECT_DIR=$(PROJECT_DIR) \
BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile