mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-05 05:04:44 +02:00
scripts/makefile-getvar: add script to get values from Makefiles
There is often a need to extract a value from a Makefile, and standard GNU Make doesn't provide a way to do this. This script lets you access values from Makefiles directly: $ makefile-getvar curl/tests/server/Makefile noinst_PROGRAMS getpart resolve rtspd sockfilt sws tftpd fake_ntlm socksd disabled mqttd (From OE-Core rev: 881aa40d12d9dde73a932277093e5ceca8eb5c68) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
b82d066887
commit
4574919d30
24
scripts/makefile-getvar
Executable file
24
scripts/makefile-getvar
Executable file
|
@ -0,0 +1,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
|
Loading…
Reference in New Issue
Block a user