Subject: Re: bug#27781: LIBOBJS should depend on LIBOBJDIR

From: Nick Bowler <[email-masked]>
Date: Wed, 23 Aug 2017 18:05:02 -0400

On 8/23/17, Mathieu Lirzin <[email-masked]> wrote:
> Michael Haubenwallner <[email-masked]> writes:
>> Another thought about the final "$(LIBOBJS): .../.dirstamp" Makefile
>> line: If I remember correctly, there have been (non-GNU) make
>> implementations thatchoke on this rule when LIBOBJS is an empty
>> variable: Am I wrong here, or is GNU make required anyway these days?
>
> GNU make is not required for current Automake version.  I didn't find
> any reference of this issue with empty variable target in Autoconf
> "Portable Make programming" section [1] but if it is actually the case
> then it would be nice to find a solution for that.

POSIX requires that target rules specify at least one target.  At least
dmake will fail to parse the makefile if it contains an target rule with
no targets:

  % cat >Makefile <<'EOF'
FOO =
dummy: ;
$(FOO): ;
EOF
  % dmake
  dmake:  Makefile:  line 3:  Error: -- Missing targets or attributes in rule

If the target list is a macro which can reasonably be empty then one
solution is to add a bogus target name that won't be used anywhere
else, along the lines of:

  gobbledegook $(FOO): ;

Cheers,
  Nick