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 <mvedovati@suse.com>
This commit is contained in:
Marco Vedovati 2019-06-18 13:25:27 +02:00
parent 3718af5f9f
commit cbb8c01412

View File

@ -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 $($*)