mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-22 04:10:48 +00:00
BUILD: makefile: move default verbosity settings to include/make/verbose.mk
The $(Q), $(V), $(cmd_xx) handling needs to be reused in sub-project makefiles and it's a pain to maintain inside the main makefile. Let's just move that into a new subdir include/make/ with a dedicated file "verbose.mk". It slightly cleans up the makefile in addition.
This commit is contained in:
parent
d575661d40
commit
8dd672523f
25
Makefile
25
Makefile
@ -123,12 +123,7 @@
|
||||
# VTEST_PROGRAM : location of the vtest program to run reg-tests.
|
||||
# DEBUG_USE_ABORT: use abort() for program termination, see include/haproxy/bug.h for details
|
||||
|
||||
# verbosity: pass V=1 for verbose shell invocation
|
||||
V = 0
|
||||
Q = @
|
||||
ifeq ($V,1)
|
||||
Q=
|
||||
endif
|
||||
include include/make/verbose.mk
|
||||
|
||||
# WARNING: Do not change cc-opt, cc-opt-alt or cc-warning without checking if
|
||||
# clang bug #49364 is fixed. stderr is redirected to /dev/null on
|
||||
@ -865,24 +860,6 @@ 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
|
||||
ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
|
||||
# 3.81 or above
|
||||
cmd_CC = $(info $ CC $@) $(Q)$(CC)
|
||||
cmd_LD = $(info $ LD $@) $(Q)$(LD)
|
||||
cmd_AR = $(info $ AR $@) $(Q)$(AR)
|
||||
else
|
||||
# 3.80 or older
|
||||
cmd_CC = $(Q)echo " CC $@";$(CC)
|
||||
cmd_LD = $(Q)echo " LD $@";$(LD)
|
||||
cmd_AR = $(Q)echo " AR $@";$(AR)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),)
|
||||
all:
|
||||
@echo "Building HAProxy without specifying a TARGET is not supported."
|
||||
|
@ -1,27 +1,11 @@
|
||||
include ../../include/make/verbose.mk
|
||||
|
||||
CC = cc
|
||||
OPTIMIZE = -O2 -g
|
||||
DEFINE =
|
||||
INCLUDE =
|
||||
OBJS = poll
|
||||
|
||||
V = 0
|
||||
Q = @
|
||||
ifeq ($V,1)
|
||||
Q=
|
||||
endif
|
||||
|
||||
ifeq ($V,1)
|
||||
cmd_CC = $(CC)
|
||||
else
|
||||
ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
|
||||
# 3.81 or above
|
||||
cmd_CC = $(info $ CC $@) $(Q)$(CC)
|
||||
else
|
||||
# 3.80 or older
|
||||
cmd_CC = $(Q)echo " CC $@";$(CC)
|
||||
endif
|
||||
endif
|
||||
|
||||
poll: poll.c
|
||||
$(cmd_CC) $(OPTIMIZE) $(DEFINE) $(INCLUDE) -o $@ $^
|
||||
|
||||
|
@ -1,27 +1,11 @@
|
||||
include ../../include/make/verbose.mk
|
||||
|
||||
CC = gcc
|
||||
OPTIMIZE = -O2 -g
|
||||
DEFINE =
|
||||
INCLUDE =
|
||||
OBJS = tcploop
|
||||
|
||||
V = 0
|
||||
Q = @
|
||||
ifeq ($V,1)
|
||||
Q=
|
||||
endif
|
||||
|
||||
ifeq ($V,1)
|
||||
cmd_CC = $(CC)
|
||||
else
|
||||
ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
|
||||
# 3.81 or above
|
||||
cmd_CC = $(info $ CC $@) $(Q)$(CC)
|
||||
else
|
||||
# 3.80 or older
|
||||
cmd_CC = $(Q)echo " CC $@";$(CC)
|
||||
endif
|
||||
endif
|
||||
|
||||
tcploop: tcploop.c
|
||||
$(cmd_CC) $(OPTIMIZE) $(DEFINE) $(INCLUDE) -o $@ $^
|
||||
|
||||
|
27
include/make/verbose.mk
Normal file
27
include/make/verbose.mk
Normal file
@ -0,0 +1,27 @@
|
||||
# verbosity: pass V=1 for verbose shell invocation
|
||||
V = 0
|
||||
Q = @
|
||||
ifeq ($V,1)
|
||||
Q=
|
||||
endif
|
||||
|
||||
# Some common commands such as CC/LD/AR are redefined with a cmd_ equivalent
|
||||
# and are either mapped to a silent rule just indicating what is being done,
|
||||
# or to themselves depending on the verbosity level.
|
||||
ifeq ($V,1)
|
||||
cmd_CC = $(CC)
|
||||
cmd_LD = $(LD)
|
||||
cmd_AR = $(AR)
|
||||
else
|
||||
ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
|
||||
# 3.81 or above
|
||||
cmd_CC = $(info $ CC $@) $(Q)$(CC)
|
||||
cmd_LD = $(info $ LD $@) $(Q)$(LD)
|
||||
cmd_AR = $(info $ AR $@) $(Q)$(AR)
|
||||
else
|
||||
# 3.80 or older
|
||||
cmd_CC = $(Q)echo " CC $@";$(CC)
|
||||
cmd_LD = $(Q)echo " LD $@";$(LD)
|
||||
cmd_AR = $(Q)echo " AR $@";$(AR)
|
||||
endif
|
||||
endif
|
Loading…
Reference in New Issue
Block a user