[PATCH v2 2/3] Makefile: add a utility to dump variables
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 1, 2021, 19:19 UTC
- Message-ID
- <patch-v2-2.3-97738b056cf-20211101T191231Z-avarab@gmail.com>
- In-Reply-To
- <cover-v2-0.3-00000000000-20211101T191231Z-avarab@gmail.com>
Add handy "print-var-%" and "print-list-%" targets, these can both be used for ad-hoc debugging, and to integrate the Makefile into some other build system which needs to extract information from it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile index 100658dfa43..4139bcf675c 100644 --- a/Makefile +++ b/Makefile @@ -590,6 +590,14 @@ TEST_OBJS = TEST_PROGRAMS_NEED_X = THIRD_PARTY_SOURCES = +# Utility to dump whatever variables are defined here +print-var-%: + @echo $($*) + +print-list-%: + @echo $* = + @for v in $($*); do echo $* += $$v; done + # Having this variable in your environment would break pipelines because # you cause "cd" to echo its destination to stdout. It can also take # scripts to unexpected places. If you like CDPATH, define it for your
-- 2.33.1.1570.g069344fdd45