From cbb8c01412c9c348731c7dae38a1fafa0802dd49 Mon Sep 17 00:00:00 2001 From: Marco Vedovati Date: Tue, 18 Jun 2019 13:25:27 +0200 Subject: [PATCH] make: add print-% target printing variable value Add a print-% make target, to be able to retrieve the value of make variables. E.g. "make print-MY_MAKE_VAR MY_MAKE_VAR=1" will print "1" Signed-off-by: Marco Vedovati --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index a51dd79e8..25fb2770c 100644 --- a/Makefile +++ b/Makefile @@ -125,3 +125,12 @@ install-scripts: .PHONY: clean clean: rm -rf $(DISTRO_ROOTFS_MARKER) $(DISTRO_ROOTFS) $(DISTRO_IMAGE) $(DISTRO_INITRD) + +# Prints the name of the variable passed as suffix to the print- target, +# E.g., if Makefile contains: +# MY_MAKE_VAR := foobar +# Then: +# $ make printf-MY_MAKE_VAR +# Will print "foobar" +print-%: + @echo $($*)