Check that we've been passed enough arguments (at least the Makefile and one variable), and that the Makefile specified is actually a file.
Signed-off-by: Ross Burton <[email protected]> --- scripts/makefile-getvar | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/makefile-getvar b/scripts/makefile-getvar index 4a07055e687..e8a98327667 100755 --- a/scripts/makefile-getvar +++ b/scripts/makefile-getvar @@ -11,9 +11,20 @@ set -eu +if [ $# -lt 2 ]; then + echo "Get a variable's value from a Makefile:" + echo "$ makefile-getvar Makefile VARIABLE VARIABLE ..." + exit 0 +fi + MAKEFILE=$1 shift +if [ ! -f $MAKEFILE ]; then + echo $MAKEFILE is not a file + exit 1 +fi + for VARIABLE in $*; do make -f - $VARIABLE.var <<EOF include $MAKEFILE -- 2.43.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#228128): https://lists.openembedded.org/g/openembedded-core/message/228128 Mute This Topic: https://lists.openembedded.org/mt/116846134/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
