| Message ID | 20251218174248.2580279-1-ross.burton@arm.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/5] scripts/makefile-getvar: be more resilient | expand |
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
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 <ross.burton@arm.com> --- scripts/makefile-getvar | 11 +++++++++++ 1 file changed, 11 insertions(+)