From 280a978d9a82a654f5f5029e47b91a243a087f45 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Fri, 1 Mar 2024 02:39:19 +0000 Subject: Add initial infrastructure for pretty printing make output The idea is rather than printing out the full compiler/linker etc command for each recipe e.g cc -c -pipe -fPIC -fvisibility=hidden -O0 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wno-strict-aliasing -Wmissing-prototypes -g -I src -I build/include \ \ \ -o build/src/nxt_cgroup.o \ -MMD -MF build/src/nxt_cgroup.dep -MT build/src/nxt_cgroup.o \ src/nxt_cgroup.c Print a clearer abbreviated message e.g the above becomes CC build/src/nxt_cgroup.o This vastly reduces the noise when compiling and most of the time you don't need to see the full command being executed. This also means that warnings etc show up much more clearly. You can still get the old verbose output by passing V=1 to make e.g $ make V=1 ... NOTE: With recent versions of make(1) you can get this same, verbose, behaviour by using the --debug=print option. This introduces the following message types CC Compiling a source file to an object file. AR Producing a static library, .a archive file. LD Producing a dynamic library, .so DSO, or executable. VER Writing version information. SED Running sed(1). All in all this improves the developer experience. Subsequent commits will make use of this in the core and modules. NOTE: This requires GNU make for which we check. On OpenIndiana/illumos we have to use gmake(1) (GNU make) anyway as the illumos make doesn't work with our Makefile as it is. Also macOS seems to generally install GNU make. We could make it work (probably) on other variants of make, but the complexity starts increasing exponentially. In fact we still print the abbreviated messages in the verbose output so you can still do $ make | grep ^" [A-Z]" on other makes to effectively get the same output. Co-developed-by: Alejandro Colomar Signed-off-by: Alejandro Colomar Signed-off-by: Andrew Clayton --- auto/make | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'auto/make') diff --git a/auto/make b/auto/make index abfd41ad..fc12d6bf 100644 --- a/auto/make +++ b/auto/make @@ -10,6 +10,13 @@ $echo "creating $NXT_MAKEFILE" cat << END > $NXT_MAKEFILE +# Pretty print compiler etc actions... +PP_CC := @echo ' CC ' +PP_AR := @echo ' AR ' +PP_LD := @echo ' LD ' +PP_VER := @echo ' VER ' +PP_SED := @echo ' SED ' + CC = $CC AR = $AR @@ -28,6 +35,28 @@ manpage: $NXT_BUILD_DIR/share/man/man8/unitd.8 END +NXT_OS=$(uname -s) +NXT_GNU_MAKE=$(make --version | grep GNU || true) + +# Requires GNU make. On OpenIndiana at least we have to use gmake +if [ -n "$NXT_GNU_MAKE" ] || [ $NXT_OS = "SunOS" ]; then + + cat << END >> $NXT_MAKEFILE +# By default compiler etc output is hidden, use +# make V=1 ... +# to show it. +V := 0 + +v := @ +ifeq (\$V,1) + v := +endif + +END + +fi + + # The include paths list. $echo -n "NXT_LIB_INCS =" >> $NXT_MAKEFILE -- cgit