pkgsrc-Users archive

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

Re: Surprising make behavior (was: Re: strange trouble building qgis)

for the record (only saw this now),

On Sat, Sep 12, 2020 at 06:30:06PM +0200, Martin Husemann wrote:
 > The context is: there is a file name containing a $, and it is listed
 > on the RHS of a dependency line:
 > target:	$$file
 > 	(recipe)
 > and I would strongly expect that $$file to yield a string "$file" not
 > be expanded arbitrarily often. Why does it happen to be
 > target:	$$$$file
 > 	(recipe)
 > that works here, and not, say, $$$$$file ?
 > I understand that the handling in general is tricky and of course we often
 > need to create variables as result of expansions.

It is because the rule line is expanded both when the makefile is
initially read and also when the target is run. This is necessary to
both preserve the expected semantics of accesses to ordinary variables
(which might be reassigned downstream) and also to support
target-scope variables like $(.ALLSRC), but it causes problems, of
which this is one.

It is a bug, and ideally it would be fixed before anyone wrote any
more logic depending on it, but that's easier said that done.

David A. Holland

Home | Main Index | Thread Index | Old Index