Make builds default to quiet mode

Similar to the Linux kernel and perf add infrastructure to reduce the
amount of output tossed to a user during a build. Full build output
can be obtained with 'make V=1'

Builds go from:

make[1]: Leaving directory `/home/dsa/iproute2.git/lib'
make[1]: Entering directory `/home/dsa/iproute2.git/ip'
gcc -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE    -c -o ip.o ip.c
gcc -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE    -c -o ipaddress.o ipaddress.c

to:

...
    AR       libutil.a

ip
    CC       ip.o
    CC       ipaddress.o
...

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
This commit is contained in:
David Ahern 2016-05-24 15:04:49 -07:00 committed by Stephen Hemminger
parent e70b9f16ea
commit 57bdf8b764
10 changed files with 60 additions and 15 deletions

View File

@ -1,3 +1,7 @@
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif
PREFIX?=/usr
LIBDIR?=$(PREFIX)/lib
SBINDIR?=/sbin
@ -50,7 +54,7 @@ LDLIBS += $(LIBNETLINK)
all: Config
@set -e; \
for i in $(SUBDIRS); \
do $(MAKE) $(MFLAGS) -C $$i; done
do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done
Config:
sh configure $(KERNEL_INCLUDE)

View File

@ -9,6 +9,7 @@ endif
all: bridge
bridge: $(BROBJ) $(LIBNETLINK)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all
install -m 0755 bridge $(DESTDIR)$(SBINDIR)

32
configure vendored
View File

@ -317,7 +317,35 @@ EOF
rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest
}
quiet_config()
{
cat <<EOF
# user can control verbosity similar to kernel builds (e.g., V=1)
ifeq ("\$(origin V)", "command line")
VERBOSE = \$(V)
endif
ifndef VERBOSE
VERBOSE = 0
endif
ifeq (\$(VERBOSE),1)
Q =
else
Q = @
endif
ifeq (\$(VERBOSE), 0)
QUIET_CC = @echo ' CC '\$@;
QUIET_AR = @echo ' AR '\$@;
QUIET_LINK = @echo ' LINK '\$@;
QUIET_YACC = @echo ' YACC '\$@;
QUIET_LEX = @echo ' LEX '\$@;
endif
EOF
}
echo "# Generated config based on" $INCLUDE >Config
quiet_config >> Config
check_toolchain
echo "TC schedulers"
@ -357,3 +385,7 @@ echo
echo -n "docs:"
check_docs
echo
echo >> Config
echo "%.o: %.c" >> Config
echo ' $(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<' >> Config

View File

@ -12,6 +12,7 @@ endif
all: $(TARGETS) $(LIBS)
devlink: $(DEVLINKOBJ)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all
install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)

View File

@ -20,6 +20,7 @@ endif
all: genl
genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all
install -m 0755 genl $(DESTDIR)$(SBINDIR)

View File

@ -24,8 +24,10 @@ TARGETS=ip rtmon
all: $(TARGETS) $(SCRIPTS)
ip: $(IPOBJ) $(LIBNETLINK)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
rtmon: $(RTMONOBJ)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all
install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)

View File

@ -15,10 +15,10 @@ NLOBJ=libgenl.o ll_map.o libnetlink.o
all: libnetlink.a libutil.a
libnetlink.a: $(NLOBJ)
$(AR) rcs $@ $(NLOBJ)
$(QUIET_AR)$(AR) rcs $@ $^
libutil.a: $(UTILOBJ) $(ADDLIB)
$(AR) rcs $@ $(UTILOBJ) $(ADDLIB)
$(QUIET_AR)$(AR) rcs $@ $^
install:

View File

@ -21,23 +21,25 @@ endif
all: $(TARGETS)
ss: $(SSOBJ)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
nstat: nstat.c
$(CC) $(CFLAGS) $(LDFLAGS) -o nstat nstat.c $(LIBNETLINK) -lm
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o nstat nstat.c $(LIBNETLINK) -lm
ifstat: ifstat.c
$(CC) $(CFLAGS) $(LDFLAGS) -o ifstat ifstat.c $(LIBNETLINK) -lm
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o ifstat ifstat.c $(LIBNETLINK) -lm
rtacct: rtacct.c
$(CC) $(CFLAGS) $(LDFLAGS) -o rtacct rtacct.c $(LIBNETLINK) -lm
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o rtacct rtacct.c $(LIBNETLINK) -lm
arpd: arpd.c
$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(LDFLAGS) -o arpd arpd.c $(LIBNETLINK) -ldb -lpthread
$(QUIET_CC)$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(LDFLAGS) -o arpd arpd.c $(LIBNETLINK) -ldb -lpthread
ssfilter.c: ssfilter.y
bison ssfilter.y -o ssfilter.c
$(QUIET_YACC)bison ssfilter.y -o ssfilter.c
lnstat: $(LNSTATOBJ)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all
install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)

View File

@ -125,15 +125,16 @@ CFLAGS += -DYY_NO_INPUT
MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
%.so: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
all: libtc.a tc $(TCSO)
tc: $(TCOBJ) $(TCLIB)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
libtc.a: $(TCLIB)
$(AR) rcs $@ $(TCLIB)
$(QUIET_AR)$(AR) rcs $@ $(TCLIB)
install: all
mkdir -p $(MODDESTDIR)
@ -154,21 +155,21 @@ clean:
rm -f emp_ematch.yacc.*
q_atm.so: q_atm.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
m_xt.so: m_xt.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$($(PKG_CONFIG) xtables --cflags --libs)
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$($(PKG_CONFIG) xtables --cflags --libs)
m_xt_old.so: m_xt_old.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c $$($(PKG_CONFIG) xtables --cflags --libs)
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c $$($(PKG_CONFIG) xtables --cflags --libs)
em_ipset.o: CFLAGS += $$($(PKG_CONFIG) xtables --cflags)
%.yacc.c: %.y
$(YACC) $(YACCFLAGS) -o $@ $<
$(QUIET_YACC)$(YACC) $(YACCFLAGS) -o $@ $<
%.lex.c: %.l
$(LEX) $(LEXFLAGS) -o$@ $<
$(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $<
# our lexer includes the header from yacc, so make sure
# we don't attempt to compile it before the header has

View File

@ -19,6 +19,7 @@ endif
all: $(TARGETS) $(LIBS)
tipc: $(TIPCOBJ)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all
install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)