Subject: Spurious target redefinition warnings with Automake conditionals

From: Nick Bowler <[email-masked]>
Date: Tue, 12 Mar 2013 21:40:28 -0400

Consider the following:

  % cat >configure.ac <<'EOF'
AC_INIT([test], [0])

AM_INIT_AUTOMAKE([foreign])

AM_CONDITIONAL([FOO], [true])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

  % cat >Makefile.am <<'EOF'
if FOO
all-local: bar
bar: ; @echo bar
endif

all-local: baz
baz: ; @echo baz
EOF

On this input, Automake is producing the following warning:

  Makefile.am:6: warning: all-local was already defined in condition
FOO, which is included in condition TRUE ...
  Makefile.am:2: ... 'all-local' previously defined here

This warning makes no sense, because there is no problem with this
Makefile.am as far as I can see.  However, the warnings seem to be just
noise as the generated Makefile.in appears correct and works fine.

The conditional there is important: Automake only appears to warn when
one of the all-local rules is inside a conditional and the other is not.