From bd06502b22cd12d8101b21f01d9f0320717b3501 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 8 Jan 2025 10:29:39 +0100 Subject: [PATCH] BUILD: makefile: add a qinfo macro to pass info in quiet mode Some commands such as $(cmd_CC) etc already handle the quiet vs verbose mode in the makefile, but sometimes we may want to pass other info. The new "qinfo" macro can be called with a 9-char string argument (spaces included) as a prefix for some commands, to emit that string when in quiet mode. The caller must fill the spaces needed for alignment. E.g: $(call quinfo, CC )$(CC) ... --- include/make/verbose.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/make/verbose.mk b/include/make/verbose.mk index 6ee10a00b..8fb1f10b8 100644 --- a/include/make/verbose.mk +++ b/include/make/verbose.mk @@ -7,13 +7,17 @@ endif # Some common commands such as CC/LD/AR are redefined with a cmd_ equivalent # and are either mapped to a silent rule just indicating what is being done, -# or to themselves depending on the verbosity level. +# or to themselves depending on the verbosity level. The qinfo macro is meant +# to be called using $(call qinfo,) as a prefix, and will be either +# empty or that ; the caller must pass the alignment spaces (9 chars +# total). ifeq ($V,1) cmd_CC = $(CC) cmd_CXX = $(CXX) cmd_LD = $(LD) cmd_AR = $(AR) cmd_MAKE = +$(MAKE) +qinfo = else ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81))) # 3.81 or above @@ -22,6 +26,7 @@ cmd_CXX = $(info $ CXX $@) $(Q)$(CXX) cmd_LD = $(info $ LD $@) $(Q)$(LD) cmd_AR = $(info $ AR $@) $(Q)$(AR) cmd_MAKE = $(info $ MAKE $@) $(Q)+$(MAKE) +qinfo = $(info $(1) $@) $(Q) else # 3.80 or older cmd_CC = $(Q)echo " CC $@";$(CC) @@ -29,5 +34,6 @@ cmd_CXX = $(Q)echo " CXX $@";$(CXX) cmd_LD = $(Q)echo " LD $@";$(LD) cmd_AR = $(Q)echo " AR $@";$(AR) cmd_MAKE = $(Q)echo " MAKE $@";$(MAKE) +qinfo = $(Q)echo "$(1) $@"; endif endif