bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35886: Built-in variable dependency issue with bindir/exec_prefix/pr


From: Eric Blake
Subject: bug#35886: Built-in variable dependency issue with bindir/exec_prefix/prefix
Date: Fri, 24 May 2019 13:04:58 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]