summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2024-03-01 02:39:19 +0000
committerAndrew Clayton <a.clayton@nginx.com>2024-03-09 01:36:23 +0000
commit280a978d9a82a654f5f5029e47b91a243a087f45 (patch)
tree9de004664ea16adf480a964e5e8befeb95727cdf /auto
parentc1e3f02f99a3cab181c36d1f55c552e2bcfba370 (diff)
downloadunit-280a978d9a82a654f5f5029e47b91a243a087f45.tar.gz
unit-280a978d9a82a654f5f5029e47b91a243a087f45.tar.bz2
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 <alx@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'auto')
-rw-r--r--auto/make29
1 files changed, 29 insertions, 0 deletions
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