[PATCH i-g-t] meson.sh: allow making it less verbose

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Mon Dec 11 11:39:10 UTC 2023


From: Mauro Carvalho Chehab <mchehab at kernel.org>

Add support for not output each build step and run ninja
with --quiet option.

This is interesting specially when executed inside some
script.

Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
---
 meson.sh | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/meson.sh b/meson.sh
index e112a93cf1a2..2ea33d69139e 100755
--- a/meson.sh
+++ b/meson.sh
@@ -2,36 +2,50 @@
 
 cat > Makefile <<EOF
 
+quiet_build =
+quiet_reconfigure =
+Q =
+VERBOSE =
+
+ifeq ("\$(origin V)", "command line")
+  VERBOSE = \$(V)
+endif
+
+ifneq (\$(findstring 0, \$(VERBOSE)),)
+  quiet_build = --quiet
+  Q = @
+endif
+
 .PHONY: default docs
 default: all
 
 build/build.ninja:
-	mkdir -p build
-	meson build
+	\$(Q)mkdir -p build
+	\$(Q)meson build \$(quiet_build)
 
 all: build/build.ninja
-	ninja -C build
+	\$(Q)ninja -C build \$(quiet_build)
 
 clean: build/build.ninja
-	ninja -C build clean
+	\$(Q)ninja -C build clean \$(quiet_build)
 
 test: build/build.ninja
-	ninja -C build test
+	\$(Q)ninja -C build test \$(quiet_build)
 
 reconfigure: build/build.ninja
-	ninja -C build reconfigure
+	\$(Q)ninja -C build reconfigure
 
 check distcheck dist distclean:
-	echo "This is the meson wrapper, not automake" && false
+	@echo "This is the meson wrapper, not automake" && false
 
 install: build/build.ninja
-	ninja -C build install
+	\$(Q)ninja -C build install \$(quiet_build)
 
 uninstall: build/build.ninja
-	ninja -C build uninstall
+	\$(Q)ninja -C build uninstall \$(quiet_build)
 
 docs:
-	ninja -C build igt-gpu-tools-doc
+	\$(Q)ninja -C build igt-gpu-tools-doc \$(quiet_build)
 
 EOF
 
-- 
2.43.0



More information about the igt-dev mailing list