GNU bug report logs - #27188
lex/yacc with subdir-objects and --disable-dependency-tracking broken

Previous Next

Package: automake;

Reported by: Nick Brown <brownn <at> Brocade.com>

Date: Thu, 1 Jun 2017 15:13:02 UTC

Severity: normal

Tags: confirmed

Merged with 9859

Full log


View this message in rfc822 format

From: Nick Bowler <nbowler <at> draconx.ca>
To: Mathieu Lirzin <mthl <at> gnu.org>
Cc: Nick Brown <brownn <at> brocade.com>, 27188 <at> debbugs.gnu.org
Subject: bug#27188: lex/yacc with subdir-objects and --disable-dependency-tracking broken
Date: Mon, 5 Jun 2017 19:16:56 -0400
On 6/4/17, Mathieu Lirzin <mthl <at> gnu.org> wrote:
> Nick Brown <brownn <at> Brocade.com> writes:
>> diff --git a/lib/am/lex.am b/lib/am/lex.am
>> index d7ddc77..6357507 100644
>> --- a/lib/am/lex.am
>> +++ b/lib/am/lex.am
>> @@ -23,6 +23,7 @@ endif %?MAINTAINER-MODE%
>>
>>  ?GENERIC?%EXT%%DERIVED-EXT%:
>>  ?!GENERIC?%OBJ%: %SOURCE%
>> +?SUBDIROBJ?	%SILENT%test -d $(dir $@) || $(MKDIR_P) $(dir $@)
>
> I suspect the '$(dir ..)' syntax is not portable.  Hopefully there
> should be a alternative.  Can you look into it?

$(dir ...) is most definitely not portable.  One alternative is to use
$(@D), which is specified in POSIX and essentially works in every make
implementation that I know of.

However, there are still portability gotchas.  At least one implementation
(dmake) supports $(@D) in principle but expands it in a not-quite-POSIX-
compliant way.

POSIX says that the expansion of $(@D) (and similar variables) does not
include a trailing slash and expands to .  for the current directory
(i.e., when the target name does not contain a slash).

In dmake, the expansion of $(@D) (and similar variables) for the current
directory is the empty string, otherwise the expansion contains a trailing
slash.

In cases where the difference matters, this can be worked around in the
shell easily enough.  The difference matters if we adapt the above example
because mkdir with an empty string will fail.  Something like this should
be pretty portable (untested):

  test x"$(@D)" = x || $(MKDIR_P) "$(@D)"

Another way, perhaps even more portable, would be to do the splitting
entirely in the shell, e.g., by using expr.

Cheers,
  Nick




This bug report was last modified 5 years and 322 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.