Subject: AM_SILENT_RULES breakage with old make(1)

From: "Daniel Richard G." <[email-masked]>
Date: Tue, 01 Nov 2011 00:37:23 -0400

Hello list,

I've recently encountered some breakage in building a package with
Automake 1.11.1's new silent-rules feature enabled, on a VM install of
NeXTSTEP 3.3. An example:

    $ make
    make  all-am
    ))  source='../pcre_compile.c' object='pcre_compile.lo' libtool=yes  DEPDIR=.deps depmode=none /usr/local/bin/bash ../depcomp /usr/local/bin/bash ./libtool )) --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -O2 -c -o pcre_compile.lo ../pcre_compile.c
    sh: syntax error at line 1: `)' unexpected
    *** Exit 2
    Stop.
    *** Exit 1
    Stop.

I tracked this down to the variable-variable-name constructs used to
implement silent rules; this old version of make(1) doesn't parse them
correctly. I added the line

    echo "AM_V_CC = '$(AM_V_CC)'" # for automake debugging

to the .c.lo rule to see what was going on:

    $ make
    make  all-am
    echo "AM_V_CC = '))'" # for automake debugging
    AM_V_CC = '))'
    ))  source='../pcre_compile.c' object='pcre_compile.lo' libtool=yes  DEPDIR=.deps depmode=none /usr/local/bin/bash ../depcomp /usr/local/bin/bash ./libtool )) --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -O2 -c -o pcre_compile.lo ../pcre_compile.c
    sh: syntax error at line 1: `)' unexpected
    *** Exit 2
    Stop.
    *** Exit 1
    Stop.

    $ make V=0
    make  all-am
    echo "AM_V_CC = '@echo "  CC    " pcre_compile.lo;)'" # for automake debugging
    AM_V_CC = '@echo  CC  pcre_compile.lo;)'
    sh: syntax error at line 1: `)' unexpected
    *** Exit 2
    Stop.
    *** Exit 1
    Stop.

    $ make V=1
    make  all-am
    echo "AM_V_CC = ')'" # for automake debugging
    AM_V_CC = ')'
    )  source='../pcre_compile.c' object='pcre_compile.lo' libtool=yes  DEPDIR=.deps depmode=none /usr/local/bin/bash ../depcomp /usr/local/bin/bash ./libtool ) --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -O2 -c -o pcre_compile.lo ../pcre_compile.c
    sh: syntax error at line 1: `)' unexpected
    *** Exit 2
    Stop.
    *** Exit 1
    Stop.

I fiddled around with the assignments where $(AM_DEFAULT_VERBOSITY) and
$(V) are used. Turns out that if you change these assignments from e.g.

    AM_V_CC = $(am__v_CC_$(V))
    am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))

to curly-braces-in-parens...

    AM_V_CC = $(am__v_CC_${V})
    am__v_CC_ = $(am__v_CC_${AM_DEFAULT_VERBOSITY})

or parens-in-curly-braces...

    AM_V_CC = ${am__v_CC_$(V)}
    am__v_CC_ = ${am__v_CC_$(AM_DEFAULT_VERBOSITY)}

...then the variable references are processed correctly, and the silent-
rules feature works as advertised.

--Daniel

-- 
Daniel Richard G. || [email-masked]
My ASCII-art .sig got a bad case of Times New Roman.