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.
This commit is contained in:
parent
6db8266409
commit
1611965e7d
25
Makefile
25
Makefile
|
@ -3,6 +3,9 @@
|
||||||
# You should use it this way :
|
# You should use it this way :
|
||||||
# [g]make TARGET=os ARCH=arch CPU=cpu USE_xxx=1 ...
|
# [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
|
# Valid USE_* options are the following. Most of them are automatically set by
|
||||||
# the TARGET, others have to be explicitly specified :
|
# the TARGET, others have to be explicitly specified :
|
||||||
# USE_DLMALLOC : enable use of dlmalloc (see DLMALLOC_SRC)
|
# 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.
|
# add options at the beginning of the "ld" command line if needed.
|
||||||
LDOPTS = $(TARGET_LDFLAGS) $(OPTIONS_LDFLAGS) $(ADDLIB)
|
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),)
|
ifeq ($(TARGET),)
|
||||||
all:
|
all:
|
||||||
@echo
|
@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)
|
.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)
|
haproxy: $(OPTIONS_OBJS) $(OBJS) $(EBTREE_OBJS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
$(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
||||||
|
|
||||||
$(LIB_EBTREE): $(EBTREE_OBJS)
|
$(LIB_EBTREE): $(EBTREE_OBJS)
|
||||||
$(AR) rv $@ $^
|
$(cmd_AR) rv $@ $^
|
||||||
|
|
||||||
objsize: haproxy
|
objsize: haproxy
|
||||||
$(Q)objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort
|
$(Q)objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort
|
||||||
|
|
||||||
%.o: %.c $(DEP)
|
%.o: %.c $(DEP)
|
||||||
$(CC) $(COPTS) -c -o $@ $<
|
$(cmd_CC) $(COPTS) -c -o $@ $<
|
||||||
|
|
||||||
src/trace.o: src/trace.c $(DEP)
|
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)
|
src/haproxy.o: src/haproxy.c $(DEP)
|
||||||
$(CC) $(COPTS) \
|
$(cmd_CC) $(COPTS) \
|
||||||
-DBUILD_TARGET='"$(strip $(TARGET))"' \
|
-DBUILD_TARGET='"$(strip $(TARGET))"' \
|
||||||
-DBUILD_ARCH='"$(strip $(ARCH))"' \
|
-DBUILD_ARCH='"$(strip $(ARCH))"' \
|
||||||
-DBUILD_CPU='"$(strip $(CPU))"' \
|
-DBUILD_CPU='"$(strip $(CPU))"' \
|
||||||
|
@ -978,7 +991,7 @@ src/haproxy.o: src/haproxy.c $(DEP)
|
||||||
-c -o $@ $<
|
-c -o $@ $<
|
||||||
|
|
||||||
src/dlmalloc.o: $(DLMALLOC_SRC) $(DEP)
|
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:
|
install-man:
|
||||||
$(Q)install -v -d "$(DESTDIR)$(MANDIR)"/man1
|
$(Q)install -v -d "$(DESTDIR)$(MANDIR)"/man1
|
||||||
|
|
7
README
7
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
|
Alternatively, you may just set the CPU_CFLAGS value to the optimal GCC options
|
||||||
for your platform.
|
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
|
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
|
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
|
to build a 32-bit binary. Use the ARCH variable for this purpose. Right now
|
||||||
|
|
Loading…
Reference in New Issue