From: Willy Tarreau Date: Mon, 19 Nov 2018 07:15:54 +0000 (+0100) Subject: BUILD: Makefile: switch to quiet mode by default for CC/LD/AR X-Git-Tag: v1.9-dev8~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1611965e7de0228ec4ead450b5e62a587d55cf20;p=thirdparty%2Fhaproxy.git BUILD: Makefile: switch to quiet mode by default for CC/LD/AR 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. --- diff --git a/Makefile b/Makefile index ff8c32aa53..a5269db0b2 100644 --- 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 8b48eb0dce..fcc0b78d53 100644 --- 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