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>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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