diff options
Diffstat (limited to 'scripts/makefile-getvar')
| -rwxr-xr-x | scripts/makefile-getvar | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/makefile-getvar b/scripts/makefile-getvar new file mode 100755 index 0000000000..4a07055e68 --- /dev/null +++ b/scripts/makefile-getvar | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | # Get a variable's value from a makefile: | ||
| 4 | # | ||
| 5 | # $ makefile-getvar Makefile VARIABLE VARIABLE ... | ||
| 6 | # | ||
| 7 | # If multiple variables are specified, they will be printed one per line. | ||
| 8 | # | ||
| 9 | # SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| 10 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 11 | |||
| 12 | set -eu | ||
| 13 | |||
| 14 | MAKEFILE=$1 | ||
| 15 | shift | ||
| 16 | |||
| 17 | for VARIABLE in $*; do | ||
| 18 | make -f - $VARIABLE.var <<EOF | ||
| 19 | include $MAKEFILE | ||
| 20 | |||
| 21 | %.var: | ||
| 22 | @echo \$(\$*) | ||
| 23 | EOF | ||
| 24 | done | ||
