summaryrefslogtreecommitdiff
path: root/poky/scripts/makefile-getvar
blob: 4a07055e687aceec9256dfde184566493165fda1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/sh

# Get a variable's value from a makefile:
#
# $ makefile-getvar Makefile VARIABLE VARIABLE ...
#
# If multiple variables are specified, they will be printed one per line.
#
# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: GPL-2.0-only

set -eu

MAKEFILE=$1
shift

for VARIABLE in $*; do
	make -f - $VARIABLE.var <<EOF
include $MAKEFILE

%.var:
	@echo \$(\$*)
EOF
done