Subject: Automake claims $(*F), $(<D), etc. are non-POSIX.

From: Nick Bowler <[email-masked]>
Date: Fri, 23 Sep 2011 15:02:08 -0400

Hello,

When running automake without "foreign" in configure.ac it claims that
variables such as $(*F), $(<D), etc. are non-POSIX, with an error of the
form:

  Makefile.am:2: *F: non-POSIX variable name

The complaints *do* occur with automake --foreign; you have to actually
put foreign in configure.ac (or in AUTOMAKE_OPTIONS) to make them go
away.  Regardless, automake does not complain about $(@F) or $(@D).
However, $(*F) and friends are most certainly POSIX variable names.
Quoting IEEE Std 1003.1-2004:

> The five internal macros are [... $@, $%, $?, $<, $* ...].
>
> Each of the internal macros has an alternative form.  When an
> uppercase 'D' or 'F' is appended to any of the macros, the meaning
> shall be changed to the directory part for 'D' and filename part for
> 'F'. The directory part is the path prefix of the file without a
> trailing slash; for the current directory, the directory part is '.'.
> When the $? macro contains more than one prerequisite filename, the
> $(?D) and $(?F) (or ${?D} and ${?F}) macros expand to a list of
> directory name parts and filename parts respectively.

These variables are supported by (at least) bmake, pmake, dmake and GNU
make.  I can reproduce this with the following example:

% cat >Makefile.am <<'EOF'
.foo.bar:
	echo "$(@F) $(%F) $(?F) $(<F) $(*F) $(@D) $(%D) $(?D) $(<D) $(*D)" > $@
EOF

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

AM_INIT_AUTOMAKE([-Wall])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

  % aclocal
  % automake --add-missing --foreign
  configure.ac:3: installing `./install-sh'
  configure.ac:3: installing `./missing'
  Makefile.am:2: %F: non-POSIX variable name
  Makefile.am:2: ?F: non-POSIX variable name
  Makefile.am:2: <F: non-POSIX variable name
  Makefile.am:2: *F: non-POSIX variable name
  Makefile.am:2: %D: non-POSIX variable name
  Makefile.am:2: ?D: non-POSIX variable name
  Makefile.am:2: <D: non-POSIX variable name
  Makefile.am:2: *D: non-POSIX variable name

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)