GNU bug report logs - #35886
Built-in variable dependency issue with bindir/exec_prefix/prefix

Previous Next

Package: automake;

Reported by: "Sternberg, Jay E" <jay.e.sternberg <at> intel.com>

Date: Fri, 24 May 2019 17:47:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #7 received at control <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: "Sternberg, Jay E" <jay.e.sternberg <at> intel.com>, 35886-done <at> debbugs.gnu.org
Subject: Re: bug#35886: Built-in variable dependency issue with
 bindir/exec_prefix/prefix
Date: Fri, 24 May 2019 13:04:58 -0500
[Message part 1 (text/plain, inline)]
tag 35886 notabug
thanks

On 5/24/19 12:33 PM, Sternberg, Jay E wrote:
> Built-in variables are stored in the generated Makefile in ascending sort order.  This results in dependency issues specifically for bindir and exec_prefix. after running './configure --prefix /usr'; the resulting Makefile variables are as follows:
> 
> ...
> bindir = ${exec_prefix}/bin
> build_alias =
> builddir = .
> ...
> dvidir = ${docdir}
> exec_prefix = ${prefix}
> host_alias =
> ...
> pdfdir = ${docdir}
> prefix = /usr
> program_transform_name = s,x,x,
> ...
> 
> The result is that when make install uses bindir, the value is "/bin", not "/usr/bin"

You are misunderstanding how makefile macros are handled, and forgetting
that it is a two-phase process.  Make macros are not like shell
variables processed in textual order (where 'bindir =
${exec_prefix}/bin' would assign '/bin/' to the variable bindir if the
variable exec_prefix were currently empty) but rather the first pass
stores all macro definitions, and the second pass then refers to those
stored definitions when determining rules to run. When a macro is
encountered, the literal text stored in the first pass is then expanded
recursively, regardless of the order the macros were defined (so
expanding ${bindir} substitutes the text '${exec_prefix}/bin' then
rescans that output to notice that more substitution is needed, which in
turn expands exec_prefix, then in turn prefix).

Proof:

$ make -f - <<\EOF
> a=${b}
> c=${d}
> d=hi
> all:
>       echo ${a}
> b=${c}
> EOF
echo hi
hi

I see no bug here, so I'm closing this, but feel free to add more
details if there is something else we're missing from your report and we
can reopen as needed.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

[signature.asc (application/pgp-signature, attachment)]

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

Previous Next


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