From 1e7ff5a23347851ec69cc43cb984c08f1ac609fa Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 21 May 2009 11:56:59 +0300 Subject: Switch to `silent rules' mode * bootstrap (slurp): Convert gnulib Makefile.am to support silent rules. * configure.ac (AM_INIT_AUTOMAKE): Add silent-rules. Enable silent rules by default. * gacopyz/Makefile.am, mfd/Makefile.am: Add silent rules markers. --- bootstrap | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 5 +++-- gacopyz/Makefile.am | 2 +- mfd/Makefile.am | 22 +++++++++++----------- 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/bootstrap b/bootstrap index a93ee909..750dc3c7 100755 --- a/bootstrap +++ b/bootstrap @@ -423,6 +423,51 @@ version_controlled_file() { test $found = yes } +# AWK program to convert a Makefile(.am) file rules to Automake 1.11 +# silent mode. +silent_rules_prog=' +# state = 0 - outside rules +# state = 1 - first line inside a rule +# state = 2 - subsequent lines inside a rule +# cont = 1 - this line is a continuation of the previous one + +# Print comment lines +/^[ \t]*#/ { print; next } +# Start of a rule +/^[^ \t].*:/ { print; state = 1; cont = 0; next } +# First action within the rule +state == 1 && /^\t/ { + # Print silent rules without changes. The second match + # is necessary to handle @VAR@ substitutions. + if (match($1, /^@/) && !match($1, /@$/)) + print + else { + sub(/^\t[\t ]*/,"") + print "\t$(AM_V_GEN)" $0 + } + cont = match($0, /\\$/) + state = 2 + next +} +# All non-continuation lines within the rule are prefixed +# with $(AM_V_at). +state == 2 && /^\t/ && NF > 0 { + if (!cont) { + sub(/^\t[\t ]*/,"") + print "\t$(AM_V_at)" $0 + } else + print + cont = match($0, /\\$/) + next +} +# Everything else is output verbatim +{ print }' + +silent_rules=yes +grep 'AM_SILENT_RULES' configure.ac > /dev/null || + grep '^[ ]*AM_INIT_AUTOMAKE([^)][^)]*silent-rules' configure.ac > /dev/null || + silent_rules=no + slurp() { for dir in . `(cd $1 && find * -type d -print)`; do copied= @@ -444,6 +489,10 @@ slurp() { rm -f $dir/$gnulib_mk && sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk } + if test "$silent_rules" = yes; then + awk "$silent_rules_prog" $dir/$gnulib_mk > $dir/${gnulib_mk}-t && + mv $dir/${gnulib_mk}-t $dir/${gnulib_mk} + fi elif { test "${2+set}" = set && test -r $2/$dir/$file; } || version_controlled_file $dir $file; then echo "$0: $dir/$file overrides $1/$dir/$file" diff --git a/configure.ac b/configure.ac index 4fca3bdd..bba239c7 100644 --- a/configure.ac +++ b/configure.ac @@ -24,8 +24,9 @@ AC_INIT([mailfromd], AC_CONFIG_SRCDIR([mfd/main.c]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options]) - +AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options silent-rules]) +# Enable silent rules by default: +test -z "$enable_silent_rules" && AM_DEFAULT_VERBOSITY=0 # AC_DEFINE_UNQUOTED([MAILFROMD_VERSION_MAJOR], MF_VERSION_MAJOR, [Major version number]) diff --git a/gacopyz/Makefile.am b/gacopyz/Makefile.am index d658b3e7..5eb9bde0 100644 --- a/gacopyz/Makefile.am +++ b/gacopyz/Makefile.am @@ -35,6 +35,6 @@ BUILT_SOURCES=trans.h INCLUDES=-I$(top_srcdir)/gnu -I../gnu trans.h: ${top_srcdir}/gacopyz/trans.tab ${top_srcdir}/gacopyz/trans.awk ${top_srcdir}/gacopyz/gacopyz.h - $(AWK) -f ${top_srcdir}/gacopyz/trans.awk \ + $(AM_V_GEN) $(AWK) -f ${top_srcdir}/gacopyz/trans.awk \ -vheader_file=${top_srcdir}/gacopyz/gacopyz.h\ ${top_srcdir}/gacopyz/trans.tab > trans.h diff --git a/mfd/Makefile.am b/mfd/Makefile.am index 1595b20a..b0fc6f99 100644 --- a/mfd/Makefile.am +++ b/mfd/Makefile.am @@ -140,10 +140,10 @@ LDADD = ../lib/libmf.a ../gnu/libgnu.a $(MAILUTILS_LIBS) $(MILTER) $(GEOIP_LIBS) builtin.h: Makefile.am node-type.h: drivers.c - $(AWK) -v MODE=types -f $(top_srcdir)/mfd/drv.awk drivers.c > node-type.h + $(AM_V_GEN) $(AWK) -v MODE=types -f $(top_srcdir)/mfd/drv.awk drivers.c > node-type.h node-tab.c: drivers.c - $(AWK) -f $(top_srcdir)/mfd/drv.awk drivers.c > node-tab.c + $(AM_V_GEN) $(AWK) -f $(top_srcdir)/mfd/drv.awk drivers.c > node-tab.c $(M4_FILES:.m4=.c): snarf.m4 init.m4 @@ -152,40 +152,40 @@ lex.c: gram.h SUFFIXES = .m4 .c .def .h .mfi .mfh .opc .oph .cin .hin .mfi.c: - $(AWK) -f $(top_srcdir)/mfd/mfstat.awk \ + $(AM_V_GEN) $(AWK) -f $(top_srcdir)/mfd/mfstat.awk \ $(top_srcdir)/mfd/mailfromd.h $< > $@ .mfi.mfh: - $(AWK) -f $(top_srcdir)/mfd/mfstat.awk \ + $(AM_V_GEN) $(AWK) -f $(top_srcdir)/mfd/mfstat.awk \ $(top_srcdir)/mfd/mailfromd.h $< > $@ M4=m4 .m4.c: - $(M4) --prefix -s -DSOURCE="$<" $(top_srcdir)/mfd/snarf.m4 $< > $@-t - sed '1{/#line/d;}' $@-t > $@ + $(AM_V_GEN)$(M4) --prefix -s -DSOURCE="$<" $(top_srcdir)/mfd/snarf.m4 $< > $@-t && \ + sed '1{/#line/d;}' $@-t > $@ && \ rm $@-t .def.h: - $(M4) --prefix $(top_srcdir)/mfd/init.m4 $(M4_FILES) $< > $@ + $(AM_V_GEN) $(M4) --prefix $(top_srcdir)/mfd/init.m4 $(M4_FILES) $< > $@ .opc.c: - $(AWK) -f $(top_srcdir)/mfd/opcode.awk \ + $(AM_V_GEN) $(AWK) -f $(top_srcdir)/mfd/opcode.awk \ $(top_srcdir)/mfd/opcodes $< > $@ .oph.h: - $(AWK) -f $(top_srcdir)/mfd/opcode.awk \ + $(AM_V_GEN) $(AWK) -f $(top_srcdir)/mfd/opcode.awk \ $(top_srcdir)/mfd/opcodes $< > $@ optab.c optab.h: opcodes .cin.c: - SRCLIST=`echo $(mailfromd_SOURCES) | tr -s ' ' ','`; \ + $(AM_V_GEN) SRCLIST=`echo $(mailfromd_SOURCES) | tr -s ' ' ','`; \ $(M4) -s -DSRCLIST="$$SRCLIST" $(top_srcdir)/mfd/debugdef.m4 $< > $@ .hin.h: - SRCLIST=`echo $(mailfromd_SOURCES) | tr -s ' ' ','`; \ + $(AM_V_GEN) SRCLIST=`echo $(mailfromd_SOURCES) | tr -s ' ' ','`; \ $(M4) -DSRCLIST="$$SRCLIST" $(top_srcdir)/mfd/debugdef.m4 $< > $@ debug.c: Makefile.in debugdef.m4 debug.cin -- cgit v1.2.1