[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add optional silent-rules support
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] Add optional silent-rules support |
Date: |
Thu, 21 May 2009 11:26:20 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi Sergey,
* Sergey Poznyakoff wrote on Thu, May 21, 2009 at 11:07:53AM CEST:
> How about the following patch, which adds support for `silent-rules'
> mode introduced in Automake 1.11:
Neat idea. :-)
> +# 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 }
Can gnulib-tool create
target1 target2 ... \
targetN : prereq1 ... \
prereqN ; rule-command
rules? Then above would need fixing for several targets, and the
command after the semi-colon would not be silenced.
> +# 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, /@$/))
Shouldn't that be
if (match($1, /^@/) && !match($1, /address@hidden/))
so that it won't treat
@ command
wrongly? Also, this ignores the other possible command prefixes,
'-' and '+', which can be mixed and matched together with '@' in any
order. But that probably doesn't happen in the files this targets.
> + print
> + else {
> + sub(/^\t[\t ]*/,"")
> + print "\t$(AM_V_GEN)" $0
IIUC then you remove any extra indentation; why not something like
sub(/^\t[\t ]*/, "&$(AM_V_GEN)")
print
(untested)? Similarly in state 2.
> + }
> + cont = match($0, /\\$/)
> + state = 2
> + next
> + 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
FWIW the awk script is not portable to ancient awk, such as found on
Solaris. It probably doesn't matter, just thought I'd mention it though
as you might want to use ${AWK-awk} or so to make it overridable.
Cheers,
Ralf
Re: [PATCH] Add optional silent-rules support, Jim Meyering, 2009/05/21
Re: [PATCH] Add optional silent-rules support, Eric Blake, 2009/05/21