[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 03/13] build-sys: add a rule to print a variable
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v2 03/13] build-sys: add a rule to print a variable |
Date: |
Fri, 15 Dec 2017 16:06:49 +0100 |
$ make print-CFLAGS
CFLAGS=-fsanitize=address -Og -g
Trick from various sources:
https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
https://www.cmcrossroads.com/article/printing-value-makefile-variable
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
Makefile | 5 ++++-
docs/devel/build-system.txt | 13 +++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 199f39fde1..46bc61004d 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,10 @@ BUILD_DIR=$(CURDIR)
# Before including a proper config-host.mak, assume we are in the source tree
SRC_PATH=.
-UNCHECKED_GOALS := %clean TAGS cscope ctags docker docker-% help
+UNCHECKED_GOALS := %clean TAGS cscope ctags docker docker-% help print-%
+
+print-%:
+ @echo '$*=$($*)'
# All following code might depend on configuration variables
ifneq ($(wildcard config-host.mak),)
diff --git a/docs/devel/build-system.txt b/docs/devel/build-system.txt
index 386ef36ee3..52501f2ad9 100644
--- a/docs/devel/build-system.txt
+++ b/docs/devel/build-system.txt
@@ -510,3 +510,16 @@ default-configs/$TARGET-NAME file as input.
This is the entrypoint used when make recurses to build a single system
or userspace emulator target. It is merely a symlink back to the
Makefile.target in the top level.
+
+
+Useful make targets
+===================
+
+- help
+
+ Print a help message for the most common build targets.
+
+- print-VAR
+
+ Print the value of the variable VAR. Useful for debugging the build
+ system.
--
2.15.1.355.g36791d7216
- [Qemu-devel] [PATCH v2 00/13] Various build-sys and ASAN related fixes, Marc-André Lureau, 2017/12/15
- [Qemu-devel] [PATCH v2 04/13] build-sys: add AddressSanitizer when --enable-debug if possible, Marc-André Lureau, 2017/12/15
- [Qemu-devel] [PATCH v2 06/13] vl: fix direct firmware directories leak, Marc-André Lureau, 2017/12/15
- [Qemu-devel] [PATCH v2 05/13] tests: fix check-qobject leak:, Marc-André Lureau, 2017/12/15
- [Qemu-devel] [PATCH v2 09/13] crypto: fix stack-buffer-overflow error, Marc-André Lureau, 2017/12/15