# on the command line, therefore the file is re-created every time make is run.
#
# When BR2_EXTERNAL is set to an empty value (e.g. explicitly in command
-# line), the .br-external file is removed and we point to
-# support/dummy-external. This makes sure we can unconditionally include the
-# Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
-# override is necessary so the user can clear BR2_EXTERNAL from the command
-# line, but the dummy path is still used internally.
+# line), the .br-external file is removed.
BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external
-include $(BR2_EXTERNAL_FILE)
ifeq ($(BR2_EXTERNAL),)
- override BR2_EXTERNAL = support/dummy-external
$(shell rm -f $(BR2_EXTERNAL_FILE))
else
_BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
endif
override BR2_EXTERNAL := $(_BR2_EXTERNAL)
$(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
+ BR2_EXTERNAL_MK = $(BR2_EXTERNAL)/external.mk
endif
# To make sure that the environment variable overrides the .config option,
include linux/linux.mk
include fs/common.mk
-include $(BR2_EXTERNAL)/external.mk
+# Nothing to include if no BR2_EXTERNAL tree in use
+include $(BR2_EXTERNAL_MK)
# Now we are sure we have all the packages scanned and defined. We now
# check for each package in the list of enabled packages, that all its
# Forget options; keep only positional args
shift $((OPTIND-1))
- if [ ${#} -ne 1 ]; then
- error "need exactly one br2-external tree to be specified\n"
+ # Accept 0 or 1 br2-external tree.
+ if [ ${#} -gt 1 ]; then
+ error "only zero or one br2-external tree allowed.\n"
fi
+
br2_ext="${1}"
if [ -z "${ofile}" ]; then
do_validate() {
local br2_ext="${1}"
+ # No br2-external tree is valid
+ if [ -z "${br2_ext}" ]; then
+ return
+ fi
+
if [ ! -d "${br2_ext}" ]; then
error "'%s': no such file or directory\n" "${br2_ext}"
fi
do_kconfig() {
printf '#\n# Automatically generated file; DO NOT EDIT.\n#\n'
printf '\n'
+
+ if [ -z "${BR2_EXT}" ]; then
+ printf '# No br2-external tree defined.\n'
+ return
+ fi
+
printf 'config BR2_EXTERNAL\n'
printf '\tstring\n'
printf '\tdefault "%s"\n' "${BR2_EXT}"
printf '\n'
printf 'menu "User-provided options"\n'
- printf '\tdepends on BR2_EXTERNAL != "support/dummy-external"\n'
printf '\n'
printf 'source "%s/Config.in"\n' "${BR2_EXT}"
printf '\n'