]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: Makefile: switch to quiet mode by default for CC/LD/AR
authorWilly Tarreau <w@1wt.eu>
Mon, 19 Nov 2018 07:15:54 +0000 (08:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Nov 2018 07:18:49 +0000 (08:18 +0100)
These commands are now replaced with a prefix and the target name only
in quiet mode, which is much more readable and allows better detection
of build warnings than the default verbose mode. Using V=1 switches back
to the detailed output.

Makefile
README

index ff8c32aa536bb1850b0a3b11956c16d21e537d9b..a5269db0b24ff692a7db0ca1552b50034fdf1679 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,9 @@
 # You should use it this way :
 #   [g]make TARGET=os ARCH=arch CPU=cpu USE_xxx=1 ...
 #
+# By default the detailed commands are hidden for a cleaner output, but you may
+# see them by appending "V=1" to the make command.
+#
 # Valid USE_* options are the following. Most of them are automatically set by
 # the TARGET, others have to be explicitly specified :
 #   USE_DLMALLOC         : enable use of dlmalloc (see DLMALLOC_SRC)
@@ -886,6 +889,16 @@ endif
 # add options at the beginning of the "ld" command line if needed.
 LDOPTS = $(TARGET_LDFLAGS) $(OPTIONS_LDFLAGS) $(ADDLIB)
 
+ifeq ($V,1)
+cmd_CC = $(CC)
+cmd_LD = $(LD)
+cmd_AR = $(AR)
+else
+cmd_CC = $(Q)echo "  CC      $@";$(CC)
+cmd_LD = $(Q)echo "  LD      $@";$(LD)
+cmd_AR = $(Q)echo "  AR      $@";$(AR)
+endif
+
 ifeq ($(TARGET),)
 all:
        @echo
@@ -953,22 +966,22 @@ DEP = $(INCLUDES) .build_opts
 .build_opts: $(shell rm -f .build_opts.new; echo \'$(TARGET) $(BUILD_OPTIONS) $(VERBOSE_CFLAGS)\' > .build_opts.new; if cmp -s .build_opts .build_opts.new; then rm -f .build_opts.new; else mv -f .build_opts.new .build_opts; fi)
 
 haproxy: $(OPTIONS_OBJS) $(OBJS) $(EBTREE_OBJS)
-       $(LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
+       $(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
 
 $(LIB_EBTREE): $(EBTREE_OBJS)
-       $(AR) rv $@ $^
+       $(cmd_AR) rv $@ $^
 
 objsize: haproxy
        $(Q)objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort
 
 %.o:   %.c $(DEP)
-       $(CC) $(COPTS) -c -o $@ $<
+       $(cmd_CC) $(COPTS) -c -o $@ $<
 
 src/trace.o: src/trace.c $(DEP)
-       $(CC) $(TRACE_COPTS) -c -o $@ $<
+       $(cmd_CC) $(TRACE_COPTS) -c -o $@ $<
 
 src/haproxy.o: src/haproxy.c $(DEP)
-       $(CC) $(COPTS) \
+       $(cmd_CC) $(COPTS) \
              -DBUILD_TARGET='"$(strip $(TARGET))"' \
              -DBUILD_ARCH='"$(strip $(ARCH))"' \
              -DBUILD_CPU='"$(strip $(CPU))"' \
@@ -978,7 +991,7 @@ src/haproxy.o:      src/haproxy.c $(DEP)
               -c -o $@ $<
 
 src/dlmalloc.o: $(DLMALLOC_SRC) $(DEP)
-       $(CC) $(COPTS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
+       $(cmd_CC) $(COPTS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
 
 install-man:
        $(Q)install -v -d "$(DESTDIR)$(MANDIR)"/man1
diff --git a/README b/README
index 8b48eb0dce22046649fe084e52b7ab6694c8f8ef..fcc0b78d5392b6062295e0426f3df871e277ce86 100644 (file)
--- a/README
+++ b/README
@@ -65,6 +65,13 @@ one of the following choices to the CPU variable :
 Alternatively, you may just set the CPU_CFLAGS value to the optimal GCC options
 for your platform.
 
+By default the build process runs in quiet mode and hide the details of the
+commands that are executed. This allows to more easily catch build warnings
+and see what is happening. However it is not convenient at all to observe what
+flags are passed to the compiler nor what compiler is involved. Simply append
+"V=1" to the "make" command line to switch to verbose mode and display the
+details again.
+
 You may want to build specific target binaries which do not match your native
 compiler's target. This is particularly true on 64-bit systems when you want
 to build a 32-bit binary. Use the ARCH variable for this purpose. Right now