path: root/support
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2019-07-29 22:19:56 +0200
committerGravatar Peter Korsgaard <peter@korsgaard.com>2019-08-03 21:51:40 +0200
commitd027cd75d098910be05866c28fd998ad28d5d6d0 (patch)
tree956e12dcdbed1204fac793637beaeaedaaca6b2d /support
parent76345bf6bcd3429f44156dc3654144403f485051 (diff)
core: generate all br2-external files in one go
When we introduced support for multiple br2-external trees, we introduced two files, one on the Makefile side, needed very early, and one on the kconfig side, needed later in the configuration process. We naturally introduced a two-step generation, as it looked like the simplest and most obvious way. But now, we are on the verge of generating more files on the kconfig side, and it does not make sense to add even more steps to generate them. And even better yet, we can generate both the Makefile-side and kconfig-side files at the same time, in fact. Make it so. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'support')
1 files changed, 8 insertions, 15 deletions
diff --git a/support/scripts/br2-external b/support/scripts/br2-external
index 26a5d230ab..1840cc937b 100755
--- a/support/scripts/br2-external
+++ b/support/scripts/br2-external
@@ -14,13 +14,11 @@ MANUAL_URL='https://buildroot.org/manual.html\#br2-external-converting'
main() {
- local br2_ext ofile ofmt
+ local br2_ext outputdir
- while getopts :kmo: OPT; do
+ while getopts :d: OPT; do
case "${OPT}" in
- o) ofile="${OPTARG}";;
- k) ofmt="kconfig";;
- m) ofmt="mk";;
+ d) outputdir="${OPTARG}";;
:) error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
\?) error "unknown option '%s'\n" "${OPTARG}";;
@@ -28,23 +26,18 @@ main() {
# Forget options; keep only positional args
shift $((OPTIND-1))
- case "${ofmt}" in
- mk|kconfig)
- ;;
- *) error "no output format specified (-m/-k)\n";;
- esac
- if [ -z "${ofile}" ]; then
- error "no output file specified (-o)\n"
+ if [ -z "${outputdir}" ]; then
+ error "no output directory specified (-d)\n"
- exec >"${ofile}"
# Trap any unexpected error to generate a meaningful error message
trap "error 'unexpected error while generating ${ofile}\n'" ERR
do_validate ${@//:/ }
- do_${ofmt}
+ mkdir -p "${outputdir}"
+ do_mk >"${outputdir}/.br2-external.mk"
+ do_kconfig >"${outputdir}/.br2-external.in"
# Validates the br2-external trees passed as arguments. Makes each of