summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders F Björklund <anders.f.bjorklund@gmail.com>2018-10-03 20:25:24 +0200
committerJoel Rosdahl <joel@rosdahl.net>2018-10-14 22:08:55 +0200
commitfaa4bcf3ce51352458080e664dc68eb408dbf87f (patch)
tree17c803556a1f9ff9d808dd0165727518321c6521
parent662160edd24644c1db332cdfdfdd7f05becd59a8 (diff)
downloadccache-faa4bcf3ce51352458080e664dc68eb408dbf87f.tar.gz
Add configure option for silent make rules
Adopted from AM_SILENT_RULES, default to no
-rw-r--r--Makefile.in25
-rw-r--r--configure.ac10
2 files changed, 29 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in
index dcec0af0..a4097f3a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,3 +1,5 @@
+verbose = @verbose@
+
srcdir = @srcdir@
builddir = @builddir@
VPATH = @srcdir@
@@ -24,6 +26,11 @@ all_cflags = $(CFLAGS)
all_cppflags = @DEFS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir)/src -I$(builddir)/unittest $(CPPFLAGS)
extra_libs = @extra_libs@
+v_at_0 = yes
+v_at_ = $(v_at_$(verbose))
+quiet := $(v_at_$(V))
+Q=$(if $(quiet),@)
+
non_3pp_sources = \
src/args.c \
src/ccache.c \
@@ -95,7 +102,8 @@ files_to_distclean = Makefile config.h config.log config.status
all: ccache$(EXEEXT)
ccache$(EXEEXT): $(ccache_objs) $(extra_libs)
- $(CC) $(all_cflags) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
+ $(if $(quiet),@echo " [LD] $@")
+ $(Q)$(CC) $(all_cflags) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
ccache.1: doc/ccache.1
cp $< $@
@@ -117,8 +125,10 @@ $(zlib_objs): CPPFLAGS += -include config.h
$(zlib_objs): CFLAGS += @no_implicit_fallthrough_warning@
src/zlib/libz.a: $(zlib_objs)
- $(AR) cr $@ $(zlib_objs)
- $(RANLIB) $@
+ $(if $(quiet),@echo " [AR] $@")
+ $(Q)$(AR) cr $@ $(zlib_objs)
+ $(if $(quiet),@echo " [RANLIB] $@")
+ $(Q)$(RANLIB) $@
.PHONY: perf
perf: ccache$(EXEEXT)
@@ -134,12 +144,14 @@ unittest: unittest/run$(EXEEXT)
unittest/run$(EXEEXT)
unittest/run$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs)
- $(CC) $(all_cflags) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
+ $(if $(quiet),@echo " [LD] $@")
+ $(Q)$(CC) $(all_cflags) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
unittest/main.o: unittest/suites.h
unittest/suites.h: $(test_suites) Makefile
- ls $^ | grep -v Makefile | xargs sed -n 's/TEST_SUITE(\(.*\))/SUITE(\1)/p' >$@
+ $(if $(quiet),@echo " [GEN] $@")
+ $(Q)ls $^ | grep -v Makefile | xargs sed -n 's/TEST_SUITE(\(.*\))/SUITE(\1)/p' >$@
.PHONY: check
check: test
@@ -154,6 +166,7 @@ installcheck: ccache$(EXEEXT) unittest/run$(EXEEXT)
CCACHE=$(bindir)/ccache CC='$(CC)' $(BASH) $(srcdir)/test/run
.c.o:
- $(CC) $(all_cppflags) $(all_cflags) -c -o $@ $<
+ $(if $(quiet),@echo " [CC] $@")
+ $(Q)$(CC) $(all_cppflags) $(all_cflags) -c -o $@ $<
@include_dev_mk@
diff --git a/configure.ac b/configure.ac
index 8dfba4bc..c1ac101d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,16 @@ case $host in
;;
esac
+AC_ARG_ENABLE([silent-rules],
+ [AS_HELP_STRING([--enable-silent-rules],
+ [less verbose build output (undo: `make V=1')])])
+case $enable_silent_rules in
+ yes) verbose=0;;
+ no) verbose=1;;
+ *) verbose=1;;
+esac
+
+AC_SUBST(verbose)
AC_SUBST(extra_libs)
AC_SUBST(no_implicit_fallthrough_warning)
AC_SUBST(getopt_long_c)